Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dockerfile and fixed some issues. #47

Merged
merged 2 commits into from
Jun 27, 2024
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
3 changes: 3 additions & 0 deletions Dockerfile.linux
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM busybox

COPY OpenTelemetryDistribution /autoinstrumentation
5 changes: 5 additions & 0 deletions Dockerfile.windows
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM mcr.microsoft.com/windows/nanoserver:ltsc2022

COPY OpenTelemetryDistribution /autoinstrumentation

USER ContainerAdministrator
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 @@
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 Expand Up @@ -509,30 +515,30 @@
{
var serverAddress = span.GetTagItem(AttributeServerAddress);
var serverPort = span.GetTagItem(AttributeServerPort);
dbConnection = buildDbConnection(serverAddress.ToString(), serverPort == null? null : (long)serverPort);

Check warning on line 518 in src/AWS.Distro.OpenTelemetry.AutoInstrumentation/AwsMetricAttributeGenerator.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Dereference of a possibly null reference.

Check warning on line 518 in src/AWS.Distro.OpenTelemetry.AutoInstrumentation/AwsMetricAttributeGenerator.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Dereference of a possibly null reference.
} else if (IsKeyPresent(span, AttributeNetPeerName))
{
var networkPeerAddress = span.GetTagItem(AttributeNetPeerName);
var networkPeerPort = span.GetTagItem(AttributeNetPeerPort);
dbConnection = buildDbConnection(networkPeerAddress.ToString(), networkPeerPort == null? null : (long)networkPeerPort);

Check warning on line 523 in src/AWS.Distro.OpenTelemetry.AutoInstrumentation/AwsMetricAttributeGenerator.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Dereference of a possibly null reference.

Check warning on line 523 in src/AWS.Distro.OpenTelemetry.AutoInstrumentation/AwsMetricAttributeGenerator.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Dereference of a possibly null reference.
} else if (IsKeyPresent(span, AttributeServerSocketAddress)) {
var serverSocketAddress = span.GetTagItem(AttributeServerSocketAddress);
var serverSocketPort = span.GetTagItem(AttributeServerSocketPort);
dbConnection = buildDbConnection(serverSocketAddress.ToString(), serverSocketPort == null? null: (long)serverSocketPort);

Check warning on line 527 in src/AWS.Distro.OpenTelemetry.AutoInstrumentation/AwsMetricAttributeGenerator.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Dereference of a possibly null reference.

Check warning on line 527 in src/AWS.Distro.OpenTelemetry.AutoInstrumentation/AwsMetricAttributeGenerator.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Dereference of a possibly null reference.
} else if (IsKeyPresent(span, AttributeDbConnectionString)) {
var connectionstring= span.GetTagItem(AttributeDbConnectionString);
dbConnection = buildDbConnection(connectionstring.ToString());

Check warning on line 530 in src/AWS.Distro.OpenTelemetry.AutoInstrumentation/AwsMetricAttributeGenerator.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Dereference of a possibly null reference.

Check warning on line 530 in src/AWS.Distro.OpenTelemetry.AutoInstrumentation/AwsMetricAttributeGenerator.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Possible null reference argument for parameter 'connectionString' in 'string AwsMetricAttributeGenerator.buildDbConnection(string connectionString)'.

Check warning on line 530 in src/AWS.Distro.OpenTelemetry.AutoInstrumentation/AwsMetricAttributeGenerator.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Dereference of a possibly null reference.

Check warning on line 530 in src/AWS.Distro.OpenTelemetry.AutoInstrumentation/AwsMetricAttributeGenerator.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Possible null reference argument for parameter 'connectionString' in 'string AwsMetricAttributeGenerator.buildDbConnection(string connectionString)'.
}

// return empty resource identifier if db server is not found
if (dbConnection != null && dbName != null) {
return EscapeDelimiters(dbName.ToString()) + "|" + dbConnection;

Check warning on line 535 in src/AWS.Distro.OpenTelemetry.AutoInstrumentation/AwsMetricAttributeGenerator.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Possible null reference argument for parameter 'input' in 'string AwsMetricAttributeGenerator.EscapeDelimiters(string input)'.

Check warning on line 535 in src/AWS.Distro.OpenTelemetry.AutoInstrumentation/AwsMetricAttributeGenerator.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Possible null reference argument for parameter 'input' in 'string AwsMetricAttributeGenerator.EscapeDelimiters(string input)'.
}
return dbConnection;

Check warning on line 537 in src/AWS.Distro.OpenTelemetry.AutoInstrumentation/AwsMetricAttributeGenerator.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Possible null reference return.

Check warning on line 537 in src/AWS.Distro.OpenTelemetry.AutoInstrumentation/AwsMetricAttributeGenerator.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Possible null reference return.
}

private static string buildDbConnection(string? address, long? port) {
return EscapeDelimiters(address) + (port != null ? "|" + port : "");

Check warning on line 541 in src/AWS.Distro.OpenTelemetry.AutoInstrumentation/AwsMetricAttributeGenerator.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Possible null reference argument for parameter 'input' in 'string AwsMetricAttributeGenerator.EscapeDelimiters(string input)'.

Check warning on line 541 in src/AWS.Distro.OpenTelemetry.AutoInstrumentation/AwsMetricAttributeGenerator.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Possible null reference argument for parameter 'input' in 'string AwsMetricAttributeGenerator.EscapeDelimiters(string input)'.
}

private static string buildDbConnection(string connectionString) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
return keywordList;
}
}
catch (Exception e)

Check warning on line 79 in src/AWS.Distro.OpenTelemetry.AutoInstrumentation/AwsSpanProcessingUtil.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The variable 'e' is declared but never used

Check warning on line 79 in src/AWS.Distro.OpenTelemetry.AutoInstrumentation/AwsSpanProcessingUtil.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

The variable 'e' is declared but never used
{
return new List<string>();
}
Expand All @@ -92,7 +92,8 @@
{
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 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 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;

Check warning on line 279 in src/AWS.Distro.OpenTelemetry.AutoInstrumentation/AwsSpanProcessingUtil.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Possible unintended reference comparison; to get a value comparison, cast the left hand side to type 'string'

Check warning on line 279 in src/AWS.Distro.OpenTelemetry.AutoInstrumentation/AwsSpanProcessingUtil.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Possible unintended reference comparison; to get a value comparison, cast the left hand side to type 'string'
}
}
Loading