Skip to content

Commit

Permalink
workaround for following issues.
Browse files Browse the repository at this point in the history
- miss rpc.system in AWS SDK span. fixed in open-telemetry/opentelemetry-dotnet-contrib#1865 and pending for release.
- miss leading / in span.DisplayName of http server span.
- env var OTEL_EXPORTER_OTLP_TRACES_ENDPOINT doesn't take effect.
  • Loading branch information
vastin committed Jun 27, 2024
1 parent 67cd5c7 commit dc38726
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ services:
- INSTANCE_ID
- LISTEN_ADDRESS=0.0.0.0:8080
- OTEL_RESOURCE_ATTRIBUTES=service.name=aws-otel-integ-test
- OTEL_EXPORTER_OTLP_ENDPOINT=http://cwagent:4316 # TODO: workaround for trace exporter endpoint
- OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://cwagent:4316/v1/traces
- OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT=http://cwagent:4316/v1/metrics
- ASPNETCORE_URLS=http://+:8080
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,12 @@ private static void SetRemoteServiceAndOperation(Activity span, ActivityTagsColl
remoteService = NormalizeRemoteServiceName(span, GetRemoteService(span, AttributeRpcService));
remoteOperation = GetRemoteOperation(span, AttributeRpcMethod);
}
// TODO workaround for AWS SDK span
else if (IsKeyPresent(span, AttributeAWSServiceName) || IsKeyPresent(span, AttributeAWSOperationName))
{
remoteService = NormalizeRemoteServiceName(span, GetRemoteService(span, AttributeAWSServiceName));
remoteOperation = GetRemoteOperation(span, AttributeAWSOperationName);
}
else if (IsKeyPresent(span, AttributeDbSystem)
|| IsKeyPresent(span, AttributeDbOperation)
|| IsKeyPresent(span, AttributeDbStatement))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ internal static string GetIngressOperation(Activity span)
{
operation = InternalOperation;
}
else if (!IsValidOperation(span, operation))
// TODO workaround for span.DisplayName
else if (!IsValidOperation(span, operation) || IsKeyPresent(span, AttributeUrlPath))
{
operation = GenerateIngressOperation(span);
}
Expand Down Expand Up @@ -141,7 +142,8 @@ internal static bool IsKeyPresent(Activity span, string key)
internal static bool IsAwsSDKSpan(Activity span)
{
// https://opentelemetry.io/docs/specs/semconv/cloud-providers/aws-sdk/
return "aws-api".Equals((string?)span.GetTagItem(AttributeRpcSystem));
// TODO workaround for AWS SDK span
return "aws-api".Equals((string?)span.GetTagItem(AttributeRpcSystem)) || ((string?)span.GetTagItem(AttributeAWSServiceName)) != null;
}

internal static bool ShouldGenerateServiceMetricAttributes(Activity span)
Expand Down Expand Up @@ -273,6 +275,7 @@ public static bool isDBSpan(Activity span)

public static bool isAwsSDKSpan(Activity span) {
// https://opentelemetry.io/docs/specs/otel/trace/semantic_conventions/instrumentation/aws-sdk/#common-attributes
return span.GetTagItem(AttributeRpcSystem) == "aws-api";
// TODO workaround for AWS SDK span
return span.GetTagItem(AttributeRpcSystem) == "aws-api" || ((string?)span.GetTagItem(AttributeAWSServiceName)) != null;
}
}

0 comments on commit dc38726

Please sign in to comment.