rebase: update kubernetes to 1.26.1

update kubernetes and its dependencies
to v1.26.1

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna
2023-02-01 18:06:36 +01:00
committed by mergify[bot]
parent e9e33fb851
commit 9c8de9471e
937 changed files with 75539 additions and 33050 deletions

View File

@ -1,297 +0,0 @@
// 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"
import (
"fmt"
"net"
"net/http"
"strconv"
"strings"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/codes"
)
// 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 {
attrs := []attribute.KeyValue{}
switch network {
case "tcp", "tcp4", "tcp6":
attrs = append(attrs, NetTransportTCP)
case "udp", "udp4", "udp6":
attrs = append(attrs, NetTransportUDP)
case "ip", "ip4", "ip6":
attrs = append(attrs, NetTransportIP)
case "unix", "unixgram", "unixpacket":
attrs = append(attrs, NetTransportUnix)
default:
attrs = append(attrs, NetTransportOther)
}
peerName, peerIP, peerPort := "", "", 0
{
hostPart := request.RemoteAddr
portPart := ""
if idx := strings.LastIndex(hostPart, ":"); idx >= 0 {
hostPart = request.RemoteAddr[:idx]
portPart = request.RemoteAddr[idx+1:]
}
if hostPart != "" {
if ip := net.ParseIP(hostPart); ip != nil {
peerIP = ip.String()
} else {
peerName = hostPart
}
if portPart != "" {
numPort, err := strconv.ParseUint(portPart, 10, 16)
if err == nil {
peerPort = (int)(numPort)
} else {
peerName, peerIP = "", ""
}
}
}
}
if peerName != "" {
attrs = append(attrs, NetPeerNameKey.String(peerName))
}
if peerIP != "" {
attrs = append(attrs, NetPeerIPKey.String(peerIP))
}
if peerPort != 0 {
attrs = append(attrs, NetPeerPortKey.Int(peerPort))
}
hostIP, hostName, hostPort := "", "", 0
for _, someHost := range []string{request.Host, request.Header.Get("Host"), request.URL.Host} {
hostPart := ""
if idx := strings.LastIndex(someHost, ":"); idx >= 0 {
strPort := someHost[idx+1:]
numPort, err := strconv.ParseUint(strPort, 10, 16)
if err == nil {
hostPort = (int)(numPort)
}
hostPart = someHost[:idx]
} else {
hostPart = someHost
}
if hostPart != "" {
ip := net.ParseIP(hostPart)
if ip != nil {
hostIP = ip.String()
} else {
hostName = hostPart
}
break
} else {
hostPort = 0
}
}
if hostIP != "" {
attrs = append(attrs, NetHostIPKey.String(hostIP))
}
if hostName != "" {
attrs = append(attrs, NetHostNameKey.String(hostName))
}
if hostPort != 0 {
attrs = append(attrs, NetHostPortKey.Int(hostPort))
}
return attrs
}
// EndUserAttributesFromHTTPRequest generates attributes of the
// enduser namespace as specified by the OpenTelemetry specification
// for a span.
func EndUserAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue {
if username, _, ok := request.BasicAuth(); ok {
return []attribute.KeyValue{EnduserIDKey.String(username)}
}
return nil
}
// 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 {
attrs := []attribute.KeyValue{}
if request.Method != "" {
attrs = append(attrs, HTTPMethodKey.String(request.Method))
} else {
attrs = append(attrs, HTTPMethodKey.String(http.MethodGet))
}
attrs = append(attrs, HTTPURLKey.String(request.URL.String()))
return append(attrs, httpCommonAttributesFromHTTPRequest(request)...)
}
func httpCommonAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue {
attrs := []attribute.KeyValue{}
if ua := request.UserAgent(); ua != "" {
attrs = append(attrs, HTTPUserAgentKey.String(ua))
}
if request.ContentLength > 0 {
attrs = append(attrs, HTTPRequestContentLengthKey.Int64(request.ContentLength))
}
return append(attrs, httpBasicAttributesFromHTTPRequest(request)...)
}
func 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)
} else {
attrs = append(attrs, HTTPSchemeHTTP)
}
if request.Host != "" {
attrs = append(attrs, HTTPHostKey.String(request.Host))
}
flavor := ""
if request.ProtoMajor == 1 {
flavor = fmt.Sprintf("1.%d", request.ProtoMinor)
} else if request.ProtoMajor == 2 {
flavor = "2"
}
if flavor != "" {
attrs = append(attrs, HTTPFlavorKey.String(flavor))
}
return attrs
}
// HTTPServerMetricAttributesFromHTTPRequest generates low-cardinality attributes
// to be used with server-side HTTP metrics.
func HTTPServerMetricAttributesFromHTTPRequest(serverName string, request *http.Request) []attribute.KeyValue {
attrs := []attribute.KeyValue{}
if serverName != "" {
attrs = append(attrs, HTTPServerNameKey.String(serverName))
}
return append(attrs, 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 {
attrs := []attribute.KeyValue{
HTTPMethodKey.String(request.Method),
HTTPTargetKey.String(request.RequestURI),
}
if serverName != "" {
attrs = append(attrs, HTTPServerNameKey.String(serverName))
}
if route != "" {
attrs = append(attrs, HTTPRouteKey.String(route))
}
if values, ok := request.Header["X-Forwarded-For"]; ok && len(values) > 0 {
attrs = append(attrs, HTTPClientIPKey.String(values[0]))
}
return append(attrs, httpCommonAttributesFromHTTPRequest(request)...)
}
// HTTPAttributesFromHTTPStatusCode generates attributes of the http
// namespace as specified by the OpenTelemetry specification for a
// span.
func HTTPAttributesFromHTTPStatusCode(code int) []attribute.KeyValue {
attrs := []attribute.KeyValue{
HTTPStatusCodeKey.Int(code),
}
return attrs
}
type codeRange struct {
fromInclusive int
toInclusive int
}
func (r codeRange) contains(code int) bool {
return r.fromInclusive <= code && code <= r.toInclusive
}
var validRangesPerCategory = map[int][]codeRange{
1: {
{http.StatusContinue, http.StatusEarlyHints},
},
2: {
{http.StatusOK, http.StatusAlreadyReported},
{http.StatusIMUsed, http.StatusIMUsed},
},
3: {
{http.StatusMultipleChoices, http.StatusUseProxy},
{http.StatusTemporaryRedirect, http.StatusPermanentRedirect},
},
4: {
{http.StatusBadRequest, http.StatusTeapot}, // yes, teapot is so useful…
{http.StatusMisdirectedRequest, http.StatusUpgradeRequired},
{http.StatusPreconditionRequired, http.StatusTooManyRequests},
{http.StatusRequestHeaderFieldsTooLarge, http.StatusRequestHeaderFieldsTooLarge},
{http.StatusUnavailableForLegalReasons, http.StatusUnavailableForLegalReasons},
},
5: {
{http.StatusInternalServerError, http.StatusLoopDetected},
{http.StatusNotExtended, http.StatusNetworkAuthenticationRequired},
},
}
// SpanStatusFromHTTPStatusCode generates a status code and a message
// as specified by the OpenTelemetry specification for a span.
func SpanStatusFromHTTPStatusCode(code int) (codes.Code, string) {
spanCode, valid := validateHTTPStatusCode(code)
if !valid {
return spanCode, fmt.Sprintf("Invalid HTTP status code %d", code)
}
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.
func validateHTTPStatusCode(code int) (codes.Code, bool) {
category := code / 100
ranges, ok := validRangesPerCategory[category]
if !ok {
return codes.Error, false
}
ok = false
for _, crange := range ranges {
ok = crange.contains(code)
if ok {
break
}
}
if !ok {
return codes.Error, false
}
if category > 0 && category < 4 {
return codes.Unset, true
}
return codes.Error, true
}

View File

@ -0,0 +1,336 @@
// 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 internal // import "go.opentelemetry.io/otel/semconv/internal"
import (
"fmt"
"net"
"net/http"
"strconv"
"strings"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/codes"
"go.opentelemetry.io/otel/trace"
)
// 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 (sc *SemanticConventions) NetAttributesFromHTTPRequest(network string, request *http.Request) []attribute.KeyValue {
attrs := []attribute.KeyValue{}
switch network {
case "tcp", "tcp4", "tcp6":
attrs = append(attrs, sc.NetTransportTCP)
case "udp", "udp4", "udp6":
attrs = append(attrs, sc.NetTransportUDP)
case "ip", "ip4", "ip6":
attrs = append(attrs, sc.NetTransportIP)
case "unix", "unixgram", "unixpacket":
attrs = append(attrs, sc.NetTransportUnix)
default:
attrs = append(attrs, sc.NetTransportOther)
}
peerIP, peerName, peerPort := hostIPNamePort(request.RemoteAddr)
if peerIP != "" {
attrs = append(attrs, sc.NetPeerIPKey.String(peerIP))
}
if peerName != "" {
attrs = append(attrs, sc.NetPeerNameKey.String(peerName))
}
if peerPort != 0 {
attrs = append(attrs, sc.NetPeerPortKey.Int(peerPort))
}
hostIP, hostName, hostPort := "", "", 0
for _, someHost := range []string{request.Host, request.Header.Get("Host"), request.URL.Host} {
hostIP, hostName, hostPort = hostIPNamePort(someHost)
if hostIP != "" || hostName != "" || hostPort != 0 {
break
}
}
if hostIP != "" {
attrs = append(attrs, sc.NetHostIPKey.String(hostIP))
}
if hostName != "" {
attrs = append(attrs, sc.NetHostNameKey.String(hostName))
}
if hostPort != 0 {
attrs = append(attrs, sc.NetHostPortKey.Int(hostPort))
}
return attrs
}
// hostIPNamePort extracts the IP address, name and (optional) port from hostWithPort.
// It handles both IPv4 and IPv6 addresses. If the host portion is not recognized
// as a valid IPv4 or IPv6 address, the `ip` result will be empty and the
// host portion will instead be returned in `name`.
func hostIPNamePort(hostWithPort string) (ip string, name string, port int) {
var (
hostPart, portPart string
parsedPort uint64
err error
)
if hostPart, portPart, err = net.SplitHostPort(hostWithPort); err != nil {
hostPart, portPart = hostWithPort, ""
}
if parsedIP := net.ParseIP(hostPart); parsedIP != nil {
ip = parsedIP.String()
} else {
name = hostPart
}
if parsedPort, err = strconv.ParseUint(portPart, 10, 16); err == nil {
port = int(parsedPort)
}
return
}
// EndUserAttributesFromHTTPRequest generates attributes of the
// enduser namespace as specified by the OpenTelemetry specification
// for a span.
func (sc *SemanticConventions) EndUserAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue {
if username, _, ok := request.BasicAuth(); ok {
return []attribute.KeyValue{sc.EnduserIDKey.String(username)}
}
return nil
}
// HTTPClientAttributesFromHTTPRequest generates attributes of the
// http namespace as specified by the OpenTelemetry specification for
// a span on the client side.
func (sc *SemanticConventions) HTTPClientAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue {
attrs := []attribute.KeyValue{}
// remove any username/password info that may be in the URL
// before adding it to the attributes
userinfo := request.URL.User
request.URL.User = nil
attrs = append(attrs, sc.HTTPURLKey.String(request.URL.String()))
// restore any username/password info that was removed
request.URL.User = userinfo
return append(attrs, sc.httpCommonAttributesFromHTTPRequest(request)...)
}
func (sc *SemanticConventions) httpCommonAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue {
attrs := []attribute.KeyValue{}
if ua := request.UserAgent(); ua != "" {
attrs = append(attrs, sc.HTTPUserAgentKey.String(ua))
}
if request.ContentLength > 0 {
attrs = append(attrs, sc.HTTPRequestContentLengthKey.Int64(request.ContentLength))
}
return append(attrs, sc.httpBasicAttributesFromHTTPRequest(request)...)
}
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, sc.HTTPSchemeHTTPS)
} else {
attrs = append(attrs, sc.HTTPSchemeHTTP)
}
if 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 := ""
if request.ProtoMajor == 1 {
flavor = fmt.Sprintf("1.%d", request.ProtoMinor)
} else if request.ProtoMajor == 2 {
flavor = "2"
}
if flavor != "" {
attrs = append(attrs, sc.HTTPFlavorKey.String(flavor))
}
if request.Method != "" {
attrs = append(attrs, sc.HTTPMethodKey.String(request.Method))
} else {
attrs = append(attrs, sc.HTTPMethodKey.String(http.MethodGet))
}
return attrs
}
// HTTPServerMetricAttributesFromHTTPRequest generates low-cardinality attributes
// to be used with server-side HTTP metrics.
func (sc *SemanticConventions) HTTPServerMetricAttributesFromHTTPRequest(serverName string, request *http.Request) []attribute.KeyValue {
attrs := []attribute.KeyValue{}
if serverName != "" {
attrs = append(attrs, sc.HTTPServerNameKey.String(serverName))
}
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 (sc *SemanticConventions) HTTPServerAttributesFromHTTPRequest(serverName, route string, request *http.Request) []attribute.KeyValue {
attrs := []attribute.KeyValue{
sc.HTTPTargetKey.String(request.RequestURI),
}
if serverName != "" {
attrs = append(attrs, sc.HTTPServerNameKey.String(serverName))
}
if 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, sc.HTTPClientIPKey.String(addresses[0]))
}
}
return append(attrs, sc.httpCommonAttributesFromHTTPRequest(request)...)
}
// HTTPAttributesFromHTTPStatusCode generates attributes of the http
// namespace as specified by the OpenTelemetry specification for a
// span.
func (sc *SemanticConventions) HTTPAttributesFromHTTPStatusCode(code int) []attribute.KeyValue {
attrs := []attribute.KeyValue{
sc.HTTPStatusCodeKey.Int(code),
}
return attrs
}
type codeRange struct {
fromInclusive int
toInclusive int
}
func (r codeRange) contains(code int) bool {
return r.fromInclusive <= code && code <= r.toInclusive
}
var validRangesPerCategory = map[int][]codeRange{
1: {
{http.StatusContinue, http.StatusEarlyHints},
},
2: {
{http.StatusOK, http.StatusAlreadyReported},
{http.StatusIMUsed, http.StatusIMUsed},
},
3: {
{http.StatusMultipleChoices, http.StatusUseProxy},
{http.StatusTemporaryRedirect, http.StatusPermanentRedirect},
},
4: {
{http.StatusBadRequest, http.StatusTeapot}, // yes, teapot is so useful…
{http.StatusMisdirectedRequest, http.StatusUpgradeRequired},
{http.StatusPreconditionRequired, http.StatusTooManyRequests},
{http.StatusRequestHeaderFieldsTooLarge, http.StatusRequestHeaderFieldsTooLarge},
{http.StatusUnavailableForLegalReasons, http.StatusUnavailableForLegalReasons},
},
5: {
{http.StatusInternalServerError, http.StatusLoopDetected},
{http.StatusNotExtended, http.StatusNetworkAuthenticationRequired},
},
}
// SpanStatusFromHTTPStatusCode generates a status code and a message
// as specified by the OpenTelemetry specification for a span.
func SpanStatusFromHTTPStatusCode(code int) (codes.Code, string) {
spanCode, valid := validateHTTPStatusCode(code)
if !valid {
return spanCode, fmt.Sprintf("Invalid HTTP status code %d", code)
}
return spanCode, ""
}
// 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) {
spanCode, valid := validateHTTPStatusCode(code)
if !valid {
return spanCode, fmt.Sprintf("Invalid HTTP status code %d", code)
}
category := code / 100
if spanKind == trace.SpanKindServer && category == 4 {
return codes.Unset, ""
}
return spanCode, ""
}
// 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]
if !ok {
return codes.Error, false
}
ok = false
for _, crange := range ranges {
ok = crange.contains(code)
if ok {
break
}
}
if !ok {
return codes.Error, false
}
if category > 0 && category < 4 {
return codes.Unset, true
}
return codes.Error, true
}

