Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dependencyManagement/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ val DEPENDENCIES = listOf(
"io.github.netmikey.logunit:logunit-jul:2.0.0",
"io.jaegertracing:jaeger-client:1.8.1",
"io.opentelemetry.contrib:opentelemetry-aws-xray-propagator:1.53.0-alpha",
"io.opentelemetry.semconv:opentelemetry-semconv-incubating:1.37.0-alpha",
"io.opentelemetry.semconv:opentelemetry-semconv-incubating:1.39.0-alpha",
"io.opentelemetry.proto:opentelemetry-proto:1.9.0-alpha",
"io.opentracing:opentracing-api:0.33.0",
"io.opentracing:opentracing-noop:0.33.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ private void onResponse(
GrpcResponse grpcResponse) {
GrpcStatusCode statusCode = grpcResponse.getStatusCode();

metricRecording.setGrpcStatusCode(statusCode.getValue());
metricRecording.setGrpcStatusCode(statusCode);

if (statusCode == GrpcStatusCode.OK) {
metricRecording.finishSuccessful();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import io.opentelemetry.api.common.AttributesBuilder;
import io.opentelemetry.api.metrics.MeterProvider;
import io.opentelemetry.sdk.common.InternalTelemetryVersion;
import io.opentelemetry.sdk.common.export.GrpcStatusCode;
import io.opentelemetry.sdk.common.internal.SemConvAttributes;
import io.opentelemetry.sdk.common.internal.Signal;
import io.opentelemetry.sdk.common.internal.StandardComponentId;
Expand Down Expand Up @@ -84,7 +85,7 @@ public static class Recording {

private final ExporterMetrics.Recording delegate;
@Nullable private Long httpStatusCode;
@Nullable private Long grpcStatusCode;
@Nullable private GrpcStatusCode grpcStatusCode;

private Recording(ExporterMetrics.Recording delegate) {
this.delegate = delegate;
Expand All @@ -98,7 +99,7 @@ public void setHttpStatusCode(long httpStatusCode) {
this.httpStatusCode = httpStatusCode;
}

public void setGrpcStatusCode(long grpcStatusCode) {
public void setGrpcStatusCode(GrpcStatusCode grpcStatusCode) {
if (httpStatusCode != null) {
throw new IllegalStateException(
"HTTP status code already set, can only set either gRPC or HTTP");
Expand Down Expand Up @@ -135,7 +136,7 @@ private Attributes buildRequestAttributes() {
return Attributes.of(SemConvAttributes.HTTP_RESPONSE_STATUS_CODE, httpStatusCode);
}
if (grpcStatusCode != null) {
return Attributes.of(SemConvAttributes.RPC_GRPC_STATUS_CODE, grpcStatusCode);
return Attributes.of(SemConvAttributes.RPC_RESPONSE_STATUS_CODE, grpcStatusCode.name());
Copy link
Member

@jack-berg jack-berg Jan 29, 2026

Choose a reason for hiding this comment

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

@jkwatson did you clock this change? Its essentially a breaking change to our internal telemetry, but its understood if you choose InternalTelemetryVersion.LATEST, that the instrumentation will change as we keep up with changes from the still-evolving semantic-conventions.

cc @open-telemetry/java-approvers for visibility.

Copy link
Contributor

Choose a reason for hiding this comment

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

whoops. No, I hadn't noticed you had made some adjustments to the PR. If you're fine with this, I'm also fine with it.

}
return Attributes.empty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,9 @@ void testInternalTelemetry(StandardComponentId.ExporterType exporterType) {
pa ->
pa.hasAttributes(
expectedAttributes.toBuilder()
.put(SemConvAttributes.RPC_GRPC_STATUS_CODE, 0)
.put(
SemConvAttributes.RPC_RESPONSE_STATUS_CODE,
GrpcStatusCode.OK.name())
.build())
.hasBucketCounts(1),
pa ->
Expand All @@ -208,8 +210,8 @@ void testInternalTelemetry(StandardComponentId.ExporterType exporterType) {
SemConvAttributes.ERROR_TYPE,
"" + UNAVAILABLE.getValue())
.put(
SemConvAttributes.RPC_GRPC_STATUS_CODE,
UNAVAILABLE.getValue())
SemConvAttributes.RPC_RESPONSE_STATUS_CODE,
UNAVAILABLE.name())
.build())
.hasBucketCounts(1),
pa ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ private SemConvAttributes() {}
AttributeKey.stringKey("server.address");
public static final AttributeKey<Long> SERVER_PORT = AttributeKey.longKey("server.port");

public static final AttributeKey<Long> RPC_GRPC_STATUS_CODE =
AttributeKey.longKey("rpc.grpc.status_code");
public static final AttributeKey<String> RPC_RESPONSE_STATUS_CODE =
AttributeKey.stringKey("rpc.response.status_code");
public static final AttributeKey<Long> HTTP_RESPONSE_STATUS_CODE =
AttributeKey.longKey("http.response.status_code");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ void testAttributeKeys() {

assertThat(SemConvAttributes.SERVER_ADDRESS).isEqualTo(ServerAttributes.SERVER_ADDRESS);
assertThat(SemConvAttributes.SERVER_PORT).isEqualTo(ServerAttributes.SERVER_PORT);
assertThat(SemConvAttributes.RPC_GRPC_STATUS_CODE)
.isEqualTo(RpcIncubatingAttributes.RPC_GRPC_STATUS_CODE);
assertThat(SemConvAttributes.RPC_RESPONSE_STATUS_CODE)
.isEqualTo(RpcIncubatingAttributes.RPC_RESPONSE_STATUS_CODE);
assertThat(SemConvAttributes.HTTP_RESPONSE_STATUS_CODE)
.isEqualTo(HttpAttributes.HTTP_RESPONSE_STATUS_CODE);

Expand Down
Loading