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

redisotel does not write to Jaeger #2760

Open
Shadoka opened this issue Oct 16, 2023 · 2 comments
Open

redisotel does not write to Jaeger #2760

Shadoka opened this issue Oct 16, 2023 · 2 comments

Comments

@Shadoka
Copy link

Shadoka commented Oct 16, 2023

Expected Behavior

My application should send a trace to Jaeger.

Current Behavior

Nothing happens. No error in the log, no crash of the app, no trace in Jaeger.

Steps to Reproduce

var Client *redis.Client

func main() {
      connect()

      exp, err := newExporter(context.Background())
      if err != nil {
          logger.Errorf("error creating exporter")
      }

      tp := newTraceProvider(exp)
      tracingOption := redisotel.WithTracerProvider(tp)

      if err := redisotel.InstrumentTracing(Client, tracingOption); err != nil {
          logger.Errorf("error instrumenting redis client for tracing:\n%v", err)
     }

     Client.Set(context.TODO(), "key", "value", 0).Result()
}

func connect() error {
       Client = redis.NewClient(&redis.Options{
           PoolSize:     configs.ModuleConfig.Redis.PoolSize,
           MinIdleConns: configs.ModuleConfig.Redis.MinIdleConns,
           MaxRetries:   configs.ModuleConfig.Redis.MaxRetries,
           Addr:         configs.ModuleConfig.Redis.Hosts[0],
           Username:     configs.ModuleConfig.Redis.Credentials.Username,
           Password:     configs.ModuleConfig.Redis.Credentials.Password,
           DB:           configs.ModuleConfig.Redis.Database,
       })
}

func newExporter(ctx context.Context) (*otlptrace.Exporter, error) {
	client := otlptracehttp.NewClient(
		otlptracehttp.WithEndpoint("http:11.0.0.1:4318"),
		otlptracehttp.WithInsecure(),
	)
	return otlptrace.New(ctx, client)
}

func newTraceProvider(exp sdktrace.SpanExporter) *sdktrace.TracerProvider {
	r, err := resource.Merge(
		resource.Default(),
		resource.NewWithAttributes(
			semconv.SchemaURL,
			semconv.ServiceName("serviceName"),
		),
	)

	if err != nil {
		panic(err)
	}

	return sdktrace.NewTracerProvider(
		sdktrace.WithBatcher(exp),
		sdktrace.WithResource(r),
	)
}

Context (Environment)

The application is a small service running in Kubernetes with a standalone installation of Redis and Jaeger besides Kubernetes. The service is able to communicate with Redis and Jaeger, but the combination of both via redisotel does not work.

Detailed Description

Jaeger does not receive any traces from redis operations.

I can take the TraceProvider in the example, create a Tracer from it and send a trace to Jaeger with no problems, but it does not work with redisotel.

Both the configuration of the TraceProvider via redisotel.WithTracerProvider() and otel.SetTracerProvider() does not work.

@cmergenthaler
Copy link

cmergenthaler commented May 13, 2024

@Shadoka Have you found a solution for that? Seems like we're having the same issue when trying to export to otel-collector's grpc endpoint

Edit: I think it is related to #2980

@Shadoka
Copy link
Author

Shadoka commented May 17, 2024

@cmergenthaler No, I have not. I remember that I took a look at the sources, but it's been some time and I can't remember if I had found anything of value.

I'm currently working in a different project but I'll notify my colleagues that the issue might be fixed with the next version of go-redis. Thanks for the update!

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