github.com/blend/go-sdk@v1.20220411.3/tracing/constants.go (about)

     1  /*
     2  
     3  Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved
     4  Use of this source code is governed by a MIT license that can be found in the LICENSE file.
     5  
     6  */
     7  
     8  package tracing
     9  
    10  // These constants are mostly lifted from the datadog/tracing/ext tag values.
    11  const (
    12  	// TagKeyEnvironment is the environment (web, dev, etc.)
    13  	TagKeyEnvironment = "env"
    14  	// TagKeySpanType defines the Span type (web, db, cache).
    15  	TagKeySpanType = "span.type"
    16  	// TagKeyServiceName defines the Service name for this Span.
    17  	TagKeyServiceName = "service.name"
    18  	// TagKeyResourceName defines the Resource name for the Span.
    19  	TagKeyResourceName = "resource.name"
    20  	// TagKeyPID is the pid of the traced process.
    21  	TagKeyPID = "system.pid"
    22  	// TagKeyError is the error tag key. It is usually of type `error`.
    23  	TagKeyError = "error"
    24  	// TagKeyErrorType is the error type tag key. It is usually of type `error`.
    25  	TagKeyErrorType = "error.type"
    26  	// TagKeyErrorMessage is the error message tag key.
    27  	TagKeyErrorMessage = "error.message"
    28  	// TagKeyErrorStack is the error stack tag key.
    29  	TagKeyErrorStack = "error.stack"
    30  	// TagKeyErrorDetails is the error details tag key.
    31  	TagKeyErrorDetails = "error.details"
    32  	// TagKeyHTTPMethod is the verb on the request.
    33  	TagKeyHTTPMethod = "http.method"
    34  	// TagKeyHTTPCode is the result status code.
    35  	TagKeyHTTPCode = "http.status_code"
    36  	// TagKeyHTTPURL is the url of the request (typically the raw path).
    37  	TagKeyHTTPURL = "http.url"
    38  	// TagKeyDBApplication is the application that uses a database.
    39  	TagKeyDBApplication = "db.application"
    40  	// TagKeyDBName is the database name.
    41  	TagKeyDBName = "db.name"
    42  	// TagKeyDBRowsAffected is the number of rows affected.
    43  	TagKeyDBRowsAffected = "db.rows_affected"
    44  	// TagKeyDBUser is the user on the database connection.
    45  	TagKeyDBUser = "db.user"
    46  	// TagKeyJobName is the job name.
    47  	TagKeyJobName = "job.name"
    48  	// TagKeyGRPCRemoteAddr is the grpc remote addr (i.e. the remote addr).
    49  	TagKeyGRPCRemoteAddr = "grpc.remote_addr"
    50  	// TagKeyGRPCRole is the grpc role (i.e. client or server).
    51  	TagKeyGRPCRole = "grpc.role"
    52  	// TagKeyGRPCCallingConvention is the grpc calling convention (i.e. unary or streaming).
    53  	TagKeyGRPCCallingConvention = "grpc.calling_convention"
    54  	// TagKeyGRPCMethod is the grpc method.
    55  	TagKeyGRPCMethod = "grpc.method"
    56  	// TagKeyGRPCCode is the grpc result code.
    57  	TagKeyGRPCCode = "grpc.code"
    58  	// TagKeyGRPCAuthority is the grpc authority.
    59  	TagKeyGRPCAuthority = "grpc.authority"
    60  	// TagKeyGRPCUserAgent is the grpc user-agent.
    61  	TagKeyGRPCUserAgent = "grpc.user_agent"
    62  	// TagKeyGRPCContentType is the grpc content type.
    63  	TagKeyGRPCContentType = "grpc.content_type"
    64  	// TagSecretsOperation is the operation being performed in the secrets API
    65  	TagSecretsOperation = "secrets.operation"
    66  	// TagSecretsMethod is the http method being hit on the vault API
    67  	TagSecretKey = "secrets.key"
    68  	// TagKeyOAuthUsername defines the oauth Username name for the Span.
    69  	TagKeyOAuthUsername = "oauth.username"
    70  	// TagKeyKafkaTopic is the kafka topic.
    71  	TagKeyKafkaTopic = "kafka.topic"
    72  	// TagKeyKafkaPartition is the kafka topic partition.
    73  	TagKeyKafkaPartition = "kafka.partition"
    74  	// TagKeyKafkaOffset is the kafka topic partition offset.
    75  	TagKeyKafkaOffset = "kafka.offset"
    76  	// TagKeyMeaured indicates a span should also emit metrics.
    77  	TagKeyMeasured = "_dd.measured"
    78  
    79  	// TagKeyTargetHost sets the target host address.
    80  	TagKeyTargetHost = "out.host"
    81  	// TagKeyTargetPort sets the target host port.
    82  	TagKeyTargetPort = "out.port"
    83  )
    84  
    85  // Operations are actions represented by spans.
    86  const (
    87  	OperationHTTPRouteLookup = "http.route_lookup"
    88  	// OperationHTTPRequest is the http request tracing operation name.
    89  	OperationHTTPRequest = "http.request"
    90  	// OperationHTTPRender is the operation name for rendering a server side view.
    91  	OperationHTTPRender = "http.render"
    92  	// OperationDBPing is the db ping tracing operation.
    93  	OperationSQLPing = "sql.ping"
    94  	// OperationDBPrepare is the db prepare tracing operation.
    95  	OperationSQLPrepare = "sql.prepare"
    96  	// OperationDBQuery is the db query tracing operation.
    97  	OperationSQLQuery = "sql.query"
    98  	// OperationJob is a job operation.
    99  	OperationJob = "job"
   100  	// OperationDial is a network jdial operation.
   101  	OperationDial = "dial"
   102  	// OperationGRPCClientUnary is an rpc operation.
   103  	OperationGRPCClientUnary = "grpc.client.unary"
   104  	// OperationGRPCClientStreaming is an rpc operation.
   105  	OperationGRPCClientStream = "grpc.client.stream"
   106  	// OperationGRPCClientUnary is an rpc operation.
   107  	OperationGRPCServerUnary = "grpc.server.unary"
   108  	// OperationGRPCServerStreaming is an rpc operation.
   109  	OperationGRPCServerStream = "grpc.server.stream"
   110  	// OperationVaultAPI is a call to the vault API
   111  	OperationVaultAPI = "vault.api.request"
   112  	// OperationKafkaPublish is a publish to a kafka topic.
   113  	OperationKafkaPublish = "kafka.publish"
   114  	// OperationRedisCommand is a redis operation.
   115  	OperationRedisCommand = "redis.command"
   116  )
   117  
   118  // Span types have similar behavior to "app types" and help categorize
   119  // traces in the Datadog application. They can also help fine grain agent
   120  // level bahviours such as obfuscation and quantization, when these are
   121  // enabled in the agent's configuration.
   122  const (
   123  	// SpanTypeWeb marks a span as an HTTP server request.
   124  	SpanTypeWeb = "web"
   125  	// SpanTypeHTTP marks a span as an HTTP client request.
   126  	SpanTypeHTTP = "http"
   127  	// SpanTypeSQL marks a span as an SQL operation. These spans may
   128  	// have an "sql.command" tag.
   129  	SpanTypeSQL = "sql"
   130  	// SpanTypeCassandra marks a span as a Cassandra operation. These
   131  	// spans may have an "sql.command" tag.
   132  	SpanTypeCassandra = "cassandra"
   133  	// SpanTypeRedis marks a span as a Redis operation. These spans may
   134  	// also have a "redis.raw_command" tag.
   135  	SpanTypeRedis = "redis"
   136  	// SpanTypeMemcached marks a span as a memcached operation.
   137  	SpanTypeMemcached = "memcached"
   138  	// SpanTypeMongoDB marks a span as a MongoDB operation.
   139  	SpanTypeMongoDB = "mongodb"
   140  	// SpanTypeNetwork is a span type used by network overhead tracking.
   141  	SpanTypeNetwork = "network"
   142  	// SpanTypeElasticSearch marks a span as an ElasticSearch operation.
   143  	// These spans may also have an "elasticsearch.body" tag.
   144  	SpanTypeElasticSearch = "elasticsearch"
   145  	// SpanTypeJob is a span type used by cron jobs.
   146  	SpanTypeJob = "job"
   147  	// SpanTypeRPC is a span type used by grpc services.
   148  	SpanTypeRPC = "rpc"
   149  	// SpanTypeKafka is a span type used by kafka services.
   150  	SpanTypeKafka = "kafka"
   151  	// SpanTypeVault is a span type used by go-sdk/secrets calls to vault
   152  	SpanTypeVault = "vault"
   153  )
   154  
   155  // LoggerLabels
   156  const (
   157  	LoggerLabelDatadogTraceID = "dd.trace-id"
   158  )
   159  
   160  // LoggerAnnotations
   161  const (
   162  	LoggerAnnotationTracingSpanID  = "tracing.span-id"
   163  	LoggerAnnotationTracingTraceID = "tracing.trace-id"
   164  )
   165  
   166  // Priority is a hint given to the backend so that it knows which traces to reject or kept.
   167  // In a distributed context, it should be set before any context propagation (fork, RPC calls) to be effective.
   168  const (
   169  	// PriorityUserReject informs the backend that a trace should be rejected and not stored.
   170  	// This should be used by user code overriding default priority.
   171  	PriorityUserReject = -1
   172  
   173  	// PriorityAutoReject informs the backend that a trace should be rejected and not stored.
   174  	// This is used by the builtin sampler.
   175  	PriorityAutoReject = 0
   176  
   177  	// PriorityAutoKeep informs the backend that a trace should be kept and not stored.
   178  	// This is used by the builtin sampler.
   179  	PriorityAutoKeep = 1
   180  
   181  	// PriorityUserKeep informs the backend that a trace should be kept and not stored.
   182  	// This should be used by user code overriding default priority.
   183  	PriorityUserKeep = 2
   184  )