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

Set the service name source to Instrumentation in entity when customer sets the service name OTEL resource attribute #1565

Merged
merged 2 commits into from
Mar 3, 2025

Conversation

nathalapooja
Copy link
Contributor

Description of the issue

Describe the problem or feature in addition to a link to the issues.

In the case of Appsignals with ADOT SDK, Operator sets the service name source to Instrumentation when the customer sets the service name. But for OTEL SDK, it doesn't have logic to add the service name source. Currently entity service name source is empty when the customer sets the service name OTEL attribute for OTLP metrics and logs.

Description of changes

How does this change address the problem?
Added logic to set the service name source to Instrumentation in entity when customer sets the service name OTEL resource attribute for OTLP metrics and logs.

License

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Tests

Describe what tests you have done.
Unit Tests
Manual Tests

Before Change

{"com.amazonaws.cloudwatch.entity.internal.deployment.environment":"eks: │
│ compass-ga2/default","com.amazonaws.cloudwatch.entity.internal.k8s.cluster.name":"compass-ga2","com.amazonaws.cloudwatch.entity.internal.k8s.namespace.name":"defaul │
│ t","com.amazonaws.cloudwatch.entity.internal.k8s.node.name":"ip-192-168-40-77.ec2.internal","com.amazonaws.cloudwatch.entity.internal.k8s.workload.name":"sample-app","com.amazonaws.cloudwatch.entity.internal.platform.type":"AWS::EKS","com.am │
│ azonaws.cloudwatch.entity.internal.service.name":"test-service","com.amazonaws.cloudwatch.entity.internal.type":"Service"}}                                                                                                                

After Change

  -> com.amazonaws.cloudwatch.entity.internal.type: Str(Service)\n     -> com.amazonaws.cloudwatch.entity.internal.service.name: Str(test-service)\n     -> com.ama │
│ zonaws.cloudwatch.entity.internal.deployment.environment: Str(eks:compass-ga2/default)\n     -> com.amazonaws.cloudwatch.entity.internal.platform.type: Str(AWS::EKS)\n     -> com.amazonaws.cloudwatch.entity.internal.k8s.cluster.name: Str(com │
│ pass-ga2)\n     -> com.amazonaws.cloudwatch.entity.internal.k8s.namespace.name: Str(default)\n     -> com.amazonaws.cloudwatch.entity.internal.k8s.workload.name: Str(sample-app)\n        -> 
com.amazonaws.cloudwatch.entity.internal.service.name.source: Str(Instrumentation)

Requirements

Before commit the code, please do the following steps.

  1. Run make fmt and make fmt-sh
  2. Run make lint

@nathalapooja nathalapooja requested a review from a team as a code owner February 24, 2025 14:09
@@ -195,6 +195,10 @@ func (p *awsEntityProcessor) processMetrics(_ context.Context, md pmetric.Metric
entityServiceName = podInfo.Workload
entityServiceNameSource = entitystore.ServiceNameSourceK8sWorkload
}
// Set the service name source to Instrumentation if the operator doesn't set it
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: mention that this resource attribute is always set when an application is instrumented by an otel sdk

@nathalapooja nathalapooja merged commit 20824f2 into feature-custom-metrics-entity Mar 3, 2025
7 checks passed
@nathalapooja nathalapooja deleted the service-unknown-source branch March 3, 2025 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants