Compare commits

..

No commits in common. "v3" and "v3.10.23" have entirely different histories.
v3 ... v3.10.23

13
grpc.go
View File

@ -230,7 +230,6 @@ func (g *Server) handler(srv interface{}, stream grpc.ServerStream) error {
tracer.WithSpanKind(tracer.SpanKindServer), tracer.WithSpanKind(tracer.SpanKindServer),
tracer.WithSpanLabels( tracer.WithSpanLabels(
"endpoint", endpointName, "endpoint", endpointName,
"server", "grpc",
), ),
) )
defer func() { defer func() {
@ -292,18 +291,18 @@ func (g *Server) handler(srv interface{}, stream grpc.ServerStream) error {
stream = &streamWrapper{ctx, stream} stream = &streamWrapper{ctx, stream}
if !slices.Contains(meter.DefaultSkipEndpoints, endpointName) { if !slices.Contains(meter.DefaultSkipEndpoints, endpointName) {
g.opts.Meter.Counter(semconv.ServerRequestInflight, "endpoint", endpointName, "server", "grpc").Inc() g.opts.Meter.Counter(semconv.ServerRequestInflight, "endpoint", endpointName).Inc()
defer func() { defer func() {
te := time.Since(ts) te := time.Since(ts)
g.opts.Meter.Summary(semconv.ServerRequestLatencyMicroseconds, "endpoint", endpointName, "server", "grpc").Update(te.Seconds()) g.opts.Meter.Summary(semconv.ServerRequestLatencyMicroseconds, "endpoint", endpointName).Update(te.Seconds())
g.opts.Meter.Histogram(semconv.ServerRequestDurationSeconds, "endpoint", endpointName, "server", "grpc").Update(te.Seconds()) g.opts.Meter.Histogram(semconv.ServerRequestDurationSeconds, "endpoint", endpointName).Update(te.Seconds())
g.opts.Meter.Counter(semconv.ServerRequestInflight, "endpoint", endpointName, "server", "grpc").Dec() g.opts.Meter.Counter(semconv.ServerRequestInflight, "endpoint", endpointName).Dec()
st := status.Convert(err) st := status.Convert(err)
if st == nil || st.Code() == codes.OK { if st == nil || st.Code() == codes.OK {
g.opts.Meter.Counter(semconv.ServerRequestTotal, "endpoint", endpointName, "server", "grpc", "status", "success", "code", strconv.Itoa(int(codes.OK))).Inc() g.opts.Meter.Counter(semconv.ServerRequestTotal, "endpoint", endpointName, "status", "success", "code", strconv.Itoa(int(codes.OK))).Inc()
} else { } else {
g.opts.Meter.Counter(semconv.ServerRequestTotal, "endpoint", endpointName, "server", "grpc", "status", "failure", "code", strconv.Itoa(int(st.Code()))).Inc() g.opts.Meter.Counter(semconv.ServerRequestTotal, "endpoint", endpointName, "status", "failure", "code", strconv.Itoa(int(st.Code()))).Inc()
} }
}() }()
} }