View File

@ -1,257 +0,0 @@
// 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"
import "go.opentelemetry.io/otel/attribute"
// Semantic conventions for service resource attribute keys.
const (
// Name of the service.
ServiceNameKey = attribute.Key("service.name")
// A namespace for `service.name`. This needs to have meaning that helps
// to distinguish a group of services. For example, the team name that
// owns a group of services. `service.name` is expected to be unique
// within the same namespace.
ServiceNamespaceKey = attribute.Key("service.namespace")
// A unique identifier of the service instance. In conjunction with the
// `service.name` and `service.namespace` this must be unique.
ServiceInstanceIDKey = attribute.Key("service.instance.id")
// The version of the service API.
ServiceVersionKey = attribute.Key("service.version")
)
// Semantic conventions for telemetry SDK resource attribute keys.
const (
// The name of the telemetry SDK.
//
// The default OpenTelemetry SDK provided by the OpenTelemetry project
// MUST set telemetry.sdk.name to the value `opentelemetry`.
//
// If another SDK is used, this attribute MUST be set to the import path
// of that SDK's package.
//
// The value `opentelemetry` is reserved and MUST NOT be used by
// non-OpenTelemetry SDKs.
TelemetrySDKNameKey = attribute.Key("telemetry.sdk.name")
// The language of the telemetry SDK.
TelemetrySDKLanguageKey = attribute.Key("telemetry.sdk.language")
// The version string of the telemetry SDK.
TelemetrySDKVersionKey = attribute.Key("telemetry.sdk.version")
)
// Semantic conventions for telemetry SDK resource attributes.
var (
TelemetrySDKLanguageGo = TelemetrySDKLanguageKey.String("go")
)
// Semantic conventions for container resource attribute keys.
const (
// A uniquely identifying name for the Container.
ContainerNameKey = attribute.Key("container.name")
// Container ID, usually a UUID, as for example used to
// identify Docker containers. The UUID might be abbreviated.
ContainerIDKey = attribute.Key("container.id")
// Name of the image the container was built on.
ContainerImageNameKey = attribute.Key("container.image.name")
// Container image tag.
ContainerImageTagKey = attribute.Key("container.image.tag")
)
// Semantic conventions for Function-as-a-Service resource attribute keys.
const (
// A uniquely identifying name for the FaaS.
FaaSNameKey = attribute.Key("faas.name")
// The unique name of the function being executed.
FaaSIDKey = attribute.Key("faas.id")
// The version of the function being executed.
FaaSVersionKey = attribute.Key("faas.version")
// The execution environment identifier.
FaaSInstanceKey = attribute.Key("faas.instance")
)
// Semantic conventions for operating system process resource attribute keys.
const (
// Process identifier (PID).
ProcessPIDKey = attribute.Key("process.pid")
// The name of the process executable. On Linux based systems, can be
// set to the `Name` in `proc/[pid]/status`. On Windows, can be set to
// the base name of `GetProcessImageFileNameW`.
ProcessExecutableNameKey = attribute.Key("process.executable.name")
// The full path to the process executable. On Linux based systems, can
// be set to the target of `proc/[pid]/exe`. On Windows, can be set to
// the result of `GetProcessImageFileNameW`.
ProcessExecutablePathKey = attribute.Key("process.executable.path")
// The command used to launch the process (i.e. the command name). On
// Linux based systems, can be set to the zeroth string in
// `proc/[pid]/cmdline`. On Windows, can be set to the first parameter
// extracted from `GetCommandLineW`.
ProcessCommandKey = attribute.Key("process.command")
// The full command used to launch the process. The value can be either
// a list of strings representing the ordered list of arguments, or a
// single string representing the full command. On Linux based systems,
// can be set to the list of null-delimited strings extracted from
// `proc/[pid]/cmdline`. On Windows, can be set to the result of
// `GetCommandLineW`.
ProcessCommandLineKey = attribute.Key("process.command_line")
// All the command arguments (including the command/executable itself)
// as received by the process. On Linux-based systems (and some other
// Unixoid systems supporting procfs), can be set according to the list
// of null-delimited strings extracted from `proc/[pid]/cmdline`. For
// libc-based executables, this would be the full argv vector passed to
// `main`.
ProcessCommandArgsKey = attribute.Key("process.command_args")
// The username of the user that owns the process.
ProcessOwnerKey = attribute.Key("process.owner")
// The name of the runtime of this process. For compiled native
// binaries, this SHOULD be the name of the compiler.
ProcessRuntimeNameKey = attribute.Key("process.runtime.name")
// The version of the runtime of this process, as returned by the
// runtime without modification.
ProcessRuntimeVersionKey = attribute.Key("process.runtime.version")
// An additional description about the runtime of the process, for
// example a specific vendor customization of the runtime environment.
ProcessRuntimeDescriptionKey = attribute.Key("process.runtime.description")
)
// Semantic conventions for Kubernetes resource attribute keys.
const (
// A uniquely identifying name for the Kubernetes cluster. Kubernetes
// does not have cluster names as an internal concept so this may be
// set to any meaningful value within the environment. For example,
// GKE clusters have a name which can be used for this attribute.
K8SClusterNameKey = attribute.Key("k8s.cluster.name")
// The name of the Node.
K8SNodeNameKey = attribute.Key("k8s.node.name")
// The UID of the Node.
K8SNodeUIDKey = attribute.Key("k8s.node.uid")
// The name of the namespace that the pod is running in.
K8SNamespaceNameKey = attribute.Key("k8s.namespace.name")
// The uid of the Pod.
K8SPodUIDKey = attribute.Key("k8s.pod.uid")
// The name of the pod.
K8SPodNameKey = attribute.Key("k8s.pod.name")
// The name of the Container in a Pod template.
K8SContainerNameKey = attribute.Key("k8s.container.name")
// The uid of the ReplicaSet.
K8SReplicaSetUIDKey = attribute.Key("k8s.replicaset.uid")
// The name of the ReplicaSet.
K8SReplicaSetNameKey = attribute.Key("k8s.replicaset.name")
// The uid of the Deployment.
K8SDeploymentUIDKey = attribute.Key("k8s.deployment.uid")
// The name of the deployment.
K8SDeploymentNameKey = attribute.Key("k8s.deployment.name")
// The uid of the StatefulSet.
K8SStatefulSetUIDKey = attribute.Key("k8s.statefulset.uid")
// The name of the StatefulSet.
K8SStatefulSetNameKey = attribute.Key("k8s.statefulset.name")
// The uid of the DaemonSet.
K8SDaemonSetUIDKey = attribute.Key("k8s.daemonset.uid")
// The name of the DaemonSet.
K8SDaemonSetNameKey = attribute.Key("k8s.daemonset.name")
// The uid of the Job.
K8SJobUIDKey = attribute.Key("k8s.job.uid")
// The name of the Job.
K8SJobNameKey = attribute.Key("k8s.job.name")
// The uid of the CronJob.
K8SCronJobUIDKey = attribute.Key("k8s.cronjob.uid")
// The name of the CronJob.
K8SCronJobNameKey = attribute.Key("k8s.cronjob.name")
)
// Semantic conventions for OS resource attribute keys.
const (
// The operating system type.
OSTypeKey = attribute.Key("os.type")
// Human readable (not intended to be parsed) OS version information.
OSDescriptionKey = attribute.Key("os.description")
)
// Semantic conventions for host resource attribute keys.
const (
// A uniquely identifying name for the host: 'hostname', FQDN, or user specified name
HostNameKey = attribute.Key("host.name")
// Unique host ID. For cloud environments this will be the instance ID.
HostIDKey = attribute.Key("host.id")
// Type of host. For cloud environments this will be the machine type.
HostTypeKey = attribute.Key("host.type")
// Name of the OS or VM image the host is running.
HostImageNameKey = attribute.Key("host.image.name")
// Identifier of the image the host is running.
HostImageIDKey = attribute.Key("host.image.id")
// Version of the image the host is running.
HostImageVersionKey = attribute.Key("host.image.version")
)
// Semantic conventions for cloud environment resource attribute keys.
const (
// Name of the cloud provider.
CloudProviderKey = attribute.Key("cloud.provider")
// The account ID from the cloud provider used for authorization.
CloudAccountIDKey = attribute.Key("cloud.account.id")
// Geographical region where this resource is.
CloudRegionKey = attribute.Key("cloud.region")
// Zone of the region where this resource is.
CloudZoneKey = attribute.Key("cloud.zone")
)
// Semantic conventions for common cloud provider resource attributes.
var (
CloudProviderAWS = CloudProviderKey.String("aws")
CloudProviderAzure = CloudProviderKey.String("azure")
CloudProviderGCP = CloudProviderKey.String("gcp")
)
// Semantic conventions for deployment attributes.
const (
// Name of the deployment environment (aka deployment tier); e.g. (staging, production).
DeploymentEnvironmentKey = attribute.Key("deployment.environment")
)

