question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[QUERY] Distributed Tracing in EventHub - example?

See original GitHub issue

Query/Question Now that EventHub supports distributed tracing and submits the Diagnostics-id in a similar way to what Service Bus already did, do you have a corresponding example how to use that ID in the processor? This show it for Service Bus messages: https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-end-to-end-tracing#trace-message-processing

private readonly TelemetryClient telemetryClient;

async Task ProcessAsync(Message message)
{
    var activity = message.ExtractActivity();
    
    // If you are using Microsoft.ApplicationInsights package version 2.6-beta or higher, you should call StartOperation<RequestTelemetry>(activity) instead
    using (var operation = telemetryClient.StartOperation<RequestTelemetry>("Process", activity.RootId, activity.ParentId))
    {
        telemetryClient.TrackTrace("Received message");
        try 
        {
           // process message
        }
        catch (Exception ex)
        {
             telemetryClient.TrackException(ex);
             operation.Telemetry.Success = false;
             throw;
        }

        telemetryClient.TrackTrace("Done");
   }
}

Environment:

  • Name and version of the Library package used:
    • Azure.Messaging.EventHubs.Processor 5.2.0-preview.1
    • Microsoft.ApplicationInsights 2.15.0-beta2
  • Hosting platform or OS and .NET runtime version (dotnet --info output for .NET Core projects): [e.g. Azure AppService or Windows 10 .NET Framework 4.8] .NET Core 3.1

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
pakrymcommented, Mar 17, 2021

hey @pakrym @jsquire – any update for guidance here? The docs for service bus look good, but there’s nothing equivalent for event hubs (though I imagine they would be very, very similar?)(system.diagnostics.diagnosticsource >=5.0)

Sorry, this takes a while. We are working on OpenTelemetry instrumentation story across all our libraries tat would include the extraction part. I don’t have exact ETA for it because OT messaging spec is still in preview.

Also @sebader is using new Activity(“…”) whereas for the new OTEL compatible APIs, we’re meant to set a static ActivitySource – is his approach compatible with otel instrumentation in net5?

No, the approach in sebader’s comment explicitly uses AppInsights. You are correct that to get OpenTelemetry integration you would have to use ActivitySource to start the activity.

Will the http/w3c trace context automatically be added to the message propertybag?

Yes.

1reaction
jsquirecommented, Jul 2, 2021

Hi @sebader. To be transparent, I’m not sure what the best path would be to help get you an authoritative answer to this. We may need to ask a couple of folks for help before finding the right person. Please bear with us.

Diagnostics for the new generation of Azure SDKs are intended to be a consistent and drive from a common initiative around OpenTelemetry. Since a good deal of the efforts here were coordinated through Azure.Core, I’m going to start by asking @pakrym for his thoughts or help routing to someone better able to assist.

In the meantime, I wanted to call your attention to the Distributed tracing section of the Azure.Core diagnostics sample. The Application Insights and OpenTelemetry resources linked there may help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Observability for Event Stream Processing with Azure ...
The biggest takeaway for us is that Azure Event Hubs works well with Azure Functions in terms of distributed tracing. With distributed tracing...
Read more >
App Insights query for Service Bus
Once the Service Bus published the message and has logged tracing events, logs in Application Insights can be queried using the Kusto query...
Read more >
Query distributed trace data
You can query your distributed tracing data in several ways: The search bar at top of the distributed tracing UI; NRQL query; NerdGraph...
Read more >
Distributed Tracing
New! Enjoy distributed tracing using our updated Tracing function. Optimize performance, troubleshoot bottlenecks, monitor latency, and link ...
Read more >
Azure Event Hubs integration | Grafana Cloud documentation
Under “Destination details”, select “Stream to an event hub” as the destination and choose the appropriate options. Configure any advanced settings if needed....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found