Skip to content

Commit

Permalink
Add proposed changes
Browse files Browse the repository at this point in the history
  • Loading branch information
scorpionknifes committed Nov 20, 2023
1 parent 26f41ee commit ef8cc54
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

### Fixed

- Fix `NewServerHandler` in `go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc` sets error state from grpc status incorrectly (#4587)
- Fix `NewServerHandler` in `go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc` to correctly set the span status depending on the gRPC status. (#4587)

## [1.21.1/0.46.1/0.15.1/0.1.1] - 2023-11-16

Expand Down
2 changes: 1 addition & 1 deletion instrumentation/google.golang.org/grpc/otelgrpc/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func newConfig(opts []Option, role string) *config {
}

c.rpcResponsesPerRPC, err = c.meter.Int64Histogram("rpc."+role+".responses_per_rpc",
metric.WithDescription("Measures the number of messages responded per RPC. Should be 1 for all non-streaming RPCs."),
metric.WithDescription("Measures the number of messages received per RPC. Should be 1 for all non-streaming RPCs."),
metric.WithUnit("{count}"))
if err != nil {
otel.Handle(err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ func (h *serverHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) cont

// HandleRPC processes the RPC stats.
func (h *serverHandler) HandleRPC(ctx context.Context, rs stats.RPCStats) {
h.handleRPC(ctx, rs, true)
isServer := true
h.handleRPC(ctx, rs, isServer)
}

type clientHandler struct {
Expand Down Expand Up @@ -121,7 +122,8 @@ func (h *clientHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) cont

// HandleRPC processes the RPC stats.
func (h *clientHandler) HandleRPC(ctx context.Context, rs stats.RPCStats) {
h.handleRPC(ctx, rs, false)
isServer := false
h.handleRPC(ctx, rs, isServer)
}

// TagConn can attach some information to the given context.
Expand All @@ -137,7 +139,7 @@ func (h *clientHandler) HandleConn(context.Context, stats.ConnStats) {
// no-op
}

func (c *config) handleRPC(ctx context.Context, rs stats.RPCStats, isServer bool) {
func (c *config) handleRPC(ctx context.Context, rs stats.RPCStats, isServer bool) { // nolint: revive // isServer is not a control flag.
span := trace.SpanFromContext(ctx)
gctx, _ := ctx.Value(gRPCContextKey{}).(*gRPCContext)
var messageId int64
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ func checkClientMetrics(t *testing.T, reader metric.Reader) {
},
{
Name: "rpc.client.responses_per_rpc",
Description: "Measures the number of messages responded per RPC. Should be 1 for all non-streaming RPCs.",
Description: "Measures the number of messages received per RPC. Should be 1 for all non-streaming RPCs.",
Unit: "{count}",
Data: metricdata.Histogram[int64]{
Temporality: metricdata.CumulativeTemporality,
Expand Down Expand Up @@ -1244,7 +1244,7 @@ func checkServerMetrics(t *testing.T, reader metric.Reader) {
},
{
Name: "rpc.server.responses_per_rpc",
Description: "Measures the number of messages responded per RPC. Should be 1 for all non-streaming RPCs.",
Description: "Measures the number of messages received per RPC. Should be 1 for all non-streaming RPCs.",
Unit: "{count}",
Data: metricdata.Histogram[int64]{
Temporality: metricdata.CumulativeTemporality,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func assertStatsHandlerServerMetrics(t *testing.T, reader metric.Reader, service
},
{
Name: "rpc.server.responses_per_rpc",
Description: "Measures the number of messages responded per RPC. Should be 1 for all non-streaming RPCs.",
Description: "Measures the number of messages received per RPC. Should be 1 for all non-streaming RPCs.",
Unit: "{count}",
Data: metricdata.Histogram[int64]{
Temporality: metricdata.CumulativeTemporality,
Expand Down

0 comments on commit ef8cc54

Please sign in to comment.