chore: upgrade dependencies

This commit is contained in:
2022-06-08 00:07:52 +02:00
parent e22bdf96d9
commit 1e6966495c
185 changed files with 5385 additions and 4081 deletions

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package semconv // import "go.opentelemetry.io/otel/semconv/v1.7.0"
package internal // import "go.opentelemetry.io/otel/semconv/internal"
import (
"fmt"
@ -21,47 +21,70 @@ import (
"strconv"
"strings"
"go.opentelemetry.io/otel/trace"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/codes"
"go.opentelemetry.io/otel/trace"
)
// HTTP scheme attributes.
var (
HTTPSchemeHTTP = HTTPSchemeKey.String("http")
HTTPSchemeHTTPS = HTTPSchemeKey.String("https")
)
// SemanticConventions are the semantic convention values defined for a
// version of the OpenTelemetry specification.
type SemanticConventions struct {
EnduserIDKey attribute.Key
HTTPClientIPKey attribute.Key
HTTPFlavorKey attribute.Key
HTTPHostKey attribute.Key
HTTPMethodKey attribute.Key
HTTPRequestContentLengthKey attribute.Key
HTTPRouteKey attribute.Key
HTTPSchemeHTTP attribute.KeyValue
HTTPSchemeHTTPS attribute.KeyValue
HTTPServerNameKey attribute.Key
HTTPStatusCodeKey attribute.Key
HTTPTargetKey attribute.Key
HTTPURLKey attribute.Key
HTTPUserAgentKey attribute.Key
NetHostIPKey attribute.Key
NetHostNameKey attribute.Key
NetHostPortKey attribute.Key
NetPeerIPKey attribute.Key
NetPeerNameKey attribute.Key
NetPeerPortKey attribute.Key
NetTransportIP attribute.KeyValue
NetTransportOther attribute.KeyValue
NetTransportTCP attribute.KeyValue
NetTransportUDP attribute.KeyValue
NetTransportUnix attribute.KeyValue
}
// NetAttributesFromHTTPRequest generates attributes of the net
// namespace as specified by the OpenTelemetry specification for a
// span. The network parameter is a string that net.Dial function
// from standard library can understand.
func NetAttributesFromHTTPRequest(network string, request *http.Request) []attribute.KeyValue {
func (sc *SemanticConventions) NetAttributesFromHTTPRequest(network string, request *http.Request) []attribute.KeyValue {
attrs := []attribute.KeyValue{}
switch network {
case "tcp", "tcp4", "tcp6":
attrs = append(attrs, NetTransportTCP)
attrs = append(attrs, sc.NetTransportTCP)
case "udp", "udp4", "udp6":
attrs = append(attrs, NetTransportUDP)
attrs = append(attrs, sc.NetTransportUDP)
case "ip", "ip4", "ip6":
attrs = append(attrs, NetTransportIP)
attrs = append(attrs, sc.NetTransportIP)
case "unix", "unixgram", "unixpacket":
attrs = append(attrs, NetTransportUnix)
attrs = append(attrs, sc.NetTransportUnix)
default:
attrs = append(attrs, NetTransportOther)
attrs = append(attrs, sc.NetTransportOther)
}
peerIP, peerName, peerPort := hostIPNamePort(request.RemoteAddr)
if peerIP != "" {
attrs = append(attrs, NetPeerIPKey.String(peerIP))
attrs = append(attrs, sc.NetPeerIPKey.String(peerIP))
}
if peerName != "" {
attrs = append(attrs, NetPeerNameKey.String(peerName))
attrs = append(attrs, sc.NetPeerNameKey.String(peerName))
}
if peerPort != 0 {
attrs = append(attrs, NetPeerPortKey.Int(peerPort))
attrs = append(attrs, sc.NetPeerPortKey.Int(peerPort))
}
hostIP, hostName, hostPort := "", "", 0
@ -72,13 +95,13 @@ func NetAttributesFromHTTPRequest(network string, request *http.Request) []attri
}
}
if hostIP != "" {
attrs = append(attrs, NetHostIPKey.String(hostIP))
attrs = append(attrs, sc.NetHostIPKey.String(hostIP))
}
if hostName != "" {
attrs = append(attrs, NetHostNameKey.String(hostName))
attrs = append(attrs, sc.NetHostNameKey.String(hostName))
}
if hostPort != 0 {
attrs = append(attrs, NetHostPortKey.Int(hostPort))
attrs = append(attrs, sc.NetHostPortKey.Int(hostPort))
}
return attrs
@ -111,9 +134,9 @@ func hostIPNamePort(hostWithPort string) (ip string, name string, port int) {
// EndUserAttributesFromHTTPRequest generates attributes of the
// enduser namespace as specified by the OpenTelemetry specification
// for a span.
func EndUserAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue {
func (sc *SemanticConventions) EndUserAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue {
if username, _, ok := request.BasicAuth(); ok {
return []attribute.KeyValue{EnduserIDKey.String(username)}
return []attribute.KeyValue{sc.EnduserIDKey.String(username)}
}
return nil
}
@ -121,13 +144,13 @@ func EndUserAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValu
// HTTPClientAttributesFromHTTPRequest generates attributes of the
// http namespace as specified by the OpenTelemetry specification for
// a span on the client side.
func HTTPClientAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue {
func (sc *SemanticConventions) HTTPClientAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue {
attrs := []attribute.KeyValue{}
if request.Method != "" {
attrs = append(attrs, HTTPMethodKey.String(request.Method))
attrs = append(attrs, sc.HTTPMethodKey.String(request.Method))
} else {
attrs = append(attrs, HTTPMethodKey.String(http.MethodGet))
attrs = append(attrs, sc.HTTPMethodKey.String(http.MethodGet))
}
// remove any username/password info that may be in the URL
@ -135,38 +158,40 @@ func HTTPClientAttributesFromHTTPRequest(request *http.Request) []attribute.KeyV
userinfo := request.URL.User
request.URL.User = nil
attrs = append(attrs, HTTPURLKey.String(request.URL.String()))
attrs = append(attrs, sc.HTTPURLKey.String(request.URL.String()))
// restore any username/password info that was removed
request.URL.User = userinfo
return append(attrs, httpCommonAttributesFromHTTPRequest(request)...)
return append(attrs, sc.httpCommonAttributesFromHTTPRequest(request)...)
}
func httpCommonAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue {
func (sc *SemanticConventions) httpCommonAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue {
attrs := []attribute.KeyValue{}
if ua := request.UserAgent(); ua != "" {
attrs = append(attrs, HTTPUserAgentKey.String(ua))
attrs = append(attrs, sc.HTTPUserAgentKey.String(ua))
}
if request.ContentLength > 0 {
attrs = append(attrs, HTTPRequestContentLengthKey.Int64(request.ContentLength))
attrs = append(attrs, sc.HTTPRequestContentLengthKey.Int64(request.ContentLength))
}
return append(attrs, httpBasicAttributesFromHTTPRequest(request)...)
return append(attrs, sc.httpBasicAttributesFromHTTPRequest(request)...)
}
func httpBasicAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue {
func (sc *SemanticConventions) httpBasicAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue {
// as these attributes are used by HTTPServerMetricAttributesFromHTTPRequest, they should be low-cardinality
attrs := []attribute.KeyValue{}
if request.TLS != nil {
attrs = append(attrs, HTTPSchemeHTTPS)
attrs = append(attrs, sc.HTTPSchemeHTTPS)
} else {
attrs = append(attrs, HTTPSchemeHTTP)
attrs = append(attrs, sc.HTTPSchemeHTTP)
}
if request.Host != "" {
attrs = append(attrs, HTTPHostKey.String(request.Host))
attrs = append(attrs, sc.HTTPHostKey.String(request.Host))
} else if request.URL != nil && request.URL.Host != "" {
attrs = append(attrs, sc.HTTPHostKey.String(request.URL.Host))
}
flavor := ""
@ -176,7 +201,7 @@ func httpBasicAttributesFromHTTPRequest(request *http.Request) []attribute.KeyVa
flavor = "2"
}
if flavor != "" {
attrs = append(attrs, HTTPFlavorKey.String(flavor))
attrs = append(attrs, sc.HTTPFlavorKey.String(flavor))
}
return attrs
@ -184,45 +209,45 @@ func httpBasicAttributesFromHTTPRequest(request *http.Request) []attribute.KeyVa
// HTTPServerMetricAttributesFromHTTPRequest generates low-cardinality attributes
// to be used with server-side HTTP metrics.
func HTTPServerMetricAttributesFromHTTPRequest(serverName string, request *http.Request) []attribute.KeyValue {
func (sc *SemanticConventions) HTTPServerMetricAttributesFromHTTPRequest(serverName string, request *http.Request) []attribute.KeyValue {
attrs := []attribute.KeyValue{}
if serverName != "" {
attrs = append(attrs, HTTPServerNameKey.String(serverName))
attrs = append(attrs, sc.HTTPServerNameKey.String(serverName))
}
return append(attrs, httpBasicAttributesFromHTTPRequest(request)...)
return append(attrs, sc.httpBasicAttributesFromHTTPRequest(request)...)
}
// HTTPServerAttributesFromHTTPRequest generates attributes of the
// http namespace as specified by the OpenTelemetry specification for
// a span on the server side. Currently, only basic authentication is
// supported.
func HTTPServerAttributesFromHTTPRequest(serverName, route string, request *http.Request) []attribute.KeyValue {
func (sc *SemanticConventions) HTTPServerAttributesFromHTTPRequest(serverName, route string, request *http.Request) []attribute.KeyValue {
attrs := []attribute.KeyValue{
HTTPMethodKey.String(request.Method),
HTTPTargetKey.String(request.RequestURI),
sc.HTTPMethodKey.String(request.Method),
sc.HTTPTargetKey.String(request.RequestURI),
}
if serverName != "" {
attrs = append(attrs, HTTPServerNameKey.String(serverName))
attrs = append(attrs, sc.HTTPServerNameKey.String(serverName))
}
if route != "" {
attrs = append(attrs, HTTPRouteKey.String(route))
attrs = append(attrs, sc.HTTPRouteKey.String(route))
}
if values, ok := request.Header["X-Forwarded-For"]; ok && len(values) > 0 {
if addresses := strings.SplitN(values[0], ",", 2); len(addresses) > 0 {
attrs = append(attrs, HTTPClientIPKey.String(addresses[0]))
attrs = append(attrs, sc.HTTPClientIPKey.String(addresses[0]))
}
}
return append(attrs, httpCommonAttributesFromHTTPRequest(request)...)
return append(attrs, sc.httpCommonAttributesFromHTTPRequest(request)...)
}
// HTTPAttributesFromHTTPStatusCode generates attributes of the http
// namespace as specified by the OpenTelemetry specification for a
// span.
func HTTPAttributesFromHTTPStatusCode(code int) []attribute.KeyValue {
func (sc *SemanticConventions) HTTPAttributesFromHTTPStatusCode(code int) []attribute.KeyValue {
attrs := []attribute.KeyValue{
HTTPStatusCodeKey.Int(code),
sc.HTTPStatusCodeKey.Int(code),
}
return attrs
}
@ -286,9 +311,9 @@ func SpanStatusFromHTTPStatusCodeAndSpanKind(code int, spanKind trace.SpanKind)
return spanCode, ""
}
// Validates the HTTP status code and returns corresponding span status code.
// If the `code` is not a valid HTTP status code, returns span status Error
// and false.
// validateHTTPStatusCode validates the HTTP status code and returns
// corresponding span status code. If the `code` is not a valid HTTP status
// code, returns span status Error and false.
func validateHTTPStatusCode(code int) (codes.Code, bool) {
category := code / 100
ranges, ok := validRangesPerCategory[category]

View File

@ -16,5 +16,5 @@
//
// OpenTelemetry semantic conventions are agreed standardized naming
// patterns for OpenTelemetry things. This package represents the conventions
// as of the v1.7.0 version of the OpenTelemetry specification.
package semconv // import "go.opentelemetry.io/otel/semconv/v1.7.0"
// as of the v1.10.0 version of the OpenTelemetry specification.
package semconv // import "go.opentelemetry.io/otel/semconv/v1.10.0"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package semconv // import "go.opentelemetry.io/otel/semconv/v1.7.0"
package semconv // import "go.opentelemetry.io/otel/semconv/v1.10.0"
const (
// ExceptionEventName is the name of the Span event representing an exception.

114
vendor/go.opentelemetry.io/otel/semconv/v1.10.0/http.go generated vendored Normal file
View File

@ -0,0 +1,114 @@
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package semconv // import "go.opentelemetry.io/otel/semconv/v1.10.0"
import (
"net/http"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/codes"
"go.opentelemetry.io/otel/semconv/internal"
"go.opentelemetry.io/otel/trace"
)
// HTTP scheme attributes.
var (
HTTPSchemeHTTP = HTTPSchemeKey.String("http")
HTTPSchemeHTTPS = HTTPSchemeKey.String("https")
)
var sc = &internal.SemanticConventions{
EnduserIDKey: EnduserIDKey,
HTTPClientIPKey: HTTPClientIPKey,
HTTPFlavorKey: HTTPFlavorKey,
HTTPHostKey: HTTPHostKey,
HTTPMethodKey: HTTPMethodKey,
HTTPRequestContentLengthKey: HTTPRequestContentLengthKey,
HTTPRouteKey: HTTPRouteKey,
HTTPSchemeHTTP: HTTPSchemeHTTP,
HTTPSchemeHTTPS: HTTPSchemeHTTPS,
HTTPServerNameKey: HTTPServerNameKey,
HTTPStatusCodeKey: HTTPStatusCodeKey,
HTTPTargetKey: HTTPTargetKey,
HTTPURLKey: HTTPURLKey,
HTTPUserAgentKey: HTTPUserAgentKey,
NetHostIPKey: NetHostIPKey,
NetHostNameKey: NetHostNameKey,
NetHostPortKey: NetHostPortKey,
NetPeerIPKey: NetPeerIPKey,
NetPeerNameKey: NetPeerNameKey,
NetPeerPortKey: NetPeerPortKey,
NetTransportIP: NetTransportIP,
NetTransportOther: NetTransportOther,
NetTransportTCP: NetTransportTCP,
NetTransportUDP: NetTransportUDP,
NetTransportUnix: NetTransportUnix,
}
// NetAttributesFromHTTPRequest generates attributes of the net
// namespace as specified by the OpenTelemetry specification for a
// span. The network parameter is a string that net.Dial function
// from standard library can understand.
func NetAttributesFromHTTPRequest(network string, request *http.Request) []attribute.KeyValue {
return sc.NetAttributesFromHTTPRequest(network, request)
}
// EndUserAttributesFromHTTPRequest generates attributes of the
// enduser namespace as specified by the OpenTelemetry specification
// for a span.
func EndUserAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue {
return sc.EndUserAttributesFromHTTPRequest(request)
}
// HTTPClientAttributesFromHTTPRequest generates attributes of the
// http namespace as specified by the OpenTelemetry specification for
// a span on the client side.
func HTTPClientAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue {
return sc.HTTPClientAttributesFromHTTPRequest(request)
}
// HTTPServerMetricAttributesFromHTTPRequest generates low-cardinality attributes
// to be used with server-side HTTP metrics.
func HTTPServerMetricAttributesFromHTTPRequest(serverName string, request *http.Request) []attribute.KeyValue {
return sc.HTTPServerMetricAttributesFromHTTPRequest(serverName, request)
}
// HTTPServerAttributesFromHTTPRequest generates attributes of the
// http namespace as specified by the OpenTelemetry specification for
// a span on the server side. Currently, only basic authentication is
// supported.
func HTTPServerAttributesFromHTTPRequest(serverName, route string, request *http.Request) []attribute.KeyValue {
return sc.HTTPServerAttributesFromHTTPRequest(serverName, route, request)
}
// HTTPAttributesFromHTTPStatusCode generates attributes of the http
// namespace as specified by the OpenTelemetry specification for a
// span.
func HTTPAttributesFromHTTPStatusCode(code int) []attribute.KeyValue {
return sc.HTTPAttributesFromHTTPStatusCode(code)
}
// SpanStatusFromHTTPStatusCode generates a status code and a message
// as specified by the OpenTelemetry specification for a span.
func SpanStatusFromHTTPStatusCode(code int) (codes.Code, string) {
return internal.SpanStatusFromHTTPStatusCode(code)
}
// SpanStatusFromHTTPStatusCodeAndSpanKind generates a status code and a message
// as specified by the OpenTelemetry specification for a span.
// Exclude 4xx for SERVER to set the appropriate status.
func SpanStatusFromHTTPStatusCodeAndSpanKind(code int, spanKind trace.SpanKind) (codes.Code, string) {
return internal.SpanStatusFromHTTPStatusCodeAndSpanKind(code, spanKind)
}

View File

@ -14,7 +14,7 @@
// Code generated from semantic convention specification. DO NOT EDIT.
package semconv // import "go.opentelemetry.io/otel/semconv/v1.7.0"
package semconv // import "go.opentelemetry.io/otel/semconv/v1.10.0"
import "go.opentelemetry.io/otel/attribute"
@ -33,18 +33,19 @@ const (
// Stability: stable
// Examples: '111111111111', 'opentelemetry'
CloudAccountIDKey = attribute.Key("cloud.account.id")
// The geographical region the resource is running. Refer to your provider's docs
// to see the available regions, for example [Alibaba Cloud
// regions](https://www.alibabacloud.com/help/doc-detail/40654.htm), [AWS
// regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/),
// [Azure regions](https://azure.microsoft.com/en-us/global-
// infrastructure/geographies/), or [Google Cloud
// regions](https://cloud.google.com/about/locations).
// The geographical region the resource is running.
//
// Type: string
// Required: No
// Stability: stable
// Examples: 'us-central1', 'us-east-1'
// Note: Refer to your provider's docs to see the available regions, for example
// [Alibaba Cloud regions](https://www.alibabacloud.com/help/doc-
// detail/40654.htm), [AWS regions](https://aws.amazon.com/about-aws/global-
// infrastructure/regions_az/), [Azure regions](https://azure.microsoft.com/en-
// us/global-infrastructure/geographies/), [Google Cloud
// regions](https://cloud.google.com/about/locations), or [Tencent Cloud
// regions](https://intl.cloud.tencent.com/document/product/213/6091).
CloudRegionKey = attribute.Key("cloud.region")
// Cloud regions often have multiple, isolated locations known as zones to
// increase availability. Availability zone represents the zone where the resource
@ -75,6 +76,8 @@ var (
CloudProviderAzure = CloudProviderKey.String("azure")
// Google Cloud Platform
CloudProviderGCP = CloudProviderKey.String("gcp")
// Tencent Cloud
CloudProviderTencentCloud = CloudProviderKey.String("tencent_cloud")
)
var (
@ -92,6 +95,8 @@ var (
CloudPlatformAWSLambda = CloudPlatformKey.String("aws_lambda")
// AWS Elastic Beanstalk
CloudPlatformAWSElasticBeanstalk = CloudPlatformKey.String("aws_elastic_beanstalk")
// AWS App Runner
CloudPlatformAWSAppRunner = CloudPlatformKey.String("aws_app_runner")
// Azure Virtual Machines
CloudPlatformAzureVM = CloudPlatformKey.String("azure_vm")
// Azure Container Instances
@ -112,6 +117,12 @@ var (
CloudPlatformGCPCloudFunctions = CloudPlatformKey.String("gcp_cloud_functions")
// Google Cloud App Engine (GAE)
CloudPlatformGCPAppEngine = CloudPlatformKey.String("gcp_app_engine")
// Tencent Cloud Cloud Virtual Machine (CVM)
CloudPlatformTencentCloudCvm = CloudPlatformKey.String("tencent_cloud_cvm")
// Tencent Cloud Elastic Kubernetes Service (EKS)
CloudPlatformTencentCloudEKS = CloudPlatformKey.String("tencent_cloud_eks")
// Tencent Cloud Serverless Cloud Function (SCF)
CloudPlatformTencentCloudScf = CloudPlatformKey.String("tencent_cloud_scf")
)
// Resources used by AWS Elastic Container Service (ECS).
@ -229,7 +240,7 @@ const (
// A container instance.
const (
// Container name.
// Container name used by container runtime.
//
// Type: string
// Required: No
@ -320,6 +331,16 @@ const (
// Note: It's recommended this value represents a human readable version of the
// device model rather than a machine readable alternative.
DeviceModelNameKey = attribute.Key("device.model.name")
// The name of the device manufacturer
//
// Type: string
// Required: No
// Stability: stable
// Examples: 'Apple', 'Samsung'
// Note: The Android OS provides this field via
// [Build](https://developer.android.com/reference/android/os/Build#MANUFACTURER).
// iOS apps SHOULD hardcode the value `Apple`.
DeviceManufacturerKey = attribute.Key("device.manufacturer")
)
// A serverless instance.
@ -476,6 +497,8 @@ var (
HostArchPPC32 = HostArchKey.String("ppc32")
// 64-bit PowerPC
HostArchPPC64 = HostArchKey.String("ppc64")
// IBM z/Architecture
HostArchS390x = HostArchKey.String("s390x")
// 32-bit x86
HostArchX86 = HostArchKey.String("x86")
)
@ -540,13 +563,23 @@ const (
// A container in a [PodTemplate](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates).
const (
// The name of the Container in a Pod template.
// The name of the Container from Pod specification, must be unique within a Pod.
// Container runtime usually uses different globally unique name
// (`container.name`).
//
// Type: string
// Required: No
// Stability: stable
// Examples: 'redis'
K8SContainerNameKey = attribute.Key("k8s.container.name")
// Number of times the container was restarted. This attribute can be used to
// identify a particular container (running or stopped) within a container spec.
//
// Type: int
// Required: No
// Stability: stable
// Examples: 0, 2
K8SContainerRestartCountKey = attribute.Key("k8s.container.restart_count")
)
// A Kubernetes ReplicaSet object.
@ -917,6 +950,8 @@ var (
TelemetrySDKLanguageRuby = TelemetrySDKLanguageKey.String("ruby")
// webjs
TelemetrySDKLanguageWebjs = TelemetrySDKLanguageKey.String("webjs")
// swift
TelemetrySDKLanguageSwift = TelemetrySDKLanguageKey.String("swift")
)
// Resource describing the packaged software running the application code. Web engines are typically executed using process.runtime.

View File

@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package semconv // import "go.opentelemetry.io/otel/semconv/v1.7.0"
package semconv // import "go.opentelemetry.io/otel/semconv/v1.10.0"
// SchemaURL is the schema URL that matches the version of the semantic conventions
// that this package defines. Semconv packages starting from v1.4.0 must declare
// non-empty schema URL in the form https://opentelemetry.io/schemas/<version>
const SchemaURL = "https://opentelemetry.io/schemas/v1.7.0"
const SchemaURL = "https://opentelemetry.io/schemas/1.10.0"

View File

@ -14,7 +14,7 @@
// Code generated from semantic convention specification. DO NOT EDIT.
package semconv // import "go.opentelemetry.io/otel/semconv/v1.7.0"
package semconv // import "go.opentelemetry.io/otel/semconv/v1.10.0"
import "go.opentelemetry.io/otel/attribute"
@ -32,6 +32,71 @@ const (
AWSLambdaInvokedARNKey = attribute.Key("aws.lambda.invoked_arn")
)
// This document defines attributes for CloudEvents. CloudEvents is a specification on how to define event data in a standard way. These attributes can be attached to spans when performing operations with CloudEvents, regardless of the protocol being used.
const (
// The [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec
// .md#id) uniquely identifies the event.
//
// Type: string
// Required: Always
// Stability: stable
// Examples: '123e4567-e89b-12d3-a456-426614174000', '0001'
CloudeventsEventIDKey = attribute.Key("cloudevents.event_id")
// The [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.m
// d#source-1) identifies the context in which an event happened.
//
// Type: string
// Required: Always
// Stability: stable
// Examples: 'https://github.com/cloudevents', '/cloudevents/spec/pull/123', 'my-
// service'
CloudeventsEventSourceKey = attribute.Key("cloudevents.event_source")
// The [version of the CloudEvents specification](https://github.com/cloudevents/s
// pec/blob/v1.0.2/cloudevents/spec.md#specversion) which the event uses.
//
// Type: string
// Required: Always
// Stability: stable
// Examples: '1.0'
CloudeventsEventSpecVersionKey = attribute.Key("cloudevents.event_spec_version")
// The [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/sp
// ec.md#type) contains a value describing the type of event related to the
// originating occurrence.
//
// Type: string
// Required: Always
// Stability: stable
// Examples: 'com.github.pull_request.opened', 'com.example.object.deleted.v2'
CloudeventsEventTypeKey = attribute.Key("cloudevents.event_type")
// The [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.
// md#subject) of the event in the context of the event producer (identified by
// source).
//
// Type: string
// Required: No
// Stability: stable
// Examples: 'mynewfile.jpg'
CloudeventsEventSubjectKey = attribute.Key("cloudevents.event_subject")
)
// This document defines semantic conventions for the OpenTracing Shim
const (
// Parent-child Reference type
//
// Type: Enum
// Required: No
// Stability: stable
// Note: The causal relationship between a child Span and a parent Span.
OpentracingRefTypeKey = attribute.Key("opentracing.ref_type")
)
var (
// The parent Span depends on the child Span in some capacity
OpentracingRefTypeChildOf = OpentracingRefTypeKey.String("child_of")
// The parent Span does not depend in any way on the result of the child Span
OpentracingRefTypeFollowsFrom = OpentracingRefTypeKey.String("follows_from")
)
// This document defines the attributes used to perform database client calls.
const (
// An identifier for the database management system (DBMS) product being used. See
@ -66,17 +131,18 @@ const (
// Examples: 'org.postgresql.Driver',
// 'com.microsoft.sqlserver.jdbc.SQLServerDriver'
DBJDBCDriverClassnameKey = attribute.Key("db.jdbc.driver_classname")
// If no [tech-specific attribute](#call-level-attributes-for-specific-
// technologies) is defined, this attribute is used to report the name of the
// database being accessed. For commands that switch the database, this should be
// set to the target database (even if the command fails).
// This attribute is used to report the name of the database being accessed. For
// commands that switch the database, this should be set to the target database
// (even if the command fails).
//
// Type: string
// Required: Required, if applicable and no more-specific attribute is defined.
// Required: Required, if applicable.
// Stability: stable
// Examples: 'customers', 'main'
// Note: In some SQL databases, the database name to be used is called "schema
// name".
// name". In case there are multiple layers that could be considered for database
// name (e.g. Oracle instance name and schema name), the database name to be used
// is the more specific layer (e.g. Oracle schema name).
DBNameKey = attribute.Key("db.name")
// The database statement being executed.
//
@ -217,14 +283,6 @@ const (
// Call-level attributes for Cassandra
const (
// The name of the keyspace being accessed. To be used instead of the generic
// `db.name` attribute.
//
// Type: string
// Required: Always
// Stability: stable
// Examples: 'mykeyspace'
DBCassandraKeyspaceKey = attribute.Key("db.cassandra.keyspace")
// The fetch size used for paging, i.e. how many rows will be returned at once.
//
// Type: int
@ -241,7 +299,7 @@ const (
// Stability: stable
DBCassandraConsistencyLevelKey = attribute.Key("db.cassandra.consistency_level")
// The name of the primary table that the operation is acting upon, including the
// schema name (if applicable).
// keyspace name (if applicable).
//
// Type: string
// Required: Recommended if available.
@ -308,18 +366,6 @@ var (
DBCassandraConsistencyLevelLocalSerial = DBCassandraConsistencyLevelKey.String("local_serial")
)
// Call-level attributes for Apache HBase
const (
// The [HBase namespace](https://hbase.apache.org/book.html#_namespace) being
// accessed. To be used instead of the generic `db.name` attribute.
//
// Type: string
// Required: Always
// Stability: stable
// Examples: 'default'
DBHBaseNamespaceKey = attribute.Key("db.hbase.namespace")
)
// Call-level attributes for Redis
const (
// The index of the database being accessed as used in the [`SELECT`
@ -344,10 +390,10 @@ const (
DBMongoDBCollectionKey = attribute.Key("db.mongodb.collection")
)
// Call-level attrbiutes for SQL databases
// Call-level attributes for SQL databases
const (
// The name of the primary table that the operation is acting upon, including the
// schema name (if applicable).
// database name (if applicable).
//
// Type: string
// Required: Recommended if available.
@ -408,7 +454,7 @@ const (
// whether it will escape the scope of a span.
// However, it is trivial to know that an exception
// will escape, if one checks for an active exception just before ending the span,
// as done in the [example above](#exception-end-example).
// as done in the [example above](#recording-an-exception).
// It follows that an exception may still escape the scope of the span
// even if the `exception.escaped` attribute was not set or set to false,
@ -419,15 +465,20 @@ const (
// This semantic convention describes an instance of a function that runs without provisioning or managing of servers (also known as serverless functions or Function as a Service (FaaS)) with spans.
const (
// Type of the trigger on which the function is executed.
// Type of the trigger which caused this function execution.
//
// Type: Enum
// Required: On FaaS instances, faas.trigger MUST be set on incoming invocations.
// Clients invoking FaaS instances MUST set `faas.trigger` on outgoing
// invocations, if it is known to the client. This is, for example, not the case,
// when the transport layer is abstracted in a FaaS client framework without
// access to its configuration.
// Required: No
// Stability: stable
// Note: For the server/consumer span on the incoming side,
// `faas.trigger` MUST be set.
// Clients invoking FaaS instances usually cannot set `faas.trigger`,
// since they would typically need to look in the payload to determine
// the event type. If clients set it, it should be the same as the
// trigger that corresponding incoming would have (i.e., this has
// nothing to do with the underlying transport used to make the API
// call to invoke the lambda, which is often HTTP).
FaaSTriggerKey = attribute.Key("faas.trigger")
// The execution ID of the current function execution.
//
@ -572,6 +623,8 @@ var (
FaaSInvokedProviderAzure = FaaSInvokedProviderKey.String("azure")
// Google Cloud Platform
FaaSInvokedProviderGCP = FaaSInvokedProviderKey.String("gcp")
// Tencent Cloud
FaaSInvokedProviderTencentCloud = FaaSInvokedProviderKey.String("tencent_cloud")
)
// These attributes may be used for any network related operation.
@ -957,6 +1010,13 @@ const (
// Stability: stable
// Examples: 5493
HTTPResponseContentLengthUncompressedKey = attribute.Key("http.response_content_length_uncompressed")
// The ordinal number of request re-sending attempt.
//
// Type: int
// Required: If and only if a request was retried.
// Stability: stable
// Examples: 3
HTTPRetryCountKey = attribute.Key("http.retry_count")
)
var (
@ -1224,7 +1284,7 @@ const (
// Type: string
// Required: Always
// Stability: stable
// Examples: 'kafka', 'rabbitmq', 'activemq', 'AmazonSQS'
// Examples: 'kafka', 'rabbitmq', 'rocketmq', 'activemq', 'AmazonSQS'
MessagingSystemKey = attribute.Key("messaging.system")
// The message destination name. This might be equal to the span name but is
// required nevertheless.
@ -1396,14 +1456,85 @@ const (
MessagingKafkaTombstoneKey = attribute.Key("messaging.kafka.tombstone")
)
// This document defines semantic conventions for remote procedure calls.
// Attributes for Apache RocketMQ
const (
// A string identifying the remoting system.
// Namespace of RocketMQ resources, resources in different namespaces are
// individual.
//
// Type: string
// Required: Always
// Stability: stable
// Examples: 'grpc', 'java_rmi', 'wcf'
// Examples: 'myNamespace'
MessagingRocketmqNamespaceKey = attribute.Key("messaging.rocketmq.namespace")
// Name of the RocketMQ producer/consumer group that is handling the message. The
// client type is identified by the SpanKind.
//
// Type: string
// Required: Always
// Stability: stable
// Examples: 'myConsumerGroup'
MessagingRocketmqClientGroupKey = attribute.Key("messaging.rocketmq.client_group")
// The unique identifier for each client.
//
// Type: string
// Required: Always
// Stability: stable
// Examples: 'myhost@8742@s8083jm'
MessagingRocketmqClientIDKey = attribute.Key("messaging.rocketmq.client_id")
// Type of message.
//
// Type: Enum
// Required: No
// Stability: stable
MessagingRocketmqMessageTypeKey = attribute.Key("messaging.rocketmq.message_type")
// The secondary classifier of message besides topic.
//
// Type: string
// Required: No
// Stability: stable
// Examples: 'tagA'
MessagingRocketmqMessageTagKey = attribute.Key("messaging.rocketmq.message_tag")
// Key(s) of message, another way to mark message besides message id.
//
// Type: string[]
// Required: No
// Stability: stable
// Examples: 'keyA', 'keyB'
MessagingRocketmqMessageKeysKey = attribute.Key("messaging.rocketmq.message_keys")
// Model of message consumption. This only applies to consumer spans.
//
// Type: Enum
// Required: No
// Stability: stable
MessagingRocketmqConsumptionModelKey = attribute.Key("messaging.rocketmq.consumption_model")
)
var (
// Normal message
MessagingRocketmqMessageTypeNormal = MessagingRocketmqMessageTypeKey.String("normal")
// FIFO message
MessagingRocketmqMessageTypeFifo = MessagingRocketmqMessageTypeKey.String("fifo")
// Delay message
MessagingRocketmqMessageTypeDelay = MessagingRocketmqMessageTypeKey.String("delay")
// Transaction message
MessagingRocketmqMessageTypeTransaction = MessagingRocketmqMessageTypeKey.String("transaction")
)
var (
// Clustering consumption model
MessagingRocketmqConsumptionModelClustering = MessagingRocketmqConsumptionModelKey.String("clustering")
// Broadcasting consumption model
MessagingRocketmqConsumptionModelBroadcasting = MessagingRocketmqConsumptionModelKey.String("broadcasting")
)
// This document defines semantic conventions for remote procedure calls.
const (
// A string identifying the remoting system. See below for a list of well-known
// identifiers.
//
// Type: Enum
// Required: Always
// Stability: stable
RPCSystemKey = attribute.Key("rpc.system")
// The full (logical) name of the service being called, including its package
// name, if applicable.
@ -1434,6 +1565,17 @@ const (
RPCMethodKey = attribute.Key("rpc.method")
)
var (
// gRPC
RPCSystemGRPC = RPCSystemKey.String("grpc")
// Java RMI
RPCSystemJavaRmi = RPCSystemKey.String("java_rmi")
// .NET WCF
RPCSystemDotnetWcf = RPCSystemKey.String("dotnet_wcf")
// Apache Dubbo
RPCSystemApacheDubbo = RPCSystemKey.String("apache_dubbo")
)
// Tech-specific attributes for gRPC.
const (
// The [numeric status