ext - ActiveState ActiveGo 1.8

Package ext

import "github.com/opentracing/opentracing-go/ext"

Overview ▾


These constants define common tag names recommended for better portability across tracing systems and languages/platforms.

The tag names are defined as typed strings, so that in addition to the usual use

span.setTag(TagName, value)

they also support value type validation via this additional syntax:

TagName.Set(span, value)
var (

    // SpanKind hints at relationship between spans, e.g. client/server
    SpanKind = spanKindTagName("span.kind")

    // SpanKindRPCClient marks a span representing the client-side of an RPC
    // or other remote call
    SpanKindRPCClientEnum = SpanKindEnum("client")
    SpanKindRPCClient     = opentracing.Tag{Key: string(SpanKind), Value: SpanKindRPCClientEnum}

    // SpanKindRPCServer marks a span representing the server-side of an RPC
    // or other remote call
    SpanKindRPCServerEnum = SpanKindEnum("server")
    SpanKindRPCServer     = opentracing.Tag{Key: string(SpanKind), Value: SpanKindRPCServerEnum}

    // SpanKindProducer marks a span representing the producer-side of a
    // message bus
    SpanKindProducerEnum = SpanKindEnum("producer")
    SpanKindProducer     = opentracing.Tag{Key: string(SpanKind), Value: SpanKindProducerEnum}

    // SpanKindConsumer marks a span representing the consumer-side of a
    // message bus
    SpanKindConsumerEnum = SpanKindEnum("consumer")
    SpanKindConsumer     = opentracing.Tag{Key: string(SpanKind), Value: SpanKindConsumerEnum}

    // Component is a low-cardinality identifier of the module, library,
    // or package that is generating a span.
    Component = stringTagName("component")

    // SamplingPriority determines the priority of sampling this Span.
    SamplingPriority = uint16TagName("sampling.priority")

    // PeerService records the service name of the peer.
    PeerService = stringTagName("peer.service")

    // PeerAddress records the address name of the peer. This may be a "ip:port",
    // a bare "hostname", a FQDN or even a database DSN substring
    // like "mysql://username@"
    PeerAddress = stringTagName("peer.address")

    // PeerHostname records the host name of the peer
    PeerHostname = stringTagName("peer.hostname")

    // PeerHostIPv4 records IP v4 host address of the peer
    PeerHostIPv4 = uint32TagName("peer.ipv4")

    // PeerHostIPv6 records IP v6 host address of the peer
    PeerHostIPv6 = stringTagName("peer.ipv6")

    // PeerPort records port number of the peer
    PeerPort = uint16TagName("peer.port")

    // HTTPUrl should be the URL of the request being handled in this segment
    // of the trace, in standard URI format. The protocol is optional.
    HTTPUrl = stringTagName("http.url")

    // HTTPMethod is the HTTP method of the request, and is case-insensitive.
    HTTPMethod = stringTagName("http.method")

    // HTTPStatusCode is the numeric HTTP status code (200, 404, etc) of the
    // HTTP response.
    HTTPStatusCode = uint16TagName("http.status_code")

    // DBInstance is database instance name.
    DBInstance = stringTagName("db.instance")

    // DBStatement is a database statement for the given database type.
    // It can be a query or a prepared statement (i.e., before substitution).
    DBStatement = stringTagName("db.statement")

    // DBType is a database type. For any SQL database, "sql".
    // For others, the lower-case database category, e.g. "redis"
    DBType = stringTagName("db.type")

    // DBUser is a username for accessing database.
    DBUser = stringTagName("db.user")

    // MessageBusDestination is an address at which messages can be exchanged
    MessageBusDestination = stringTagName("message_bus.destination")

    // Error indicates that operation represented by the span resulted in an error.
    Error = boolTagName("error")

func RPCServerOption

func RPCServerOption(client opentracing.SpanContext) opentracing.StartSpanOption

RPCServerOption returns a StartSpanOption appropriate for an RPC server span with `client` representing the metadata for the remote peer Span if available. In case client == nil, due to the client not being instrumented, this RPC server span will be a root span.

type SpanKindEnum

SpanKindEnum represents common span types

type SpanKindEnum string