Jaeger 错误找不到合适的发件人。使用 NoopSender
Jaeger error No suitable sender found. Using NoopSender
我正在使用以下 OpenTracing 示例,Jaeger
https://github.com/yurishkuro/opentracing-tutorial/tree/master/csharp/src/lesson01
我有我的 Jaeger UI 运行,我使用了以下命令。
docker run -d --name jaeger -e COLLECTOR_ZIPKIN_HTTP_PORT=9411 -p 5775:5775/udp -p 6831:6831/udp -p 6832:6832/udp -p 5778:5778-p 16686:16686 -p 14268:14268 -p 9411:9411 jaegertracing/all-in-one:latest
下面是我从上面尝试的代码 github link
using Microsoft.Extensions.Logging;
using System;
using Jaeger.Metrics;
using Jaeger.Reporters;
using Jaeger.Samplers;
using Jaeger.Senders.Thrift;
using Jaeger;
using OpenTracing;
using OpenTracing.Util;
namespace Jaeger_Class_Library
{
public class Hello
{
private readonly ITracer _tracer;
private readonly ILogger<Hello> _logger;
public Hello()
{
}
public Hello(OpenTracing.ITracer tracer, ILoggerFactory loggerFactory)
{
_tracer = tracer;
_logger = loggerFactory.CreateLogger<Hello>();
}
public void SayHello(string helloTo)
{
var span = _tracer.BuildSpan("say-hello").Start();
var helloString = $"Hello, {helloTo}!";
_logger.LogInformation(helloString);
span.Finish();
}
private static Tracer InitTracer(string serviceName, ILoggerFactory loggerFactory)
{
var samplerConfiguration = new Configuration.SamplerConfiguration(loggerFactory)
.WithType(ConstSampler.Type);
//.WithParam(1);
var reporterConfiguration = new Configuration.ReporterConfiguration(loggerFactory)
.WithLogSpans(true);
return (Tracer)new Configuration(serviceName, loggerFactory)
.WithSampler(samplerConfiguration)
.WithReporter(reporterConfiguration)
.GetTracer();
}
public void TriggerTrace()
{
using (var loggerFactory = new LoggerFactory().AddConsole())
{
var helloTo = "Test message to Trace";
using (var tracer = InitTracer("hello-world", loggerFactory))
{
new Hello(tracer, loggerFactory).SayHello(helloTo);
}
}
}
}
}
以上是 Class 库项目。
下面是我调用 TriggerTrace 方法的控制台应用程序。执行该函数时,我希望 Jaeger UI、
中有一些痕迹
static void Main(string[] args)
{
Hello hello = new Hello();
hello.TriggerTrace();
Console.WriteLine("Tracing...");
}
下面是我看到的错误,我在UI中没有看到任何痕迹,
我是否缺少任何配置?
warn: Jaeger.Senders.SenderResolver[0]
**No suitable sender found. Using NoopSender, meaning that data will not be sent anywhere!**
info: Jaeger.Configuration[0]
Initialized Tracer(ServiceName=hello-world, Version=CSharp-0.4.2.0, Reporter=CompositeReporter(Reporters=RemoteReporter(Sender=NoopSender()), LoggingReporter(Logger=Microsoft.Extensions.Logging.Logger`1[Jaeger.Reporters.LoggingReporter])), Sampler=ConstSampler(True), IPv4=172425085, Tags=[jaeger.version, CSharp-0.4.2.0], [hostname, RRUPAKULA-LAP], [ip, 10.70.255.125], ZipkinSharedRpcSpan=False, ExpandExceptionLogs=False, UseTraceId128Bit=False)
info: Jaeger_Class_Library.Hello[0]
Hello, Test message to Trace!
info: Jaeger.Reporters.LoggingReporter[0]
Span reported: cc9fa176171a0dab:cc9fa176171a0dab:0000000000000000:1 - say-hello
Tracing...
我遇到了同样的问题。找到了解释如何配置 Thrift 发件人的页面:https://github.com/jaegertracing/jaeger-client-csharp/blob/master/src/Senders/Jaeger.Senders.Thrift/README.md
虽然 C# 教程没有提到它...
这是我的 InitTracer()。从二进制启动的 Jaeger 工作正常:
private static Tracer InitTracer(string serviceName, ILoggerFactory loggerFactory)
{
Configuration.SenderConfiguration.DefaultSenderResolver = new SenderResolver(loggerFactory)
.RegisterSenderFactory<ThriftSenderFactory>();
var samplerConfiguration = new Configuration.SamplerConfiguration(loggerFactory)
.WithType(ConstSampler.Type)
.WithParam(1);
var sender = new SenderConfiguration(loggerFactory);
var reporterConfiguration = new Configuration.ReporterConfiguration(loggerFactory)
.WithLogSpans(true)
.WithSender(sender);
return (Tracer)new Configuration(serviceName, loggerFactory)
.WithSampler(samplerConfiguration)
.WithReporter(reporterConfiguration)
.GetTracer();
}
我正在使用以下 OpenTracing 示例,Jaeger https://github.com/yurishkuro/opentracing-tutorial/tree/master/csharp/src/lesson01
我有我的 Jaeger UI 运行,我使用了以下命令。
docker run -d --name jaeger -e COLLECTOR_ZIPKIN_HTTP_PORT=9411 -p 5775:5775/udp -p 6831:6831/udp -p 6832:6832/udp -p 5778:5778-p 16686:16686 -p 14268:14268 -p 9411:9411 jaegertracing/all-in-one:latest
下面是我从上面尝试的代码 github link
using Microsoft.Extensions.Logging;
using System;
using Jaeger.Metrics;
using Jaeger.Reporters;
using Jaeger.Samplers;
using Jaeger.Senders.Thrift;
using Jaeger;
using OpenTracing;
using OpenTracing.Util;
namespace Jaeger_Class_Library
{
public class Hello
{
private readonly ITracer _tracer;
private readonly ILogger<Hello> _logger;
public Hello()
{
}
public Hello(OpenTracing.ITracer tracer, ILoggerFactory loggerFactory)
{
_tracer = tracer;
_logger = loggerFactory.CreateLogger<Hello>();
}
public void SayHello(string helloTo)
{
var span = _tracer.BuildSpan("say-hello").Start();
var helloString = $"Hello, {helloTo}!";
_logger.LogInformation(helloString);
span.Finish();
}
private static Tracer InitTracer(string serviceName, ILoggerFactory loggerFactory)
{
var samplerConfiguration = new Configuration.SamplerConfiguration(loggerFactory)
.WithType(ConstSampler.Type);
//.WithParam(1);
var reporterConfiguration = new Configuration.ReporterConfiguration(loggerFactory)
.WithLogSpans(true);
return (Tracer)new Configuration(serviceName, loggerFactory)
.WithSampler(samplerConfiguration)
.WithReporter(reporterConfiguration)
.GetTracer();
}
public void TriggerTrace()
{
using (var loggerFactory = new LoggerFactory().AddConsole())
{
var helloTo = "Test message to Trace";
using (var tracer = InitTracer("hello-world", loggerFactory))
{
new Hello(tracer, loggerFactory).SayHello(helloTo);
}
}
}
}
}
以上是 Class 库项目。 下面是我调用 TriggerTrace 方法的控制台应用程序。执行该函数时,我希望 Jaeger UI、
中有一些痕迹static void Main(string[] args)
{
Hello hello = new Hello();
hello.TriggerTrace();
Console.WriteLine("Tracing...");
}
下面是我看到的错误,我在UI中没有看到任何痕迹, 我是否缺少任何配置?
warn: Jaeger.Senders.SenderResolver[0]
**No suitable sender found. Using NoopSender, meaning that data will not be sent anywhere!**
info: Jaeger.Configuration[0]
Initialized Tracer(ServiceName=hello-world, Version=CSharp-0.4.2.0, Reporter=CompositeReporter(Reporters=RemoteReporter(Sender=NoopSender()), LoggingReporter(Logger=Microsoft.Extensions.Logging.Logger`1[Jaeger.Reporters.LoggingReporter])), Sampler=ConstSampler(True), IPv4=172425085, Tags=[jaeger.version, CSharp-0.4.2.0], [hostname, RRUPAKULA-LAP], [ip, 10.70.255.125], ZipkinSharedRpcSpan=False, ExpandExceptionLogs=False, UseTraceId128Bit=False)
info: Jaeger_Class_Library.Hello[0]
Hello, Test message to Trace!
info: Jaeger.Reporters.LoggingReporter[0]
Span reported: cc9fa176171a0dab:cc9fa176171a0dab:0000000000000000:1 - say-hello
Tracing...
我遇到了同样的问题。找到了解释如何配置 Thrift 发件人的页面:https://github.com/jaegertracing/jaeger-client-csharp/blob/master/src/Senders/Jaeger.Senders.Thrift/README.md
虽然 C# 教程没有提到它...
这是我的 InitTracer()。从二进制启动的 Jaeger 工作正常:
private static Tracer InitTracer(string serviceName, ILoggerFactory loggerFactory)
{
Configuration.SenderConfiguration.DefaultSenderResolver = new SenderResolver(loggerFactory)
.RegisterSenderFactory<ThriftSenderFactory>();
var samplerConfiguration = new Configuration.SamplerConfiguration(loggerFactory)
.WithType(ConstSampler.Type)
.WithParam(1);
var sender = new SenderConfiguration(loggerFactory);
var reporterConfiguration = new Configuration.ReporterConfiguration(loggerFactory)
.WithLogSpans(true)
.WithSender(sender);
return (Tracer)new Configuration(serviceName, loggerFactory)
.WithSampler(samplerConfiguration)
.WithReporter(reporterConfiguration)
.GetTracer();
}