Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[otlp] Add note on ilogger scopes #4818

32 changes: 32 additions & 0 deletions src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@ Core](../../examples/AspNetCore/Program.cs) example app. Check this
for configuring OpenTelemetry with `ILogger` for certain application types such
as ASP.NET Core and .NET Worker.

**ILogger Scopes**: Otlp log exporter supports exporting ILogger scopes when
vishweshbankwar marked this conversation as resolved.
Show resolved Hide resolved
enabled using
[IncludeScopes](../../docs/logs/customizing-the-sdk/Readme.md#includescopes)
setting on `OpenTelemetryLoggerOptions`.

> **Note**
> Scope attributes with key set as empty string or `{OriginalFormat}`
are ignored by exporter. Duplicate keys are exported as is.

CodeBlanch marked this conversation as resolved.
Show resolved Hide resolved
## Configuration

You can configure the `OtlpExporter` through `OtlpExporterOptions`
Expand Down Expand Up @@ -242,6 +251,29 @@ services.AddHttpClient(
Note: The single instance returned by `HttpClientFactory` is reused by all
export requests.

## Experimental features
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alanwest FYI I took this from your previous PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

categorize this into signals (logs, metrics sub-headings)


The OTLP exporter contains the following experimental features that are
vishweshbankwar marked this conversation as resolved.
Show resolved Hide resolved
available only in pre-release packages:

* The [exemplar
specification](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#exemplar)
is not yet stable. Pre-release builds of the OpenTelemetry .NET SDK and the
OTLP exporter support sampling and exporting exemplars.
* Support for exporting the following fields on `LogRecord`: `CategoryName`,
`EventId`, and `Exception`. These fields are unique to OpenTelemetry .NET's
data model (i.e., they are not reflected in the [standard data
model](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/data-model.md#log-and-event-record-definition)).
While they can be exported as attributes, there is no established conventions
for the attribute key names. In pre-release builds, these fields are exported
as attributes mapped as follows:
* `CategoryName` maps to `dotnet.ilogger.category_name`.
* `EventId` maps to two attributes `Id` and `Name` representing `Event.Id` and
`EventId.Name`, respectively.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this EventId.Name instead of Event.Name (it seems super weird comparing with Event.Id)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@reyang reyang Aug 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know but the names we have here sound wrong.

Copy link
Member Author

@vishweshbankwar vishweshbankwar Aug 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was a typo which I fixed. It should be EventId.Id not Event.Id. Sorry for the confusion

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was a typo which I fixed. It should be EventId.Id not Event.Id. Sorry for the confusion

It's getting even worse.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@cijothomas cijothomas Aug 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @reyang is asking about the "attribute" key?
The attribute names are just "Id" and "Name" as per this doc.

* `Exception` maps to the attributes defined by the experimental [exception
semantic
conventions](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/exceptions/exceptions-logs.md#attributes).

## Troubleshooting

This component uses an
Expand Down