Skip to content

Commit

Permalink
fix: Expose Gax meter name (#2865)
Browse files Browse the repository at this point in the history
This can mitigate the ask to expose `Meter` as a constructor parameter
in `OpenTelemetryMetricsRecorder`. Since `Meter` usually represents the
libary that does the instrumentation, we can not expose it. However, we
can expose the meter name as a public String, so that users of gax can
create Otel views more easily with it.
  • Loading branch information
blakeli0 authored Jun 10, 2024
1 parent 26bd8e2 commit 6c5d6ce
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
@BetaApi
@InternalApi
public class OpenTelemetryMetricsRecorder implements MetricsRecorder {

public static final String GAX_METER_NAME = "gax-java";
private final DoubleHistogram attemptLatencyRecorder;
private final DoubleHistogram operationLatencyRecorder;
private final LongCounter operationCountRecorder;
Expand All @@ -76,7 +78,7 @@ public class OpenTelemetryMetricsRecorder implements MetricsRecorder {
public OpenTelemetryMetricsRecorder(OpenTelemetry openTelemetry, String serviceName) {
Meter meter =
openTelemetry
.meterBuilder("gax-java")
.meterBuilder(GAX_METER_NAME)
.setInstrumentationVersion(GaxProperties.getGaxVersion())
.build();
this.attemptLatencyRecorder =
Expand Down

0 comments on commit 6c5d6ce

Please sign in to comment.