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

Support for OpenTelemetry Auto-Instrumentation #42

Open
justurbo opened this issue Jan 21, 2025 · 2 comments
Open

Support for OpenTelemetry Auto-Instrumentation #42

justurbo opened this issue Jan 21, 2025 · 2 comments

Comments

@justurbo
Copy link

✅ Using the OpenTelemetry.AutoInstrumentation package I expect to receive traces of Mongo queries.

❌ However, I do not see Mongo traces in the request trace.

Here's how I initialize Mongo Diagnostics:

private readonly MongoClient _client = new(
    new MongoClientSettings
    {
        ...
        ClusterConfigurator = clusterBuilder => clusterBuilder.Subscribe(
            new DiagnosticsActivityEventSubscriber(
                new InstrumentationOptions
                {
                    CaptureCommandText = true,
                    ShouldStartActivity = @event => !"collectionToIgnore".Equals(@event.GetCollectionName())
                }
            )
        )
    }
);

However, the OpenTelemetry traces of Mongo do not appear as a part of the request in the Grafana Tempo dashboard:

Image
@justurbo
Copy link
Author

@jbogard Am I missing a critical step of the setup which transforms Mongo diagnostics into traces consumable by OpenTelemetry? Thanks! 🙏

@jbogard
Copy link
Owner

jbogard commented Jan 22, 2025

Those diagnostic traces are ready to be consumed by OTel. But you need to explicitly turn them on in your collector though. Here's an Aspire example:

https://github.com/jbogard/nsb-diagnostics-poc/blob/master/ServiceDefaults/Extensions.cs#L67

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

No branches or pull requests

2 participants