Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

otelgrpc: Fix NewClientHandler to emit proper request/response metrics #6250

Merged
merged 5 commits into from
Oct 16, 2024

Conversation

bogdandrutu
Copy link
Member

@bogdandrutu bogdandrutu commented Oct 15, 2024

Tested by removing metricdatatest.IgnoreValue() from stas_handler tests, and see that only the duration metrics differ.

Copy link

codecov bot commented Oct 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.1%. Comparing base (8a26744) to head (3a9592a).

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #6250   +/-   ##
=====================================
  Coverage   67.1%   67.1%           
=====================================
  Files        191     191           
  Lines      12621   12637   +16     
=====================================
+ Hits        8476    8492   +16     
  Misses      3855    3855           
  Partials     290     290           
Files with missing lines Coverage Δ
...entation/google.golang.org/grpc/otelgrpc/config.go 91.4% <100.0%> (+1.3%) ⬆️
...n/google.golang.org/grpc/otelgrpc/stats_handler.go 100.0% <100.0%> (ø)

Copy link
Contributor

@dashpole dashpole left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change LGTM. Is there any more context you can share about how you found this? E.g. linked issues in the collector?

@bogdandrutu
Copy link
Member Author

I was trying internally to measure the throughput, and we enabled grpc metrics to see how many bytes of logs we export… and found that always the request size was 2B, the I saw that response was way larger… from there only some small debugging

CHANGELOG.md Outdated Show resolved Hide resolved
@pellared pellared added this to the v1.32.0 milestone Oct 16, 2024
CHANGELOG.md Outdated Show resolved Hide resolved
@pellared pellared changed the title Fix request/response metrics. In StatsHandler In means response for Client otelgrpc: Fix NewClientHandler to emit proper request/response metrics Oct 16, 2024
Copy link
Member

@pellared pellared left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only the changelog should be improved. Thanks @bogdandrutu 🥇

@pellared pellared added bug Something isn't working instrumentation: otelgrpc labels Oct 16, 2024
Co-authored-by: Robert Pająk <[email protected]>
@bogdandrutu
Copy link
Member Author

FYI: I feel that you are focusing too much on the nuance of the changelog message instead of speedup the process of accepting this bug fix (which is important and quite significant).

@pellared pellared merged commit d9c9bbe into open-telemetry:main Oct 16, 2024
24 checks passed
@bogdandrutu bogdandrutu deleted the fixinout branch October 17, 2024 16:21
pellared added a commit that referenced this pull request Nov 8, 2024
### Added

- Add the `WithSource` option to the
`go.opentelemetry.io/contrib/bridges/otelslog` log bridge to set the
`code.*` attributes in the log record that includes the source location
where the record was emitted. (#6253)
- Add `ContextWithStartTime` and `StartTimeFromContext` to
`go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp`, which
allows setting the start time using go context. (#6137)
- Set the `code.*` attributes in
`go.opentelemetry.io/contrib/bridges/otelzap` if the `zap.Logger` was
created with the `AddCaller` or `AddStacktrace` option. (#6268)
- Add a `LogProcessor` to
`go.opentelemetry.io/contrib/processors/baggagecopy` to copy baggage
members to log records. (#6277)
  - Use `baggagecopy.NewLogProcessor` when configuring a Log Provider.
- `NewLogProcessor` accepts a `Filter` function type that selects which
baggage members are added to the log record.

### Changed 

- Transform raw (`slog.KindAny`) attribute values to matching
`log.Value` types.
For example, `[]string{"foo", "bar"}` attribute value is now transformed
to `log.SliceValue(log.StringValue("foo"), log.StringValue("bar"))`
instead of `log.String("[foo bar"])`. (#6254)
- Upgrade `go.opentelemetry.io/otel/semconv/v1.17.0` to
`go.opentelemetry.io/otel/semconv/v1.21.0` in
`go.opentelemetry.io/contrib/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo`.
(#6272)
- Resource doesn't merge with defaults if a valid resource is configured
in `go.opentelemetry.io/contrib/config`. (#6289)

### Fixed

- Transform nil attribute values to `log.Value` zero value instead of
panicking in `go.opentelemetry.io/contrib/bridges/otellogrus`. (#6237)
- Transform nil attribute values to `log.Value` zero value instead of
panicking in `go.opentelemetry.io/contrib/bridges/otelzap`. (#6237)
- Transform nil attribute values to `log.Value` zero value instead of
`log.StringValue("<nil>")` in
`go.opentelemetry.io/contrib/bridges/otelslog`. (#6246)
- Fix `NewClientHandler` so that `rpc.client.request.*` metrics measure
requests instead of responses and `rpc.client.responses.*` metrics
measure responses instead of requests in
`go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc`.
(#6250)
- Fix issue in `go.opentelemetry.io/contrib/config` causing
`otelprom.WithResourceAsConstantLabels` configuration to not be
respected. (#6260)
- `otel.Handle` is no longer called on a successful shutdown of the
Prometheus exporter in `go.opentelemetry.io/contrib/config`. (#6299)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working instrumentation: otelgrpc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants