-
Notifications
You must be signed in to change notification settings - Fork 782
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 Exporter: Conditionally compile experimental log features #4762
Changes from all commits
5c3188c
96a280b
0a5669d
2dea303
5b00c21
6dfcefb
10374f4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,11 @@ exporter. | |
[specification](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.23.0/specification/metrics/sdk_exporters/otlp.md#additional-configuration). | ||
([#4667](https://github.com/open-telemetry/opentelemetry-dotnet/pull/4667)) | ||
|
||
* **[Experimental feature](./README.md#experimental-features)** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @alanwest The main README lists multiple ways to do experimental features and then this links to that. Users won't know which type of experimental feature style this happens to use (pre-release build in this case). Could we write the main README with sections on the different types so we could link to an anchor from here? Or some other way you can come up with to make it clear 😄 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1
Also, to me this is not a experimental feature just yet as I do not have a way to opt-in/out :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
To clarify, this does not link to the main readme. Did you see the OTLP exporter readme? It documents which style this feature is provided by.
It's experimental in that it's not gonna be in the next stable release. I've attempted to document things as they will be when this PR merges to main. If in a future PR, someone introduces a feature flag or something for this, then the documentation will need to be updated. I'm open to making things more clear since that's my main goal with this documentation, but please make a github suggestion proposing different language or formatting, so I can be clear what you find unclear 😄. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Ah sorry my bad! Looks good. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
Exporting the following fields from `LogRecord` is now considered | ||
an experimental feature: `CategoryName`, `EventId`, and `Exception`. | ||
Refer to the documentation for more details. | ||
|
||
## 1.6.0-alpha.1 | ||
|
||
Released 2023-Jul-12 | ||
|
@@ -34,20 +39,18 @@ Released 2023-Jul-12 | |
for more details. | ||
([#4647](https://github.com/open-telemetry/opentelemetry-dotnet/pull/4647)) | ||
|
||
* **Experimental (pre-release builds only):** | ||
|
||
* Note: See | ||
[#4735](https://github.com/open-telemetry/opentelemetry-dotnet/pull/4735) | ||
for the introduction of experimental api support. | ||
|
||
* Add back support for Exemplars. See | ||
[exemplars](../../docs/metrics/customizing-the-sdk/README.md#exemplars) for | ||
instructions to enable exemplars. | ||
([#4553](https://github.com/open-telemetry/opentelemetry-dotnet/pull/4553)) | ||
|
||
* Updated to support `Severity` and `SeverityText` when exporting | ||
`LogRecord`s. | ||
([#4568](https://github.com/open-telemetry/opentelemetry-dotnet/pull/4568)) | ||
* **[Experimental feature](./README.md#experimental-features)** | ||
Add back support for Exemplars which is now treated as an experimental | ||
feature available only in pre-release builds. See | ||
[exemplars](../../docs/metrics/customizing-the-sdk/README.md#exemplars) for | ||
instructions to enable exemplars. | ||
([#4553](https://github.com/open-telemetry/opentelemetry-dotnet/pull/4553)) | ||
|
||
* **[Experimental feature](./README.md#experimental-features)** | ||
The `Severity` and `SeverityText` fields on `LogRecord` are only available in | ||
pre-release builds of the SDK. Pre-release builds of the OTLP exporter will | ||
export these fields. | ||
([#4568](https://github.com/open-telemetry/opentelemetry-dotnet/pull/4568)) | ||
|
||
## 1.5.1 | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,9 +16,13 @@ | |
|
||
using System.Runtime.CompilerServices; | ||
using Google.Protobuf; | ||
#if EXPOSE_EXPERIMENTAL_FEATURES | ||
using OpenTelemetry.Internal; | ||
#endif | ||
using OpenTelemetry.Logs; | ||
#if EXPOSE_EXPERIMENTAL_FEATURES | ||
using OpenTelemetry.Trace; | ||
#endif | ||
using OtlpCollector = OpenTelemetry.Proto.Collector.Logs.V1; | ||
using OtlpCommon = OpenTelemetry.Proto.Common.V1; | ||
using OtlpLogs = OpenTelemetry.Proto.Logs.V1; | ||
|
@@ -79,7 +83,7 @@ internal static OtlpLogs.LogRecord ToOtlpLog(this LogRecord logRecord, SdkLimitO | |
|
||
var attributeValueLengthLimit = sdkLimitOptions.AttributeValueLengthLimit; | ||
var attributeCountLimit = sdkLimitOptions.AttributeCountLimit ?? int.MaxValue; | ||
|
||
#if EXPOSE_EXPERIMENTAL_FEATURES | ||
utpilla marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we still going to rename the EventId keys? I think we should. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PS: Probably worth mentioning this in CHANGELOG. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
See conversation here #4762 (comment)
Yes, please hold on merging this. I haven't submitted a changelog entry yet because I'm working on a method to document our experimental features somewhat centrally. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @CodeBlanch @utpilla @vishweshbankwar @Kielek Take another look at this PR. Besides updating the changelog, I reorganized it a bit to propose a slightly different pattern documenting experimental features not only in the changelog but also in the README. This way the documentation of our experimental features doesn't get buried in old changelog entries. If this pattern looks good, I'm happy to follow up in a separate PR fixing up the documentation for the other components we have introduced experimental features for. |
||
// First add the generic attributes like Category, EventId and Exception, | ||
// so they are less likely being dropped because of AttributeCountLimit. | ||
|
||
|
@@ -109,7 +113,7 @@ internal static OtlpLogs.LogRecord ToOtlpLog(this LogRecord logRecord, SdkLimitO | |
otlpLogRecord.AddStringAttribute(SemanticConventions.AttributeExceptionMessage, logRecord.Exception.Message, attributeValueLengthLimit, attributeCountLimit); | ||
otlpLogRecord.AddStringAttribute(SemanticConventions.AttributeExceptionStacktrace, logRecord.Exception.ToInvariantString(), attributeValueLengthLimit, attributeCountLimit); | ||
} | ||
|
||
#endif | ||
bool bodyPopulatedFromFormattedMessage = false; | ||
if (logRecord.FormattedMessage != null) | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Experimental features are enabled in following ways.
Features that require use of public APIs
Public APIs that are available on experimental basis will have a clear API documentation specifying that.
(Example would be great here)
Features that provide new functionality or changes the internal behavior without involvement of public APIs
Such features can be used by opting in via environment variables (e.g.,
OTEL_DOTNET_EXPERIMENTAL_SOME_FEATURE
)NOTE: Both the ways will only be available in pre-release versions of the libraries. Stable versions will not include the ability to opt-in into experimental features. Users opted in to use experimental features may face build time errors or runtime behavior change if they upgrade to stable version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After reviewing this again, I feel that we should have this clear demarcation of which kind of experimental features get offered in what ways. I agree with the above comment made by @vishweshbankwar that:
OTEL_DOTNET_EXPERIMENTAL_SOME_FEATURE
env vars (I would be opposed to offering them using the compiler attribute feature; I can talk more about my reasons if needed)I would like to update the note to allow for purely internal behavior changes to be allowed to be shipped as part of the stable release. These are opt-in experimental features. There's no good reason to exclude them from stable releases.
@alanwest To your concern of the attributes' discussion blocking progress, I'd be okay with commenting out the code in the OTLP Exporter for exporting the three attributes for now and address it after this PR is merged.