View File

@ -1,376 +0,0 @@
// 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"
import "go.opentelemetry.io/otel/attribute"
// Semantic conventions for attribute keys used for network related
// operations.
const (
// Transport protocol used.
NetTransportKey = attribute.Key("net.transport")
// Remote address of the peer.
NetPeerIPKey = attribute.Key("net.peer.ip")
// Remote port number.
NetPeerPortKey = attribute.Key("net.peer.port")
// Remote hostname or similar.
NetPeerNameKey = attribute.Key("net.peer.name")
// Local host IP. Useful in case of a multi-IP host.
NetHostIPKey = attribute.Key("net.host.ip")
// Local host port.
NetHostPortKey = attribute.Key("net.host.port")
// Local hostname or similar.
NetHostNameKey = attribute.Key("net.host.name")
)
// Semantic conventions for common transport protocol attributes.
var (
NetTransportTCP = NetTransportKey.String("IP.TCP")
NetTransportUDP = NetTransportKey.String("IP.UDP")
NetTransportIP = NetTransportKey.String("IP")
NetTransportUnix = NetTransportKey.String("Unix")
NetTransportPipe = NetTransportKey.String("pipe")
NetTransportInProc = NetTransportKey.String("inproc")
NetTransportOther = NetTransportKey.String("other")
)
// General attribute keys for spans.
const (
// Service name of the remote service. Should equal the actual
// `service.name` resource attribute of the remote service, if any.
PeerServiceKey = attribute.Key("peer.service")
)
// Semantic conventions for attribute keys used to identify an authorized
// user.
const (
// Username or the client identifier extracted from the access token or
// authorization header in the inbound request from outside the system.
EnduserIDKey = attribute.Key("enduser.id")
// Actual or assumed role the client is making the request with.
EnduserRoleKey = attribute.Key("enduser.role")
// Scopes or granted authorities the client currently possesses.
EnduserScopeKey = attribute.Key("enduser.scope")
)
// Semantic conventions for attribute keys for HTTP.
const (
// HTTP request method.
HTTPMethodKey = attribute.Key("http.method")
// Full HTTP request URL in the form:
// scheme://host[:port]/path?query[#fragment].
HTTPURLKey = attribute.Key("http.url")
// The full request target as passed in a HTTP request line or
// equivalent, e.g. "/path/12314/?q=ddds#123".
HTTPTargetKey = attribute.Key("http.target")
// The value of the HTTP host header.
HTTPHostKey = attribute.Key("http.host")
// The URI scheme identifying the used protocol.
HTTPSchemeKey = attribute.Key("http.scheme")
// HTTP response status code.
HTTPStatusCodeKey = attribute.Key("http.status_code")
// Kind of HTTP protocol used.
HTTPFlavorKey = attribute.Key("http.flavor")
// Value of the HTTP User-Agent header sent by the client.
HTTPUserAgentKey = attribute.Key("http.user_agent")
// The primary server name of the matched virtual host.
HTTPServerNameKey = attribute.Key("http.server_name")
// The matched route served (path template). For example,
// "/users/:userID?".
HTTPRouteKey = attribute.Key("http.route")
// The IP address of the original client behind all proxies, if known
// (e.g. from X-Forwarded-For).
HTTPClientIPKey = attribute.Key("http.client_ip")
// The size of the request payload body in bytes.
HTTPRequestContentLengthKey = attribute.Key("http.request_content_length")
// The size of the uncompressed request payload body after transport decoding.
// Not set if transport encoding not used.
HTTPRequestContentLengthUncompressedKey = attribute.Key("http.request_content_length_uncompressed")
// The size of the response payload body in bytes.
HTTPResponseContentLengthKey = attribute.Key("http.response_content_length")
// The size of the uncompressed response payload body after transport decoding.
// Not set if transport encoding not used.
HTTPResponseContentLengthUncompressedKey = attribute.Key("http.response_content_length_uncompressed")
)
// Semantic conventions for common HTTP attributes.
var (
// Semantic conventions for HTTP(S) URI schemes.
HTTPSchemeHTTP = HTTPSchemeKey.String("http")
HTTPSchemeHTTPS = HTTPSchemeKey.String("https")
// Semantic conventions for HTTP protocols.
HTTPFlavor1_0 = HTTPFlavorKey.String("1.0")
HTTPFlavor1_1 = HTTPFlavorKey.String("1.1")
HTTPFlavor2 = HTTPFlavorKey.String("2")
HTTPFlavorSPDY = HTTPFlavorKey.String("SPDY")
HTTPFlavorQUIC = HTTPFlavorKey.String("QUIC")
)
// Semantic conventions for attribute keys for database connections.
const (
// Identifier for the database system (DBMS) being used.
DBSystemKey = attribute.Key("db.system")
// Database Connection String with embedded credentials removed.
DBConnectionStringKey = attribute.Key("db.connection_string")
// Username for accessing database.
DBUserKey = attribute.Key("db.user")
)
// Semantic conventions for common database system attributes.
var (
DBSystemDB2 = DBSystemKey.String("db2") // IBM DB2
DBSystemDerby = DBSystemKey.String("derby") // Apache Derby
DBSystemHive = DBSystemKey.String("hive") // Apache Hive
DBSystemMariaDB = DBSystemKey.String("mariadb") // MariaDB
DBSystemMSSql = DBSystemKey.String("mssql") // Microsoft SQL Server
DBSystemMySQL = DBSystemKey.String("mysql") // MySQL
DBSystemOracle = DBSystemKey.String("oracle") // Oracle Database
DBSystemPostgres = DBSystemKey.String("postgresql") // PostgreSQL
DBSystemSqlite = DBSystemKey.String("sqlite") // SQLite
DBSystemTeradata = DBSystemKey.String("teradata") // Teradata
DBSystemOtherSQL = DBSystemKey.String("other_sql") // Some other Sql database. Fallback only
DBSystemCassandra = DBSystemKey.String("cassandra") // Cassandra
DBSystemCosmosDB = DBSystemKey.String("cosmosdb") // Microsoft Azure CosmosDB
DBSystemCouchbase = DBSystemKey.String("couchbase") // Couchbase
DBSystemCouchDB = DBSystemKey.String("couchdb") // CouchDB
DBSystemDynamoDB = DBSystemKey.String("dynamodb") // Amazon DynamoDB
DBSystemHBase = DBSystemKey.String("hbase") // HBase
DBSystemMongodb = DBSystemKey.String("mongodb") // MongoDB
DBSystemNeo4j = DBSystemKey.String("neo4j") // Neo4j
DBSystemRedis = DBSystemKey.String("redis") // Redis
)
// Semantic conventions for attribute keys for database calls.
const (
// Database instance name.
DBNameKey = attribute.Key("db.name")
// A database statement for the given database type.
DBStatementKey = attribute.Key("db.statement")
// A database operation for the given database type.
DBOperationKey = attribute.Key("db.operation")
)
// Database technology-specific attributes
const (
// Name of the Cassandra keyspace accessed. Use instead of `db.name`.
DBCassandraKeyspaceKey = attribute.Key("db.cassandra.keyspace")
// HBase namespace accessed. Use instead of `db.name`.
DBHBaseNamespaceKey = attribute.Key("db.hbase.namespace")
// Index of Redis database accessed. Use instead of `db.name`.
DBRedisDBIndexKey = attribute.Key("db.redis.database_index")
// Collection being accessed within the database in `db.name`.
DBMongoDBCollectionKey = attribute.Key("db.mongodb.collection")
)
// Semantic conventions for attribute keys for RPC.
const (
// A string identifying the remoting system.
RPCSystemKey = attribute.Key("rpc.system")
// The full name of the service being called.
RPCServiceKey = attribute.Key("rpc.service")
// The name of the method being called.
RPCMethodKey = attribute.Key("rpc.method")
// Name of message transmitted or received.
RPCNameKey = attribute.Key("name")
// Type of message transmitted or received.
RPCMessageTypeKey = attribute.Key("message.type")
// Identifier of message transmitted or received.
RPCMessageIDKey = attribute.Key("message.id")
// The compressed size of the message transmitted or received in bytes.
RPCMessageCompressedSizeKey = attribute.Key("message.compressed_size")
// The uncompressed size of the message transmitted or received in
// bytes.
RPCMessageUncompressedSizeKey = attribute.Key("message.uncompressed_size")
)
// Semantic conventions for common RPC attributes.
var (
// Semantic convention for gRPC as the remoting system.
RPCSystemGRPC = RPCSystemKey.String("grpc")
// Semantic convention for a message named message.
RPCNameMessage = RPCNameKey.String("message")
// Semantic conventions for RPC message types.
RPCMessageTypeSent = RPCMessageTypeKey.String("SENT")
RPCMessageTypeReceived = RPCMessageTypeKey.String("RECEIVED")
)
// Semantic conventions for attribute keys for messaging systems.
const (
// A unique identifier describing the messaging system. For example,
// kafka, rabbitmq or activemq.
MessagingSystemKey = attribute.Key("messaging.system")
// The message destination name, e.g. MyQueue or MyTopic.
MessagingDestinationKey = attribute.Key("messaging.destination")
// The kind of message destination.
MessagingDestinationKindKey = attribute.Key("messaging.destination_kind")
// Describes if the destination is temporary or not.
MessagingTempDestinationKey = attribute.Key("messaging.temp_destination")
// The name of the transport protocol.
MessagingProtocolKey = attribute.Key("messaging.protocol")
// The version of the transport protocol.
MessagingProtocolVersionKey = attribute.Key("messaging.protocol_version")
// Messaging service URL.
MessagingURLKey = attribute.Key("messaging.url")
// Identifier used by the messaging system for a message.
MessagingMessageIDKey = attribute.Key("messaging.message_id")
// Identifier used by the messaging system for a conversation.
MessagingConversationIDKey = attribute.Key("messaging.conversation_id")
// The (uncompressed) size of the message payload in bytes.
MessagingMessagePayloadSizeBytesKey = attribute.Key("messaging.message_payload_size_bytes")
// The compressed size of the message payload in bytes.
MessagingMessagePayloadCompressedSizeBytesKey = attribute.Key("messaging.message_payload_compressed_size_bytes")
// Identifies which part and kind of message consumption is being
// preformed.
MessagingOperationKey = attribute.Key("messaging.operation")
// RabbitMQ specific attribute describing the destination routing key.
MessagingRabbitMQRoutingKeyKey = attribute.Key("messaging.rabbitmq.routing_key")
)
// Semantic conventions for common messaging system attributes.
var (
// Semantic conventions for message destinations.
MessagingDestinationKindKeyQueue = MessagingDestinationKindKey.String("queue")
MessagingDestinationKindKeyTopic = MessagingDestinationKindKey.String("topic")
// Semantic convention for message destinations that are temporary.
MessagingTempDestination = MessagingTempDestinationKey.Bool(true)
// Semantic convention for the operation parts of message consumption.
// This does not include a "send" attribute as that is explicitly not
// allowed in the OpenTelemetry specification.
MessagingOperationReceive = MessagingOperationKey.String("receive")
MessagingOperationProcess = MessagingOperationKey.String("process")
)
// Semantic conventions for attribute keys for FaaS systems.
const (
// Type of the trigger on which the function is executed.
FaaSTriggerKey = attribute.Key("faas.trigger")
// String containing the execution identifier of the function.
FaaSExecutionKey = attribute.Key("faas.execution")
// A boolean indicating that the serverless function is executed
// for the first time (aka cold start).
FaaSColdstartKey = attribute.Key("faas.coldstart")
// The name of the source on which the operation was performed.
// For example, in Cloud Storage or S3 corresponds to the bucket name,
// and in Cosmos DB to the database name.
FaaSDocumentCollectionKey = attribute.Key("faas.document.collection")
// The type of the operation that was performed on the data.
FaaSDocumentOperationKey = attribute.Key("faas.document.operation")
// A string containing the time when the data was accessed.
FaaSDocumentTimeKey = attribute.Key("faas.document.time")
// The document name/table subjected to the operation.
FaaSDocumentNameKey = attribute.Key("faas.document.name")
// The function invocation time.
FaaSTimeKey = attribute.Key("faas.time")
// The schedule period as Cron Expression.
FaaSCronKey = attribute.Key("faas.cron")
)
// Semantic conventions for common FaaS system attributes.
var (
// Semantic conventions for the types of triggers.
FaasTriggerDatasource = FaaSTriggerKey.String("datasource")
FaasTriggerHTTP = FaaSTriggerKey.String("http")
FaasTriggerPubSub = FaaSTriggerKey.String("pubsub")
FaasTriggerTimer = FaaSTriggerKey.String("timer")
FaasTriggerOther = FaaSTriggerKey.String("other")
// Semantic conventions for the types of operations performed.
FaaSDocumentOperationInsert = FaaSDocumentOperationKey.String("insert")
FaaSDocumentOperationEdit = FaaSDocumentOperationKey.String("edit")
FaaSDocumentOperationDelete = FaaSDocumentOperationKey.String("delete")
)
// Semantic conventions for source code attributes.
const (
// The method or function name, or equivalent (usually rightmost part of
// the code unit's name).
CodeFunctionKey = attribute.Key("code.function")
// The "namespace" within which `code.function` is defined. Usually the
// qualified class or module name, such that
// `code.namespace` + some separator + `code.function` form a unique
// identifier for the code unit.
CodeNamespaceKey = attribute.Key("code.namespace")
// The source code file name that identifies the code unit as uniquely as
// possible (preferably an absolute file path).
CodeFilepathKey = attribute.Key("code.filepath")
// The line number in `code.filepath` best representing the operation.
// It SHOULD point within the code unit named in `code.function`.
CodeLineNumberKey = attribute.Key("code.lineno")
)

