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

Telemetry: update enablement (experimental source instead of app context switch) and docs improvements #187

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

lmolkova
Copy link
Contributor

@lmolkova lmolkova commented Aug 26, 2024

Based on the discussion in dotnet/aspire#5451, suggesting a new way to onboard:

  • ActivitySource and Meter names start with Experimental.* which make their status obvious
  • App context switch is removed

This PR also adds docs on how to view telemetry

@lmolkova lmolkova changed the title Add OTel example and docs on how to view telemetry Telemetry: update enablement (experimental source instead of app context switch) and docs improvements Sep 7, 2024
@lmolkova lmolkova force-pushed the add-how-to-view-telemetry-and-example branch from 051a5ba to f54b752 Compare September 7, 2024 01:30
docs/observability.md Outdated Show resolved Hide resolved
docs/observability.md Outdated Show resolved Hide resolved
var source = new OpenTelemetrySource(RequestModel, new Uri(Endpoint));

using var activityListener = new TestActivityListener("OpenAI.ChatClient");
using var meterListener = new TestMeterListener("OpenAI.ChatClient");
using var activityListener = new TestActivityListener("Experimental.OpenAI.ChatClient");

Choose a reason for hiding this comment

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

I wish everyone uses OTel's InMemoryExporter rather than writing own listeners, but it is upto the owners of this project!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

can you explain why?

Choose a reason for hiding this comment

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

Listeners are not extensively documented given its generally only used by small set of people like people authoring OpenTelemetry SDK etc.
OTOH, InMemoryExporter is documented, and is intended to be used by end-users to validate their own instrumentation. Changing from InMemoryExporter to anything else like Console/OTLP is often the one-line change. End-users, who are familiar with OTLP Exporter find it easy to use InMemoryExporter with OTel for testing, as opposed to learning ActivityListener/MeterListener etc.

Just a suggestion only.

Copy link

@cijothomas cijothomas left a comment

Choose a reason for hiding this comment

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

LGTM!

@lmolkova lmolkova force-pushed the add-how-to-view-telemetry-and-example branch from f54b752 to 97f7cd4 Compare October 1, 2024 19:50

using MeterProvider meterProvider = OpenTelemetry.Sdk.CreateMeterProviderBuilder()
.SetResourceBuilder(resourceBuilder)
.AddView("gen_ai.client.operation.duration", new ExplicitBucketHistogramConfiguration { Boundaries = [0.01, 0.02, 0.04, 0.08, 0.16, 0.32, 0.64, 1.28, 2.56, 5.12, 10.24, 20.48, 40.96, 81.92] })

Choose a reason for hiding this comment

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

https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/src/OpenTelemetry/CHANGELOG.md#1100-beta1 added support for Hints, so Views maybe replaced with the hint API itself.
(Assuming this can take a dependency on preview DS,OTel nugets)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants