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.

Mixing OpenTracing and automatic instrumentation

See original GitHub issue

I’m using 1.7 of the .NET stuff for .NET Core. I followed the example on how to add OpenTracing to my DI and sprinkled it thru my code. (https://docs.datadoghq.com/tracing/advanced/opentracing/?tab=net)

public static IServiceCollection AddTracer(this IServiceCollection services)
{
  ITracer tracer = OpenTracingTracerFactory.CreateTracer();
  GlobalTracer.Register(tracer);
  services.TryAddSingleton(tracer);
  return services;
 }
using (IScope scope = _tracer.BuildSpan(someSpan).StartActive())
{
 // logic
}

However, I’m not seeing the the custom traces/spans on the flame charts. I am seeing the automatically instrumented spans.

Is there a special sauce I’m missing? Does this require a certain version of the agent to be run?

(edit: formatting)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
zacharycmontoyacommented, Oct 17, 2019

Hi @daniel-white, we’ve just released version 1.8.0 of the tracer which adds a new API OpenTracingTracerFactory.WrapTracer (thank you @alexeyzimarev for the contribution!). Using this for your use-case should look like the following:

public static IServiceCollection AddTracer(this IServiceCollection services)
{
  ITracer tracer = OpenTracingTracerFactory.WrapTracer(Datadog.Trace.Tracer.Instance);
  GlobalTracer.Register(tracer);
  services.TryAddSingleton(tracer);
  return services;
}

Please let us know if you run into any other issues and feedback, as we’re looking to better support manual instrumentation and OpenTracing scenarios.

1reaction
alexeyzimarevcommented, Sep 25, 2019

@colin-higgins the issue is that the Datadog tracer is very limited. I cannot find any way to access the scope context and extract/inject it for distributed tracing. OpenTracing has it all. Without distributed tracing, the whole tracing idea is almost pointless.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Introduction to Instrumentation with OpenTracing and Jaeger
This will introduce you to the instrumentation of your application code for distributed tracing with OpenTracing and Jaeger.
Read more >
Instrumentation
Note, that for most languages it is possible to use both manual and automatic instrumentation at the same time: Automatic Instrumentation will ...
Read more >
Migrating from OpenTracing
To ease migration, OpenTelemetry supports the use of both the OpenTelemetry and OpenTracing APIs in the same codebase. This allows OpenTracing instrumentation ......
Read more >
Distributed Tracing, OpenTracing and Elastic APM
OpenTracing is the industry's first step towards standardization for distributed tracing. We still have a long way to go for full compatibility.
Read more >
OpenTracing vs OpenTelemetry
Further testing will happen mixing OpenTracing with OpenTelemetry instrumentation, making sure the entire pipe works smoothly.
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