View File

@ -14,11 +14,7 @@
// Package semconv implements OpenTelemetry semantic conventions.
//
// This package is currently in a pre-GA phase. Backwards incompatible changes
// may be introduced in subsequent minor version releases as we work to track
// the evolving OpenTelemetry specification and user feedback.
//
// OpenTelemetry semantic conventions are agreed standardized naming
// patterns for OpenTelemetry things. This package aims to be the
// centralized place to interact with these conventions.
package semconv // import "go.opentelemetry.io/otel/semconv"
// patterns for OpenTelemetry things. This package represents the conventions
// as of the v1.12.0 version of the OpenTelemetry specification.
package semconv // import "go.opentelemetry.io/otel/semconv/v1.12.0"

View File

@ -11,27 +11,8 @@
// 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/attribute"
// Semantic conventions for exception attribute keys.
const (
// The Go type containing the error or exception.
ExceptionTypeKey = attribute.Key("exception.type")
// The exception message.
ExceptionMessageKey = attribute.Key("exception.message")
// A stacktrace as a string. This most commonly will come from
// "runtime/debug".Stack.
ExceptionStacktraceKey = attribute.Key("exception.stacktrace")
// If the exception event is recorded at a point where it is known
// that the exception is escaping the scope of the span this
// attribute is set to true.
ExceptionEscapedKey = attribute.Key("exception.escaped")
)
package semconv // import "go.opentelemetry.io/otel/semconv/v1.12.0"
const (
// ExceptionEventName is the name of the Span event representing an exception.

114
vendor/go.opentelemetry.io/otel/semconv/v1.12.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.12.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)
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,20 @@
// 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.12.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/1.12.0"

1704
vendor/go.opentelemetry.io/otel/semconv/v1.12.0/trace.go generated vendored Normal file

File diff suppressed because it is too large Load Diff