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

contrib/go-redis/redis: With env and version #1102

Closed
xrn opened this issue Dec 21, 2021 · 4 comments
Closed

contrib/go-redis/redis: With env and version #1102

xrn opened this issue Dec 21, 2021 · 4 comments
Labels
ack apm:ecosystem contrib/* related feature requests or bugs

Comments

@xrn
Copy link

xrn commented Dec 21, 2021

Following: https://docs.datadoghq.com/getting_started/tagging/unified_service_tagging/?tab=logs

In redis tracer we can find

// WithServiceName sets the given service name for the client.
func WithServiceName(name string) ClientOption {
	return func(cfg *clientConfig) {
		cfg.serviceName = name
	}
}

But there is no option to set env and version which is required in my case

@gbbr
Copy link
Contributor

gbbr commented Jan 4, 2022

Environment and version are specific to the running application. You set these when starting the tracer using tracer.WithEnv and tracer.WithService. The Redis client will inherit these, which is correct given that client is part of the original application.

@xrn
Copy link
Author

xrn commented Jan 5, 2022

@gbbr I am trying to use it with my lambda but have there no tracer itself

import (
	"context"
	"encoding/json"
	"errors"

	ddlambda "github.com/DataDog/datadog-lambda-go"
	golambda "github.com/aws/aws-lambda-go/lambda"
)

func (d *deps) lambdaHandler(ctx context.Context) error {
...

type deps struct {
	ElastiCache      redis.UniversalClient
}

func main() {
	d := deps{
		ElastiCache: redistrace.NewClient(
			&redis.Options{
				Addr: os.Getenv("elastiCacheUrl"),
			},
			redistrace.WithServiceName("ElastiCache"),
			redistrace.WithAnalytics(true),
		),
	}

       config = &ddlambda.Config{
		DDTraceEnabled:        true,
		MergeXrayTraces:       true,
		ShouldUseLogForwarder: true,
	}

        golambda.Start(ddlambda.WrapHandler(d.lambdaHandler, config))
}

Any Idea how to add env and version to redistracer?

@gbbr
Copy link
Contributor

gbbr commented Jan 5, 2022

I see. This repository is dd-trace-go. Can you please close this issue and open it in datadog-lambda-go? They should likely add the ability for you to set service, env, and version when starting (ddlambda.WrapHandler). However, this is just an assumed solution since I am not familiar with that project. Perhaps they should be made part of ddlambda.Config.

@knusbaum knusbaum added the ack label Jan 14, 2022
@katiehockman katiehockman added the apm:ecosystem contrib/* related feature requests or bugs label Jan 11, 2023
@zarirhamza
Copy link
Contributor

Closed due to resolution in other issue but feel free to create a new issue in the future if the problem persists or reach out to support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ack apm:ecosystem contrib/* related feature requests or bugs
Projects
None yet
Development

No branches or pull requests

5 participants