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
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ private Attributes buildRequestAttributes() {
return Attributes.of(SemConvConstants.HTTP_RESPONSE_STATUS_CODE, httpStatusCode);
}
if (grpcStatusCode != null) {
return Attributes.of(SemConvConstants.RPC_RESPONSE_STATUS_CODE, grpcStatusCode.name());
return Attributes.of(SemConvConstants.RPC_STATUS_CODE, grpcStatusCode.name());
}
return Attributes.empty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public int getContentLength() {
pa.hasAttributes(
expectedAttributes.toBuilder()
.put(
SemConvConstants.RPC_RESPONSE_STATUS_CODE,
SemConvConstants.RPC_STATUS_CODE,
GrpcStatusCode.OK.name())
.build())
.hasBucketCounts(1),
Expand All @@ -210,7 +210,7 @@ public int getContentLength() {
SemConvConstants.ERROR_TYPE,
"" + UNAVAILABLE.getValue())
.put(
SemConvConstants.RPC_RESPONSE_STATUS_CODE,
SemConvConstants.RPC_STATUS_CODE,
UNAVAILABLE.name())
.build())
.hasBucketCounts(1),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ private SemConvConstants() {}
AttributeKey.stringKey("server.address");
public static final AttributeKey<Long> SERVER_PORT = AttributeKey.longKey("server.port");

public static final AttributeKey<String> RPC_RESPONSE_STATUS_CODE =
AttributeKey.stringKey("rpc.response.status_code");
public static final AttributeKey<String> RPC_STATUS_CODE =
AttributeKey.stringKey("rpc.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 @@ -9,18 +9,17 @@

import io.opentelemetry.semconv.ErrorAttributes;
import io.opentelemetry.semconv.HttpAttributes;
import io.opentelemetry.semconv.RpcAttributes;
import io.opentelemetry.semconv.SchemaUrls;
import io.opentelemetry.semconv.ServerAttributes;
import io.opentelemetry.semconv.ServiceAttributes;
import io.opentelemetry.semconv.incubating.OtelIncubatingAttributes;
import io.opentelemetry.semconv.incubating.OtelIncubatingMetrics;
import io.opentelemetry.semconv.incubating.RpcIncubatingAttributes;
import org.junit.jupiter.api.Test;

class SemConvConstantsTest {

@Test
@SuppressWarnings("deprecation") // Retain rpc.response.status_code until a separate migration.
void attributeKeys() {
assertThat(SemConvConstants.SCHEMA_URL_V1_40_0).isEqualTo(SchemaUrls.V1_40_0);

Expand All @@ -42,8 +41,7 @@ void attributeKeys() {

assertThat(SemConvConstants.SERVER_ADDRESS).isEqualTo(ServerAttributes.SERVER_ADDRESS);
assertThat(SemConvConstants.SERVER_PORT).isEqualTo(ServerAttributes.SERVER_PORT);
assertThat(SemConvConstants.RPC_RESPONSE_STATUS_CODE)
.isEqualTo(RpcIncubatingAttributes.RPC_RESPONSE_STATUS_CODE);
assertThat(SemConvConstants.RPC_STATUS_CODE).isEqualTo(RpcAttributes.RPC_STATUS_CODE);
assertThat(SemConvConstants.HTTP_RESPONSE_STATUS_CODE)
.isEqualTo(HttpAttributes.HTTP_RESPONSE_STATUS_CODE);

Expand Down
Loading