diff --git a/ddtrace/tracer/option.go b/ddtrace/tracer/option.go index febe663488..74b6a8dd00 100644 --- a/ddtrace/tracer/option.go +++ b/ddtrace/tracer/option.go @@ -159,8 +159,14 @@ func WithPropagator(p Propagator) StartOption { } } -// WithServiceName sets the default service name to be used with the tracer. +// WithServiceName sets the default service name to be used with the tracer. It is +// deprecated in favour of WithService and will be removed in the next major version. func WithServiceName(name string) StartOption { + return WithService(name) +} + +// WithService sets the default service name to be used with the tracer. +func WithService(name string) StartOption { return func(c *config) { c.serviceName = name } diff --git a/profiler/example_test.go b/profiler/example_test.go index b75d013a98..a7c0a8ca98 100644 --- a/profiler/example_test.go +++ b/profiler/example_test.go @@ -15,7 +15,9 @@ import ( func Example() { err := profiler.Start( profiler.WithAPIKey("123key"), + profiler.WithService("users-db"), profiler.WithEnv("staging"), + profiler.WithTags("version:1.2.0"), ) if err != nil { log.Fatal(err) diff --git a/profiler/options.go b/profiler/options.go index 9e382c928d..c1e0c1f2a6 100644 --- a/profiler/options.go +++ b/profiler/options.go @@ -122,8 +122,8 @@ func WithProfileTypes(types ...ProfileType) Option { } } -// WithServiceName specifies the service name to attach a profile. -func WithServiceName(name string) Option { +// WithService specifies the service name to attach a profile. +func WithService(name string) Option { return func(cfg *config) { cfg.service = name } diff --git a/profiler/upload_test.go b/profiler/upload_test.go index 605db06d3a..2e0c4533a3 100644 --- a/profiler/upload_test.go +++ b/profiler/upload_test.go @@ -60,7 +60,7 @@ func TestTryUpload(t *testing.T) { defer func(old *http.Client) { httpClient = old }(httpClient) p := unstartedProfiler( WithURL(srv.URL+"/"), - WithServiceName("my-service"), + WithService("my-service"), WithEnv("my-env"), WithTags("tag1:1", "tag2:2"), )