option.go 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. // Unless explicitly stated otherwise all files in this repository are licensed
  2. // under the Apache License Version 2.0.
  3. // This product includes software developed at Datadog (https://www.datadoghq.com/).
  4. // Copyright 2016 Datadog, Inc.
  5. package opentracer // import "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/opentracer"
  6. import (
  7. "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext"
  8. opentracing "github.com/opentracing/opentracing-go"
  9. )
  10. // ServiceName can be used with opentracing.StartSpan to set the
  11. // service name of a span.
  12. func ServiceName(name string) opentracing.StartSpanOption {
  13. return opentracing.Tag{Key: ext.ServiceName, Value: name}
  14. }
  15. // ResourceName can be used with opentracing.StartSpan to set the
  16. // resource name of a span.
  17. func ResourceName(name string) opentracing.StartSpanOption {
  18. return opentracing.Tag{Key: ext.ResourceName, Value: name}
  19. }
  20. // SpanName sets the Datadog operation name for the span.
  21. func SpanName(name string) opentracing.StartSpanOption {
  22. return opentracing.Tag{Key: ext.SpanName, Value: name}
  23. }
  24. // SpanType can be used with opentracing.StartSpan to set the type of a span.
  25. func SpanType(name string) opentracing.StartSpanOption {
  26. return opentracing.Tag{Key: ext.SpanType, Value: name}
  27. }