![]() |
VOOZH | about |
dotnet add package OpenTelemetry.Exporter.OneCollector --version 1.16.0
NuGet\Install-Package OpenTelemetry.Exporter.OneCollector -Version 1.16.0
<PackageReference Include="OpenTelemetry.Exporter.OneCollector" Version="1.16.0" />
<PackageVersion Include="OpenTelemetry.Exporter.OneCollector" Version="1.16.0" />Directory.Packages.props
<PackageReference Include="OpenTelemetry.Exporter.OneCollector" />Project file
paket add OpenTelemetry.Exporter.OneCollector --version 1.16.0
#r "nuget: OpenTelemetry.Exporter.OneCollector, 1.16.0"
#:package OpenTelemetry.Exporter.OneCollector@1.16.0
#addin nuget:?package=OpenTelemetry.Exporter.OneCollector&version=1.16.0Install as a Cake Addin
#tool nuget:?package=OpenTelemetry.Exporter.OneCollector&version=1.16.0Install as a Cake Tool
| Status | |
|---|---|
| Stability | Stable |
| Code Owners | @rajkumar-rangaraj |
👁 NuGet version badge
👁 NuGet download count badge
👁 codecov.io
The OneCollectorExporter is designed for Microsoft products to send data to public-facing end-points which route to Microsoft's internal data pipeline. It is not meant to be used outside of Microsoft products and is open sourced to demonstrate best practices and to be transparent about what is being collected.
dotnet add package OpenTelemetry.Exporter.OneCollector
using var logFactory = LoggerFactory.Create(builder => builder
.AddOpenTelemetry(builder =>
{
builder.IncludeScopes = true;
builder.AddOneCollectorExporter("InstrumentationKey=instrumentation-key-here");
}));
var logger = logFactory.CreateLogger<MyService>();
using var scope = logger.BeginScope("{requestContext}", Guid.NewGuid());
logger.LogInformation("Request received {requestId}!", 1);
logger.LogWarning("Warning encountered {error_code}!", 0xBAADBEEF);
By default when sending logs/events OneCollectorExporter generates fully
qualified names using the LogRecord CategoryName and EventId.Name
properties (ex: $"{CategoryName}.{EventId.Name}"). When EventId.Name is not
supplied the OneCollectorLogExporterOptions.DefaultEventName property is used
(the default value is Log). Event full names are used by the OneCollector
service to create tables to store logs/events. The final table name may change
casing and will change . characters to _ characters.
The default behavior is designed so that each unique log/event is mapped to its own table with its own schema. Attributes supplied on logs/events are promoted to columns on the table.
In the event that the default full name generation behavior does not result in
the desired table configuration, EventFullNameMappings may be supplied to
OneCollectorExporter to customize the final event full names sent to the
OneCollector service.
When a log/event is mapped OneCollectorExporter will automatically add the
namespace and/or name attribute(s) to preserve the original values.
Mappings can be specified using a default wild card rule, exact-match rules,
and/or prefix-based (StartsWith) rules. In the event multiple prefix matches
are made the one matching the most characters is selected.
To change the default event full name for all logs add an entry with the key
* and set the value to the desired event full name. Only a single *
default entry may exist.
To change the event full name for a specific namespace/category of log records add an entry with the key set to a prefix that will match from the starting portion of the namespace/category. Set the value to the desired event full name.
For example, given the configuration...
logging.AddOneCollectorExporter(
"InstrumentationKey=instrumentation-key-here",
builder => builder.SetEventFullNameMappings(
new Dictionary<string, string>()
{
{ "*", "DefaultLogs" },
{ "MyCompany", "InternalLogs" },
{ "MyCompany.Product1", "InternalProduct1Logs" },
{ "MyCompany.Product2", "InternalProduct2Logs" },
{ "MyCompany.Product2.Security", "InternalSecurityLogs" },
});
...log event full name mapping would be performed as such:
ILogger<ThirdParty.Thing>: All logs emitted through this logger will use
the "DefaultLogs" event full name
ILogger<MyCompany.ProductX.Thing>: All logs emitted through this logger
will use the "InternalLogs" event full name
ILogger<MyCompany.Product1.Thing>: All logs emitted through this logger
will use the "InternalProduct1Logs" event full name
ILogger<MyCompany.Product2.Thing>: All logs emitted through this logger
will use the "InternalProduct2Logs" event full name
ILogger<MyCompany.Product2.Security.Alert>: All logs emitted through this
logger will use the "InternalSecurityLogs" event full name
The default mapping behavior used by OneCollectorExporter is designed so that
each unique log/event is mapped to its own table with its own schema. Using
EventFullNameMappings may lead to many disparate logs/events with differing
schema going into the same table. This could lead to wide tables with many
columns or, in the case of logs/events sending attributes with the same name but
different data types, lost or corrupt data.
OneCollectorExporter does not currently provide any features to automatically
flatten or stringify attributes into a single column to prevent "schema
explosion" issues as described above. Users are encouraged to manually stringify
attributes which should not become columns into JSON strings and log them into a
standard attribute:
logger.LogInformation(
"Hello world {ColumnA} {ColumnB} {Attributes}",
"A", // ColumnA
"B", // ColumnB
// Attributes:
JsonSerializer.Serialize(
new Dictionary<string, object?>()
{
["id"] = 1,
["name"] = "name_goes_here",
}));
Pass-through mappings that preserve the original event namespace and/or name are also possible.
For example, given the configuration...
logging.AddOneCollectorExporter(
"InstrumentationKey=instrumentation-key-here",
builder => builder.SetEventFullNameMappings(
new Dictionary<string, string>()
{
{ "*", "DefaultLogs" },
{ "MyCompany", "*" },
});
...log event full name mapping would be performed as such:
ILogger<ThirdParty.Thing>: All logs emitted through this logger will use
the "DefaultLogs" event full name via the wild-card default rule.
ILogger<MyCompany.OtherThing>: All logs emitted through this logger will
have event full names generated as $"MyCompany.OtherThing.{EventId.Name}".
OneCollectorLogExporterOptions.DefaultEventName is used (default value is
Log) if a log/event does not have EventId.Name specified.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 is compatible. |
| .NET Framework | net461 net461 was computed. net462 net462 is compatible. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.