jaegertracing / jaeger-client-csharp

šŸ›‘ This library is DEPRECATED!
https://jaegertracing.io/
Apache License 2.0
302 stars 67 forks source link

Tracings not registered after upgrading to version 0.4.0 #185

Closed silvairsoares closed 4 years ago

silvairsoares commented 4 years ago

Previously, using version "0.3.7", I was able to see the properly logged logs with the following structure:

1 - Class with extension method to configure OpenTracing:

public static class DistributedTracing
{        
    public static void ConfigureOpenTracing(this IServiceCollection services, IConfiguration configuration)
    {
        services.AddSingleton<ITracer>(serviceProvider =>
        {
            ILoggerFactory loggerFactory = serviceProvider.GetRequiredService<ILoggerFactory>();

            // Configured from the "appsettings.json" file
            var tracer = Configuration
                .FromIConfiguration(loggerFactory, configuration.GetSection("Jaeger"))
                .GetTracer();

            GlobalTracer.Register(tracer);

            return tracer;
        });

        services.AddOpenTracing();
    }        
}

2 - Call to the configuration method in "startup.cs":

...
public void ConfigureServices(IServiceCollection services)
    {
        // Setup OpenTracing
        services.ConfigureOpenTracing(Configuration);
        ...
    }

3 - Jaeger's configuration in the "appsettings.json" file: ... "Jaeger": { "JAEGER_SERVICE_NAME": "Project_Name", "JAEGER_AGENT_HOST": "192.168.1.202", "JAEGER_AGENT_PORT": "6831", "JAEGER_SAMPLER_TYPE": "const", "JAEGER_SAMPLER_PARAM": "1" } ...

After upgrading to version 0.4.0, although I don't see any error messages, or exceptions, the logs are no longer logged in the Jaeger API. I returned to version "0.3.7" and returned to working normally.

Falco20019 commented 4 years ago

Thanks for reporting. I will give it a look ASAP and if reproducible try to release a 0.4.1 fixing it. 0.4.0 had some big changes and Iā€˜m sorry if there was something breaking.

silvairsoares commented 4 years ago

Thanks for the quick return. If you need any more details to help reproduce the problem, Iā€™m available here.

GureevLeonid commented 4 years ago

@silvairsoares

I think that breaking change was the splitting nuget packages, so ThriftSenderFactory is not enabled by default now. And you need to add this line of code before creating tracer:

Configuration.SenderConfiguration.DefaultSenderResolver = new SenderResolver(loggerFactory)
                        .RegisterSenderFactory<ThriftSenderFactory>();

As it said there https://github.com/jaegertracing/jaeger-client-csharp/blob/master/src/Jaeger.Core/Senders/README.md

By default, Configuration.SenderConfiguration.DefaultSenderResolver does NOT contain any ISenderFactory instances since Jaeger.Core is agnostic of any ISender implementation. All calls to SenderResolver.Resolve will return NoopSender.Instance.

silvairsoares commented 4 years ago

Thank you very much @GureevLeonid! The addition of the line you suggested, solved my problem.

Falco20019 commented 4 years ago

There should be a warning shown: ā€ž No suitable sender found. Using NoopSender, meaning that data will not be sent anywhere!ā€œ

If not, this would be a bug. Of course, this only works if the logger factory was set up (which it should have been according to your excerpt).

Thanks @GureevLeonid for helping out. I sadly had no time this week.