build(deps): bump go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc

Bumps [go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc](https://github.com/open-telemetry/opentelemetry-go-contrib) from 0.65.0 to 0.67.0.
- [Release notes](https://github.com/open-telemetry/opentelemetry-go-contrib/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-go-contrib/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-go-contrib/compare/zpages/v0.65.0...zpages/v0.67.0)

---
updated-dependencies:
- dependency-name: go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc
  dependency-version: 0.67.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
dependabot[bot]
2026-03-13 14:45:22 +00:00
committed by Ralf Haferkamp
parent ea911e660a
commit 1623a5080c
17 changed files with 461 additions and 17645 deletions

4
go.mod
View File

@@ -95,7 +95,7 @@ require (
github.com/xhit/go-simple-mail/v2 v2.16.0
go-micro.dev/v4 v4.11.0
go.etcd.io/bbolt v1.4.3
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.65.0
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.67.0
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.67.0
go.opentelemetry.io/contrib/zpages v0.67.0
go.opentelemetry.io/otel v1.42.0
@@ -393,7 +393,7 @@ require (
golang.org/x/time v0.15.0 // indirect
golang.org/x/tools v0.41.0 // indirect
google.golang.org/genproto v0.0.0-20250303144028-a0af3efb3deb // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260209200024-4cfbd4190f57 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260226221140-a57be14db171 // indirect
gopkg.in/cenkalti/backoff.v1 v1.1.0 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect

8
go.sum
View File

@@ -1303,8 +1303,8 @@ go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0=
go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo=
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.65.0 h1:XmiuHzgJt067+a6kwyAzkhXooYVv3/TOw9cM2VfJgUM=
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.65.0/go.mod h1:KDgtbWKTQs4bM+VPUr6WlL9m/WXcmkCcBlIzqxPGzmI=
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.67.0 h1:yI1/OhfEPy7J9eoa6Sj051C7n5dvpj0QX8g4sRchg04=
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.67.0/go.mod h1:NoUCKYWK+3ecatC4HjkRktREheMeEtrXoQxrqYFeHSc=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.67.0 h1:OyrsyzuttWTSur2qN/Lm0m2a8yqyIjUVBZcxFPuXq2o=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.67.0/go.mod h1:C2NGBr+kAB4bk3xtMXfZ94gqFDtg/GkI7e9zqGh5Beg=
go.opentelemetry.io/contrib/zpages v0.67.0 h1:cIUwWSVDovuLEbDIKreptjdxMuIhGiqwq0uL8YNaq1c=
@@ -1720,8 +1720,8 @@ google.golang.org/genproto v0.0.0-20250303144028-a0af3efb3deb h1:ITgPrl429bc6+2Z
google.golang.org/genproto v0.0.0-20250303144028-a0af3efb3deb/go.mod h1:sAo5UzpjUwgFBCzupwhcLcxHVDK7vG5IqI30YnwX2eE=
google.golang.org/genproto/googleapis/api v0.0.0-20260209200024-4cfbd4190f57 h1:JLQynH/LBHfCTSbDWl+py8C+Rg/k1OVH3xfcaiANuF0=
google.golang.org/genproto/googleapis/api v0.0.0-20260209200024-4cfbd4190f57/go.mod h1:kSJwQxqmFXeo79zOmbrALdflXQeAYcUbgS7PbpMknCY=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260209200024-4cfbd4190f57 h1:mWPCjDEyshlQYzBpMNHaEof6UX1PmHcaUODUywQ0uac=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260209200024-4cfbd4190f57/go.mod h1:j9x/tPzZkyxcgEFkiKEEGxfvyumM01BEtsW8xzOahRQ=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260226221140-a57be14db171 h1:ggcbiqK8WWh6l1dnltU4BgWGIGo+EVYxCaAPih/zQXQ=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260226221140-a57be14db171/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8=
google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=

View File

@@ -36,6 +36,7 @@ type config struct {
Propagators propagation.TextMapPropagator
TracerProvider trace.TracerProvider
MeterProvider metric.MeterProvider
SpanKind trace.SpanKind
SpanStartOptions []trace.SpanStartOption
SpanAttributes []attribute.KeyValue
MetricAttributes []attribute.KeyValue
@@ -181,6 +182,18 @@ func WithSpanOptions(opts ...trace.SpanStartOption) Option {
})
}
// WithSpanKind returns an Option to set the span kind for spans created by
// the handler.
//
// By default, [NewServerHandler] creates spans with
// [trace.SpanKindServer] and [NewClientHandler] creates spans with
// [trace.SpanKindClient].
func WithSpanKind(sk trace.SpanKind) Option {
return optionFunc(func(c *config) {
c.SpanKind = sk
})
}
// WithSpanAttributes returns an Option to add custom attributes to the spans.
func WithSpanAttributes(a ...attribute.KeyValue) Option {
return optionFunc(func(c *config) {

View File

@@ -11,7 +11,7 @@ import (
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/codes"
semconv "go.opentelemetry.io/otel/semconv/v1.39.0"
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
grpc_codes "google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)

View File

@@ -8,7 +8,7 @@ import (
"strings"
"go.opentelemetry.io/otel/attribute"
semconv "go.opentelemetry.io/otel/semconv/v1.39.0"
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
)
// ParseFullMethod returns a span name following the OpenTelemetry semantic

View File

@@ -5,15 +5,15 @@ package otelgrpc // import "go.opentelemetry.io/contrib/instrumentation/google.g
import (
"context"
"sync/atomic"
"strconv"
"time"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/codes"
"go.opentelemetry.io/otel/metric"
semconv "go.opentelemetry.io/otel/semconv/v1.39.0"
"go.opentelemetry.io/otel/semconv/v1.39.0/rpcconv"
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
"go.opentelemetry.io/otel/semconv/v1.40.0/rpcconv"
"go.opentelemetry.io/otel/trace"
grpc_codes "google.golang.org/grpc/codes"
"google.golang.org/grpc/peer"
@@ -26,11 +26,8 @@ import (
type gRPCContextKey struct{}
type gRPCContext struct {
inMessages int64
outMessages int64
metricAttrs []attribute.KeyValue
metricAttrSet attribute.Set
record bool
metricAttrs []attribute.KeyValue
record bool
}
type serverHandler struct {
@@ -39,13 +36,15 @@ type serverHandler struct {
tracer trace.Tracer
duration rpcconv.ServerCallDuration
inSize int64Hist
outSize int64Hist
}
// NewServerHandler creates a stats.Handler for a gRPC server.
func NewServerHandler(opts ...Option) stats.Handler {
c := newConfig(opts)
if c.SpanKind == trace.SpanKindUnspecified {
c.SpanKind = trace.SpanKindServer
}
h := &serverHandler{config: c}
h.tracer = c.TracerProvider.Tracer(
@@ -60,17 +59,13 @@ func NewServerHandler(opts ...Option) stats.Handler {
)
var err error
h.duration, err = rpcconv.NewServerCallDuration(meter)
if err != nil {
otel.Handle(err)
}
h.inSize, err = rpcconv.NewServerRequestSize(meter)
if err != nil {
otel.Handle(err)
}
h.outSize, err = rpcconv.NewServerResponseSize(meter)
h.duration, err = rpcconv.NewServerCallDuration(
meter,
metric.WithExplicitBucketBoundaries(
0.005, 0.01, 0.025, 0.05, 0.075, 0.1,
0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10,
),
)
if err != nil {
otel.Handle(err)
}
@@ -104,7 +99,7 @@ func (h *serverHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) cont
spanAttributes := make([]attribute.KeyValue, 0, len(attrs)+len(h.SpanAttributes))
spanAttributes = append(append(spanAttributes, attrs...), h.SpanAttributes...)
opts := []trace.SpanStartOption{
trace.WithSpanKind(trace.SpanKindServer),
trace.WithSpanKind(h.SpanKind),
trace.WithAttributes(spanAttributes...),
}
if h.PublicEndpoint || (h.PublicEndpointFn != nil && h.PublicEndpointFn(ctx, info)) {
@@ -131,8 +126,6 @@ func (h *serverHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) cont
gctx.metricAttrs = append(gctx.metricAttrs, extraAttrs...)
}
gctx.metricAttrSet = attribute.NewSet(gctx.metricAttrs...)
return context.WithValue(ctx, gRPCContextKey{}, &gctx)
}
@@ -142,8 +135,6 @@ func (h *serverHandler) HandleRPC(ctx context.Context, rs stats.RPCStats) {
ctx,
rs,
h.duration.Inst(),
h.inSize,
h.outSize,
serverStatus,
)
}
@@ -154,13 +145,15 @@ type clientHandler struct {
tracer trace.Tracer
duration rpcconv.ClientCallDuration
inSize int64Hist
outSize int64Hist
}
// NewClientHandler creates a stats.Handler for a gRPC client.
func NewClientHandler(opts ...Option) stats.Handler {
c := newConfig(opts)
if c.SpanKind == trace.SpanKindUnspecified {
c.SpanKind = trace.SpanKindClient
}
h := &clientHandler{config: c}
h.tracer = c.TracerProvider.Tracer(
@@ -175,17 +168,13 @@ func NewClientHandler(opts ...Option) stats.Handler {
)
var err error
h.duration, err = rpcconv.NewClientCallDuration(meter)
if err != nil {
otel.Handle(err)
}
h.inSize, err = rpcconv.NewClientResponseSize(meter)
if err != nil {
otel.Handle(err)
}
h.outSize, err = rpcconv.NewClientRequestSize(meter)
h.duration, err = rpcconv.NewClientCallDuration(
meter,
metric.WithExplicitBucketBoundaries(
0.005, 0.01, 0.025, 0.05, 0.075, 0.1,
0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10,
),
)
if err != nil {
otel.Handle(err)
}
@@ -210,7 +199,7 @@ func (h *clientHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) cont
ctx, _ = h.tracer.Start(
ctx,
name,
trace.WithSpanKind(trace.SpanKindClient),
trace.WithSpanKind(h.SpanKind),
trace.WithAttributes(spanAttributes...),
)
}
@@ -225,8 +214,6 @@ func (h *clientHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) cont
gctx.metricAttrs = append(gctx.metricAttrs, extraAttrs...)
}
gctx.metricAttrSet = attribute.NewSet(gctx.metricAttrs...)
return inject(context.WithValue(ctx, gRPCContextKey{}, &gctx), h.Propagators)
}
@@ -236,8 +223,6 @@ func (h *clientHandler) HandleRPC(ctx context.Context, rs stats.RPCStats) {
ctx,
rs,
h.duration.Inst(),
h.inSize,
h.outSize,
func(s *status.Status) (codes.Code, string) {
return codes.Error, s.Message()
},
@@ -254,15 +239,10 @@ func (*clientHandler) HandleConn(context.Context, stats.ConnStats) {
// no-op
}
type int64Hist interface {
RecordSet(context.Context, int64, attribute.Set)
}
func (c *config) handleRPC(
func (*config) handleRPC(
ctx context.Context,
rs stats.RPCStats,
duration metric.Float64Histogram,
inSize, outSize int64Hist,
recordStatus func(*status.Status) (codes.Code, string),
) {
gctx, _ := ctx.Value(gRPCContextKey{}).(*gRPCContext)
@@ -271,42 +251,11 @@ func (c *config) handleRPC(
}
span := trace.SpanFromContext(ctx)
var messageId int64
switch rs := rs.(type) {
case *stats.Begin:
case *stats.InPayload:
if gctx != nil {
messageId = atomic.AddInt64(&gctx.inMessages, 1)
inSize.RecordSet(ctx, int64(rs.Length), gctx.metricAttrSet)
}
if c.ReceivedEvent && span.IsRecording() {
span.AddEvent("message",
trace.WithAttributes(
semconv.RPCMessageTypeReceived,
semconv.RPCMessageIDKey.Int64(messageId),
semconv.RPCMessageCompressedSizeKey.Int(rs.CompressedLength),
semconv.RPCMessageUncompressedSizeKey.Int(rs.Length),
),
)
}
case *stats.OutPayload:
if gctx != nil {
messageId = atomic.AddInt64(&gctx.outMessages, 1)
outSize.RecordSet(ctx, int64(rs.Length), gctx.metricAttrSet)
}
if c.SentEvent && span.IsRecording() {
span.AddEvent("message",
trace.WithAttributes(
semconv.RPCMessageTypeSent,
semconv.RPCMessageIDKey.Int64(messageId),
semconv.RPCMessageCompressedSizeKey.Int(rs.CompressedLength),
semconv.RPCMessageUncompressedSizeKey.Int(rs.Length),
),
)
}
case *stats.OutTrailer:
case *stats.OutHeader:
if span.IsRecording() {
@@ -320,9 +269,9 @@ func (c *config) handleRPC(
var s *status.Status
if rs.Error != nil {
s, _ = status.FromError(rs.Error)
rpcStatusAttr = semconv.RPCResponseStatusCode(s.Code().String())
rpcStatusAttr = semconv.RPCResponseStatusCode(canonicalString(s.Code()))
} else {
rpcStatusAttr = semconv.RPCResponseStatusCode(grpc_codes.OK.String())
rpcStatusAttr = semconv.RPCResponseStatusCode(canonicalString(grpc_codes.OK))
}
if span.IsRecording() {
if s != nil {
@@ -347,10 +296,51 @@ func (c *config) handleRPC(
// Use floating point division here for higher precision (instead of Millisecond method).
// Measure right before calling Record() to capture as much elapsed time as possible.
elapsedTime := float64(rs.EndTime.Sub(rs.BeginTime)) / float64(time.Millisecond)
elapsedTime := float64(rs.EndTime.Sub(rs.BeginTime)) / float64(time.Second)
duration.Record(ctx, elapsedTime, recordOpts...)
default:
return
}
}
func canonicalString(code grpc_codes.Code) string {
switch code {
case grpc_codes.OK:
return "OK"
case grpc_codes.Canceled:
return "CANCELLED"
case grpc_codes.Unknown:
return "UNKNOWN"
case grpc_codes.InvalidArgument:
return "INVALID_ARGUMENT"
case grpc_codes.DeadlineExceeded:
return "DEADLINE_EXCEEDED"
case grpc_codes.NotFound:
return "NOT_FOUND"
case grpc_codes.AlreadyExists:
return "ALREADY_EXISTS"
case grpc_codes.PermissionDenied:
return "PERMISSION_DENIED"
case grpc_codes.ResourceExhausted:
return "RESOURCE_EXHAUSTED"
case grpc_codes.FailedPrecondition:
return "FAILED_PRECONDITION"
case grpc_codes.Aborted:
return "ABORTED"
case grpc_codes.OutOfRange:
return "OUT_OF_RANGE"
case grpc_codes.Unimplemented:
return "UNIMPLEMENTED"
case grpc_codes.Internal:
return "INTERNAL"
case grpc_codes.Unavailable:
return "UNAVAILABLE"
case grpc_codes.DataLoss:
return "DATA_LOSS"
case grpc_codes.Unauthenticated:
return "UNAUTHENTICATED"
default:
return "CODE(" + strconv.FormatInt(int64(code), 10) + ")"
}
}

View File

@@ -4,4 +4,4 @@
package otelgrpc // import "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
// Version is the current release version of the gRPC instrumentation.
const Version = "0.65.0"
const Version = "0.67.0"

View File

@@ -1,78 +0,0 @@
<!-- Generated. DO NOT MODIFY. -->
# Migration from v1.38.0 to v1.39.0
The `go.opentelemetry.io/otel/semconv/v1.39.0` package should be a drop-in replacement for `go.opentelemetry.io/otel/semconv/v1.38.0` with the following exceptions.
## Removed
The following declarations have been removed.
Refer to the [OpenTelemetry Semantic Conventions documentation] for deprecation instructions.
If the type is not listed in the documentation as deprecated, it has been removed in this version due to lack of applicability or use.
If you use any of these non-deprecated declarations in your Go application, please [open an issue] describing your use-case.
- `LinuxMemorySlabStateKey`
- `LinuxMemorySlabStateReclaimable`
- `LinuxMemorySlabStateUnreclaimable`
- `PeerService`
- `PeerServiceKey`
- `RPCConnectRPCErrorCodeAborted`
- `RPCConnectRPCErrorCodeAlreadyExists`
- `RPCConnectRPCErrorCodeCancelled`
- `RPCConnectRPCErrorCodeDataLoss`
- `RPCConnectRPCErrorCodeDeadlineExceeded`
- `RPCConnectRPCErrorCodeFailedPrecondition`
- `RPCConnectRPCErrorCodeInternal`
- `RPCConnectRPCErrorCodeInvalidArgument`
- `RPCConnectRPCErrorCodeKey`
- `RPCConnectRPCErrorCodeNotFound`
- `RPCConnectRPCErrorCodeOutOfRange`
- `RPCConnectRPCErrorCodePermissionDenied`
- `RPCConnectRPCErrorCodeResourceExhausted`
- `RPCConnectRPCErrorCodeUnauthenticated`
- `RPCConnectRPCErrorCodeUnavailable`
- `RPCConnectRPCErrorCodeUnimplemented`
- `RPCConnectRPCErrorCodeUnknown`
- `RPCConnectRPCRequestMetadata`
- `RPCConnectRPCResponseMetadata`
- `RPCGRPCRequestMetadata`
- `RPCGRPCResponseMetadata`
- `RPCGRPCStatusCodeAborted`
- `RPCGRPCStatusCodeAlreadyExists`
- `RPCGRPCStatusCodeCancelled`
- `RPCGRPCStatusCodeDataLoss`
- `RPCGRPCStatusCodeDeadlineExceeded`
- `RPCGRPCStatusCodeFailedPrecondition`
- `RPCGRPCStatusCodeInternal`
- `RPCGRPCStatusCodeInvalidArgument`
- `RPCGRPCStatusCodeKey`
- `RPCGRPCStatusCodeNotFound`
- `RPCGRPCStatusCodeOk`
- `RPCGRPCStatusCodeOutOfRange`
- `RPCGRPCStatusCodePermissionDenied`
- `RPCGRPCStatusCodeResourceExhausted`
- `RPCGRPCStatusCodeUnauthenticated`
- `RPCGRPCStatusCodeUnavailable`
- `RPCGRPCStatusCodeUnimplemented`
- `RPCGRPCStatusCodeUnknown`
- `RPCJSONRPCErrorCode`
- `RPCJSONRPCErrorCodeKey`
- `RPCJSONRPCErrorMessage`
- `RPCJSONRPCErrorMessageKey`
- `RPCJSONRPCRequestID`
- `RPCJSONRPCRequestIDKey`
- `RPCJSONRPCVersion`
- `RPCJSONRPCVersionKey`
- `RPCService`
- `RPCServiceKey`
- `RPCSystemApacheDubbo`
- `RPCSystemConnectRPC`
- `RPCSystemDotnetWcf`
- `RPCSystemGRPC`
- `RPCSystemJSONRPC`
- `RPCSystemJavaRmi`
- `RPCSystemKey`
- `RPCSystemOncRPC`
[OpenTelemetry Semantic Conventions documentation]: https://github.com/open-telemetry/semantic-conventions
[open an issue]: https://github.com/open-telemetry/opentelemetry-go/issues/new?template=Blank+issue

View File

@@ -1,3 +0,0 @@
# Semconv v1.39.0
[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/semconv/v1.39.0)](https://pkg.go.dev/go.opentelemetry.io/otel/semconv/v1.39.0)

View File

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +0,0 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
// Package semconv implements OpenTelemetry semantic conventions.
//
// OpenTelemetry semantic conventions are agreed standardized naming
// patterns for OpenTelemetry things. This package represents the v1.39.0
// version of the OpenTelemetry semantic conventions.
package semconv // import "go.opentelemetry.io/otel/semconv/v1.39.0"

View File

@@ -1,56 +0,0 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
package semconv // import "go.opentelemetry.io/otel/semconv/v1.39.0"
import (
"reflect"
"go.opentelemetry.io/otel/attribute"
)
// ErrorType returns an [attribute.KeyValue] identifying the error type of err.
//
// If err is nil, the returned attribute has the default value
// [ErrorTypeOther].
//
// If err's type has the method
//
// ErrorType() string
//
// then the returned attribute has the value of err.ErrorType(). Otherwise, the
// returned attribute has a value derived from the concrete type of err.
//
// The key of the returned attribute is [ErrorTypeKey].
func ErrorType(err error) attribute.KeyValue {
if err == nil {
return ErrorTypeOther
}
return ErrorTypeKey.String(errorType(err))
}
func errorType(err error) string {
var s string
if et, ok := err.(interface{ ErrorType() string }); ok {
// Prioritize the ErrorType method if available.
s = et.ErrorType()
}
if s == "" {
// Fallback to reflection if the ErrorType method is not supported or
// returns an empty value.
t := reflect.TypeOf(err)
pkg, name := t.PkgPath(), t.Name()
if pkg != "" && name != "" {
s = pkg + "." + name
} else {
// The type has no package path or name (predeclared, not-defined,
// or alias for a not-defined type).
//
// This is not guaranteed to be unique, but is a best effort.
s = t.String()
}
}
return s
}

View File

@@ -1,9 +0,0 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
package semconv // import "go.opentelemetry.io/otel/semconv/v1.39.0"
const (
// ExceptionEventName is the name of the Span event representing an exception.
ExceptionEventName = "exception"
)

View File

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +0,0 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
package semconv // import "go.opentelemetry.io/otel/semconv/v1.39.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.39.0"

View File

@@ -0,0 +1,360 @@
// Code generated from semantic convention specification. DO NOT EDIT.
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
// Package rpcconv provides types and functionality for OpenTelemetry semantic
// conventions in the "rpc" namespace.
package rpcconv
import (
"context"
"sync"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/metric"
"go.opentelemetry.io/otel/metric/noop"
)
var (
addOptPool = &sync.Pool{New: func() any { return &[]metric.AddOption{} }}
recOptPool = &sync.Pool{New: func() any { return &[]metric.RecordOption{} }}
)
// ErrorTypeAttr is an attribute conforming to the error.type semantic
// conventions. It represents the describes a class of error the operation ended
// with.
type ErrorTypeAttr string
var (
// ErrorTypeOther is a fallback error value to be used when the instrumentation
// doesn't define a custom value.
ErrorTypeOther ErrorTypeAttr = "_OTHER"
)
// SystemNameAttr is an attribute conforming to the rpc.system.name semantic
// conventions. It represents the Remote Procedure Call (RPC) system.
type SystemNameAttr string
var (
// SystemNameGRPC is the [gRPC].
//
// [gRPC]: https://grpc.io/
SystemNameGRPC SystemNameAttr = "grpc"
// SystemNameDubbo is the [Apache Dubbo].
//
// [Apache Dubbo]: https://dubbo.apache.org/
SystemNameDubbo SystemNameAttr = "dubbo"
// SystemNameConnectrpc is the [Connect RPC].
//
// [Connect RPC]: https://connectrpc.com/
SystemNameConnectrpc SystemNameAttr = "connectrpc"
// SystemNameJSONRPC is the [JSON-RPC].
//
// [JSON-RPC]: https://www.jsonrpc.org/
SystemNameJSONRPC SystemNameAttr = "jsonrpc"
)
// ClientCallDuration is an instrument used to record metric values conforming to
// the "rpc.client.call.duration" semantic conventions. It represents the
// measures the duration of an outgoing Remote Procedure Call (RPC).
type ClientCallDuration struct {
metric.Float64Histogram
}
var newClientCallDurationOpts = []metric.Float64HistogramOption{
metric.WithDescription("Measures the duration of an outgoing Remote Procedure Call (RPC)."),
metric.WithUnit("s"),
}
// NewClientCallDuration returns a new ClientCallDuration instrument.
func NewClientCallDuration(
m metric.Meter,
opt ...metric.Float64HistogramOption,
) (ClientCallDuration, error) {
// Check if the meter is nil.
if m == nil {
return ClientCallDuration{noop.Float64Histogram{}}, nil
}
if len(opt) == 0 {
opt = newClientCallDurationOpts
} else {
opt = append(opt, newClientCallDurationOpts...)
}
i, err := m.Float64Histogram(
"rpc.client.call.duration",
opt...,
)
if err != nil {
return ClientCallDuration{noop.Float64Histogram{}}, err
}
return ClientCallDuration{i}, nil
}
// Inst returns the underlying metric instrument.
func (m ClientCallDuration) Inst() metric.Float64Histogram {
return m.Float64Histogram
}
// Name returns the semantic convention name of the instrument.
func (ClientCallDuration) Name() string {
return "rpc.client.call.duration"
}
// Unit returns the semantic convention unit of the instrument
func (ClientCallDuration) Unit() string {
return "s"
}
// Description returns the semantic convention description of the instrument
func (ClientCallDuration) Description() string {
return "Measures the duration of an outgoing Remote Procedure Call (RPC)."
}
// Record records val to the current distribution for attrs.
//
// The systemName is the the Remote Procedure Call (RPC) system.
//
// All additional attrs passed are included in the recorded value.
//
// When this metric is reported alongside an RPC client span, the metric value
// SHOULD be the same as the RPC client span duration.
func (m ClientCallDuration) Record(
ctx context.Context,
val float64,
systemName SystemNameAttr,
attrs ...attribute.KeyValue,
) {
if len(attrs) == 0 {
m.Float64Histogram.Record(ctx, val, metric.WithAttributes(
attribute.String("rpc.system.name", string(systemName)),
))
return
}
o := recOptPool.Get().(*[]metric.RecordOption)
defer func() {
*o = (*o)[:0]
recOptPool.Put(o)
}()
*o = append(
*o,
metric.WithAttributes(
append(
attrs[:len(attrs):len(attrs)],
attribute.String("rpc.system.name", string(systemName)),
)...,
),
)
m.Float64Histogram.Record(ctx, val, *o...)
}
// RecordSet records val to the current distribution for set.
//
// When this metric is reported alongside an RPC client span, the metric value
// SHOULD be the same as the RPC client span duration.
func (m ClientCallDuration) RecordSet(ctx context.Context, val float64, set attribute.Set) {
if set.Len() == 0 {
m.Float64Histogram.Record(ctx, val)
return
}
o := recOptPool.Get().(*[]metric.RecordOption)
defer func() {
*o = (*o)[:0]
recOptPool.Put(o)
}()
*o = append(*o, metric.WithAttributeSet(set))
m.Float64Histogram.Record(ctx, val, *o...)
}
// AttrErrorType returns an optional attribute for the "error.type" semantic
// convention. It represents the describes a class of error the operation ended
// with.
func (ClientCallDuration) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue {
return attribute.String("error.type", string(val))
}
// AttrMethod returns an optional attribute for the "rpc.method" semantic
// convention. It represents the fully-qualified logical name of the method from
// the RPC interface perspective.
func (ClientCallDuration) AttrMethod(val string) attribute.KeyValue {
return attribute.String("rpc.method", val)
}
// AttrResponseStatusCode returns an optional attribute for the
// "rpc.response.status_code" semantic convention. It represents the status code
// of the RPC returned by the RPC server or generated by the client.
func (ClientCallDuration) AttrResponseStatusCode(val string) attribute.KeyValue {
return attribute.String("rpc.response.status_code", val)
}
// AttrServerAddress returns an optional attribute for the "server.address"
// semantic convention. It represents a string identifying a group of RPC server
// instances request is sent to.
func (ClientCallDuration) AttrServerAddress(val string) attribute.KeyValue {
return attribute.String("server.address", val)
}
// AttrServerPort returns an optional attribute for the "server.port" semantic
// convention. It represents the server port number.
func (ClientCallDuration) AttrServerPort(val int) attribute.KeyValue {
return attribute.Int("server.port", val)
}
// ServerCallDuration is an instrument used to record metric values conforming to
// the "rpc.server.call.duration" semantic conventions. It represents the
// measures the duration of an incoming Remote Procedure Call (RPC).
type ServerCallDuration struct {
metric.Float64Histogram
}
var newServerCallDurationOpts = []metric.Float64HistogramOption{
metric.WithDescription("Measures the duration of an incoming Remote Procedure Call (RPC)."),
metric.WithUnit("s"),
}
// NewServerCallDuration returns a new ServerCallDuration instrument.
func NewServerCallDuration(
m metric.Meter,
opt ...metric.Float64HistogramOption,
) (ServerCallDuration, error) {
// Check if the meter is nil.
if m == nil {
return ServerCallDuration{noop.Float64Histogram{}}, nil
}
if len(opt) == 0 {
opt = newServerCallDurationOpts
} else {
opt = append(opt, newServerCallDurationOpts...)
}
i, err := m.Float64Histogram(
"rpc.server.call.duration",
opt...,
)
if err != nil {
return ServerCallDuration{noop.Float64Histogram{}}, err
}
return ServerCallDuration{i}, nil
}
// Inst returns the underlying metric instrument.
func (m ServerCallDuration) Inst() metric.Float64Histogram {
return m.Float64Histogram
}
// Name returns the semantic convention name of the instrument.
func (ServerCallDuration) Name() string {
return "rpc.server.call.duration"
}
// Unit returns the semantic convention unit of the instrument
func (ServerCallDuration) Unit() string {
return "s"
}
// Description returns the semantic convention description of the instrument
func (ServerCallDuration) Description() string {
return "Measures the duration of an incoming Remote Procedure Call (RPC)."
}
// Record records val to the current distribution for attrs.
//
// The systemName is the the Remote Procedure Call (RPC) system.
//
// All additional attrs passed are included in the recorded value.
//
// When this metric is reported alongside an RPC server span, the metric value
// SHOULD be the same as the RPC server span duration.
func (m ServerCallDuration) Record(
ctx context.Context,
val float64,
systemName SystemNameAttr,
attrs ...attribute.KeyValue,
) {
if len(attrs) == 0 {
m.Float64Histogram.Record(ctx, val, metric.WithAttributes(
attribute.String("rpc.system.name", string(systemName)),
))
return
}
o := recOptPool.Get().(*[]metric.RecordOption)
defer func() {
*o = (*o)[:0]
recOptPool.Put(o)
}()
*o = append(
*o,
metric.WithAttributes(
append(
attrs[:len(attrs):len(attrs)],
attribute.String("rpc.system.name", string(systemName)),
)...,
),
)
m.Float64Histogram.Record(ctx, val, *o...)
}
// RecordSet records val to the current distribution for set.
//
// When this metric is reported alongside an RPC server span, the metric value
// SHOULD be the same as the RPC server span duration.
func (m ServerCallDuration) RecordSet(ctx context.Context, val float64, set attribute.Set) {
if set.Len() == 0 {
m.Float64Histogram.Record(ctx, val)
return
}
o := recOptPool.Get().(*[]metric.RecordOption)
defer func() {
*o = (*o)[:0]
recOptPool.Put(o)
}()
*o = append(*o, metric.WithAttributeSet(set))
m.Float64Histogram.Record(ctx, val, *o...)
}
// AttrErrorType returns an optional attribute for the "error.type" semantic
// convention. It represents the describes a class of error the operation ended
// with.
func (ServerCallDuration) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue {
return attribute.String("error.type", string(val))
}
// AttrMethod returns an optional attribute for the "rpc.method" semantic
// convention. It represents the fully-qualified logical name of the method from
// the RPC interface perspective.
func (ServerCallDuration) AttrMethod(val string) attribute.KeyValue {
return attribute.String("rpc.method", val)
}
// AttrResponseStatusCode returns an optional attribute for the
// "rpc.response.status_code" semantic convention. It represents the status code
// of the RPC returned by the RPC server or generated by the client.
func (ServerCallDuration) AttrResponseStatusCode(val string) attribute.KeyValue {
return attribute.String("rpc.response.status_code", val)
}
// AttrServerAddress returns an optional attribute for the "server.address"
// semantic convention. It represents a string identifying a group of RPC server
// instances request is sent to.
func (ServerCallDuration) AttrServerAddress(val string) attribute.KeyValue {
return attribute.String("server.address", val)
}
// AttrServerPort returns an optional attribute for the "server.port" semantic
// convention. It represents the server port number.
func (ServerCallDuration) AttrServerPort(val int) attribute.KeyValue {
return attribute.Int("server.port", val)
}

11
vendor/modules.txt vendored
View File

@@ -2308,8 +2308,8 @@ go.opencensus.io/trace/tracestate
## explicit; go 1.24.0
go.opentelemetry.io/auto/sdk
go.opentelemetry.io/auto/sdk/internal/telemetry
# go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.65.0
## explicit; go 1.24.0
# go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.67.0
## explicit; go 1.25.0
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/internal
# go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.67.0
@@ -2337,11 +2337,10 @@ go.opentelemetry.io/otel/semconv/internal/v4
go.opentelemetry.io/otel/semconv/v1.20.0
go.opentelemetry.io/otel/semconv/v1.20.0/httpconv
go.opentelemetry.io/otel/semconv/v1.37.0
go.opentelemetry.io/otel/semconv/v1.39.0
go.opentelemetry.io/otel/semconv/v1.39.0/rpcconv
go.opentelemetry.io/otel/semconv/v1.40.0
go.opentelemetry.io/otel/semconv/v1.40.0/httpconv
go.opentelemetry.io/otel/semconv/v1.40.0/otelconv
go.opentelemetry.io/otel/semconv/v1.40.0/rpcconv
# go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.42.0
## explicit; go 1.25.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace
@@ -2579,8 +2578,8 @@ google.golang.org/genproto/protobuf/field_mask
google.golang.org/genproto/googleapis/api
google.golang.org/genproto/googleapis/api/annotations
google.golang.org/genproto/googleapis/api/httpbody
# google.golang.org/genproto/googleapis/rpc v0.0.0-20260209200024-4cfbd4190f57
## explicit; go 1.24.0
# google.golang.org/genproto/googleapis/rpc v0.0.0-20260226221140-a57be14db171
## explicit; go 1.25.0
google.golang.org/genproto/googleapis/rpc/errdetails
google.golang.org/genproto/googleapis/rpc/status
# google.golang.org/grpc v1.79.2