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

[WIP] Using ILogger instead of EventSource for logging OpenTelemetry Events in OTLP exporter #5879

Closed
wants to merge 3 commits into from

Conversation

Yun-Ting
Copy link
Contributor

@Yun-Ting Yun-Ting commented Oct 2, 2024

Towards #3881

Changes

Currently internal logging with ILogger is default on.
Need to find a way to have the internal diagnostics off by default and a switch to turn the diagnostics on.

Merge requirement checklist

  • CONTRIBUTING guidelines followed (license requirements, nullable enabled, static analysis, etc.)
  • Unit tests added/updated
  • Appropriate CHANGELOG.md files updated for non-trivial changes
  • Changes in public API reviewed (if applicable)

@github-actions github-actions bot added documentation Documentation related pkg:OpenTelemetry.Exporter.OpenTelemetryProtocol Issues related to OpenTelemetry.Exporter.OpenTelemetryProtocol NuGet package labels Oct 2, 2024
@@ -73,12 +73,6 @@ public void CouldNotTranslateMetric(string className, string methodName)
this.WriteEvent(5, className, methodName);
}

[Event(8, Message = "Unsupported value for protocol '{0}' is configured, default protocol 'grpc' will be used.", Level = EventLevel.Warning)]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change is not related to logging migration. Removed because this method was not referenced.

{
// TODO: there's no concept of Event vs NonEvent in ILogger (as opposed to EventSource.)
// Need to find a way to log "NonEvent" in ILogger to avoid the below situation:
// When the Exception occurred in ExportMethod, the Export event got written to the pipe, and thus the Exporter keeps exporting.
Copy link
Member

Choose a reason for hiding this comment

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

SupressInstrumentationScope should be preventing infinite loop already.. is that what you are referring to there?
export() -> ilooger.log(exception) -> gets-back-to-export export() -> ilogger.log(exception) -- this infinite cycle?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the above call sequence is what I'm referring to. Let me see how SuppressInstrumentationScope can prevent this from happening. Thanks!

@@ -29,7 +29,8 @@
appBuilder.Services.AddSingleton<Instrumentation>();

// Clear default logging providers used by WebApplication host.
Copy link

Choose a reason for hiding this comment

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

Its not clear to me how the change in the example app relates to the remainder of the PR?
Is this just for your local testing and should be ignored?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The change in the example app is just for local testing purposes while I'm working on the integration tests for this.

Debug.Assert(exporterOptions != null, "exporterOptions was null");
Debug.Assert(sdkLimitOptions != null, "sdkLimitOptions was null");
Debug.Assert(experimentalOptions != null, "experimentalOptions was null");

this.openTelemetryEventLogger = openTelemetryEventLogger!;

this.openTelemetryEventLogger.LogDebug("Hello from Otlp ctor");
Copy link

Choose a reason for hiding this comment

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

Are these for your own debugging and going to come out? If not you might want to adjust the messages, for example "Entering OtlpLogExporter constructor".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, .LogDebug() is for debugging purposes and will be removed in the upcoming iterations.

Copy link
Contributor

This PR was marked stale due to lack of activity and will be closed in 7 days. Commenting or pushing will instruct the bot to automatically remove the label. This bot runs once per day.

@github-actions github-actions bot added the Stale Issues and pull requests which have been flagged for closing due to inactivity label Oct 12, 2024
@Yun-Ting Yun-Ting closed this Oct 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Documentation related pkg:OpenTelemetry.Exporter.OpenTelemetryProtocol Issues related to OpenTelemetry.Exporter.OpenTelemetryProtocol NuGet package Stale Issues and pull requests which have been flagged for closing due to inactivity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants