Skip to content

Commit

Permalink
NH-93486: export traces using otlp
Browse files Browse the repository at this point in the history
  • Loading branch information
cleverchuk committed Nov 13, 2024
1 parent 8bb6bef commit 88f18e2
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
import io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider;
import io.opentelemetry.sdk.resources.Resource;
import io.opentelemetry.semconv.ResourceAttributes;

import java.util.function.BiConsumer;

@AutoService(ResourceProvider.class)
Expand All @@ -71,7 +72,7 @@ public Resource createResource(ConfigProperties configProperties) {
setIfNotNull(builder::put, ResourceAttributes.HOST_NAME, hostId.getHostname());
setIfNotNull(
builder::put, ResourceAttributes.CLOUD_AVAILABILITY_ZONE, hostId.getEc2AvailabilityZone());
setIfNotNull(builder::put, ResourceAttributes.HOST_ID, hostId.getEc2InstanceId());
setIfNotNull(builder::put, AttributeKey.stringKey("ec2.instance.id"), hostId.getEc2InstanceId());

setIfNotNull(builder::put, ResourceAttributes.CONTAINER_ID, hostId.getDockerContainerId());
setIfNotNull(builder::put, ResourceAttributes.PROCESS_PID, (long) hostId.getPid());
Expand All @@ -82,7 +83,7 @@ public Resource createResource(ConfigProperties configProperties) {
builder::put,
AttributeKey.stringKey("azure.app.service.instance.id"),
hostId.getAzureAppServiceInstanceId());
setIfNotNull(builder::put, ResourceAttributes.HOST_ID, hostId.getHerokuDynoId());
setIfNotNull(builder::put, AttributeKey.stringKey("heroku.dyno.id"), hostId.getHerokuDynoId());
setIfNotNull(
builder::put, AttributeKey.stringKey("sw.uams.client.id"), hostId.getUamsClientId());
setIfNotNull(builder::put, AttributeKey.stringKey("uuid"), hostId.getUuid());
Expand All @@ -96,8 +97,8 @@ public Resource createResource(ConfigProperties configProperties) {

HostId.AwsMetadata awsMetadata = hostId.getAwsMetadata();
if (awsMetadata != null) {
setIfNotNull(builder::put, ResourceAttributes.HOST_ID, awsMetadata.getHostId());
setIfNotNull(builder::put, ResourceAttributes.HOST_NAME, awsMetadata.getHostName());
setIfNotNull(builder::put, AttributeKey.stringKey("aws.host.id"), awsMetadata.getHostId());
setIfNotNull(builder::put, AttributeKey.stringKey("aws.hostname"), awsMetadata.getHostName());
setIfNotNull(builder::put, ResourceAttributes.CLOUD_PROVIDER, awsMetadata.getCloudProvider());

setIfNotNull(
Expand All @@ -115,8 +116,8 @@ public Resource createResource(ConfigProperties configProperties) {

HostId.AzureVmMetadata azureVmMetadata = hostId.getAzureVmMetadata();
if (azureVmMetadata != null) {
setIfNotNull(builder::put, ResourceAttributes.HOST_ID, azureVmMetadata.getHostId());
setIfNotNull(builder::put, ResourceAttributes.HOST_NAME, azureVmMetadata.getHostName());
setIfNotNull(builder::put, AttributeKey.stringKey("azure.host.id"), azureVmMetadata.getHostId());
setIfNotNull(builder::put, AttributeKey.stringKey("azure.hostname"), azureVmMetadata.getHostName());
setIfNotNull(
builder::put, ResourceAttributes.CLOUD_PROVIDER, azureVmMetadata.getCloudProvider());

Expand Down

0 comments on commit 88f18e2

Please sign in to comment.