opentelemetry-go-contrib
opentelemetry-go-contrib copied to clipboard
[otelgrpc] add metric rpc.server.duration support
Signed-off-by: Ziqi Zhao [email protected]
Enhance instrumentation library otelgrpc for grpc to satisfy opentelemetry grpc server metric semantic conventions.
This pr is meant to add metric rpc.server.duration for the first step.
I use example code to test, and produce the data for unary and stream request
{
"Name": "rpc.server.duration{service.name=unknown_service:main,telemetry.sdk.language=go,telemetry.sdk.name=opentelemetry,telemetry.sdk.version=1.9.0,instrumentation.name=go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc,instrumentation.version=semver:0.34.0,net.peer.ip=127.0.0.1,net.peer.port=55809,rpc.grpc.status_code=0,rpc.method=SayHelloServerStream,rpc.service=api.HelloService,rpc.system=grpc}",
"Sum": 502.366387
},
{
"Name": "rpc.server.duration{service.name=unknown_service:main,telemetry.sdk.language=go,telemetry.sdk.name=opentelemetry,telemetry.sdk.version=1.9.0,instrumentation.name=go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc,instrumentation.version=semver:0.34.0,net.peer.ip=127.0.0.1,net.peer.port=55809,rpc.grpc.status_code=0,rpc.method=SayHelloBidiStream,rpc.service=api.HelloService,rpc.system=grpc}",
"Sum": 253.394227
}
You need to run go mod tidy from the otelgrpc package to fix the tests.
Also, this will need a changelog entry.
Codecov Report
Merging #2700 (41f7fb7) into main (bba2c55) will increase coverage by
0.0%. The diff coverage is63.6%.
Additional details and impacted files
@@ Coverage Diff @@
## main #2700 +/- ##
=====================================
Coverage 69.3% 69.4%
=====================================
Files 145 146 +1
Lines 6729 6752 +23
=====================================
+ Hits 4667 4689 +22
+ Misses 1948 1946 -2
- Partials 114 117 +3
| Impacted Files | Coverage Δ | |
|---|---|---|
| ...ogle.golang.org/grpc/otelgrpc/metadata_supplier.go | 51.1% <51.1%> (ø) |
|
| ...entation/google.golang.org/grpc/otelgrpc/config.go | 65.1% <80.0%> (ø) |
|
| ...ion/google.golang.org/grpc/otelgrpc/interceptor.go | 83.0% <100.0%> (-0.6%) |
:arrow_down: |
@dmathieu @Aneurysm9 All checks are passed, could you help review this again?
Could you help review this again? @dmathieu
@Aneurysm9 @jmacd @MrAlias @hanyuancheung
Could you help review this again?
Hi, stumbled across this, and had two questions about the units
- ~Why milliseconds? Looks like its a float64 anyway, so the position of the decimal makes no technical difference, so seconds would seem like a better choice simply for being the SI standard.~ nevermind, spotted the unit specification in the upstream spec.
- Does the unit need to be indicated somewhere? I had to dig into the recording code to find it.
@devnev I think you can visit here to find the info about all metrics. https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/semantic_conventions/rpc.md#rpc-server
Hi, stumbled across this, and had two questions about the units
- ~Why milliseconds? Looks like its a float64 anyway, so the position of the decimal makes no technical difference, so seconds would seem like a better choice simply for being the SI standard.~ nevermind, spotted the unit specification in the upstream spec.
- Does the unit need to be indicated somewhere? I had to dig into the recording code to find it.
ping @pellared @Aneurysm9 @MrAlias @jmacd @dashpole @MadVikingGod @evantorrie @XSAM , could you help review this again?
ping @pellared @Aneurysm9 @MrAlias @jmacd @dashpole @MadVikingGod @evantorrie @XSAM could you help review this?
Is the plan to add the other specified metrics (https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/semantic_conventions/rpc.md#rpc-server) in follow on PRs? If so, can you open an issue to track the work?
Is the plan to add the other specified metrics (https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/semantic_conventions/rpc.md#rpc-server) in follow on PRs? If so, can you open an issue to track the work?
Absolutely, I already open an issue #2840 to track, and I will add the metric one by one. @MrAlias
Could you help review this again? @MrAlias
@jmacd @pellared @Aneurysm9 Could you help review this again?
BTW... The new spec is moved to https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/semantic_conventions/rpc-metrics.md