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

Use replicaset name as part of service name fallback #249

Merged
merged 3 commits into from
Oct 16, 2024

Conversation

zhihonl
Copy link
Contributor

@zhihonl zhihonl commented Oct 15, 2024

Description of changes:
Upstream otel-collector uses replicaset name as service name as part of the service name fallback strategy. Our operator does not do that yet. https://github.com/open-telemetry/opentelemetry-operator/blob/main/pkg/instrumentation/sdk.go#L420

In this PR, we add change to parse replicaset name as service name when available.

Test

Environment:                                                                                                                                                                                                                                                                                                                   │
│       OTEL_AWS_APP_SIGNALS_ENABLED:                    true                                                                                                                                                                                                                                                                        │
│       OTEL_AWS_APPLICATION_SIGNALS_ENABLED:            true                                                                                                                                                                                                                                                                        │
│       OTEL_TRACES_SAMPLER_ARG:                         endpoint=http://cloudwatch-agent.amazon-cloudwatch:2000                                                                                                                                                                                                                     │
│       OTEL_TRACES_SAMPLER:                             xray                                                                                                                                                                                                                                                                        │
│       OTEL_EXPORTER_OTLP_PROTOCOL:                     http/protobuf                                                                                                                                                                                                                                                               │
│       OTEL_EXPORTER_OTLP_TRACES_ENDPOINT:              http://cloudwatch-agent.amazon-cloudwatch:4316/v1/traces                                                                                                                                                                                                                    │
│       OTEL_AWS_APP_SIGNALS_EXPORTER_ENDPOINT:          http://cloudwatch-agent.amazon-cloudwatch:4316/v1/metrics                                                                                                                                                                                                                   │
│       OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT:  http://cloudwatch-agent.amazon-cloudwatch:4316/v1/metrics                                                                                                                                                                                                                   │
│       OTEL_METRICS_EXPORTER:                           none                                                                                                                                                                                                                                                                        │
│       OTEL_LOGS_EXPORTER:                              none                                                                                                                                                                                                                                                                        │
│       JAVA_TOOL_OPTIONS:                                -javaagent:/otel-auto-instrumentation-java/javaagent.jar                                                                                                                                                                                                                   │
│       OTEL_SERVICE_NAME:                               busybox-log-generator                                                                                                                                                                                                                                                       │
│       OTEL_RESOURCE_ATTRIBUTES_POD_NAME:               busybox-log-generator-lshz5 (v1:metadata.name)                                                                                                                                                                                                                              │
│       OTEL_PROPAGATORS:                                tracecontext,baggage,b3,xray                                                                                                                                                                                                                                                │
│       OTEL_RESOURCE_ATTRIBUTES:                        k8s.container.name=busybox,k8s.namespace.name=default,k8s.node.name=ip-192-168-63-18.ec2.internal,k8s.pod.name=$(OTEL_RESOURCE_ATTRIBUTES_POD_NAME),k8s.replicaset.name=busybox-log-generator,service.version=busybox,com.amazonaws.cloudwatch.entity.internal.service.name │
│ .source=K8sWorkload

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

@lisguo
Copy link
Contributor

lisguo commented Oct 16, 2024

@zhihonl zhihonl merged commit 72ea08f into main-feature Oct 16, 2024
1 check passed
@zhihonl zhihonl deleted the replicaset-workload branch October 16, 2024 20:55
lisguo added a commit that referenced this pull request Oct 28, 2024
…er (#262)

* added agent server port as default port on CW agent (#234)

* Attach service name source as resource attribute to operator (#235)

* Add service name source for instrumentation and workload

* Change service name source attribute naming

* Fix unit tests for pod mutators

* Simplify service name source determination

* Fix incorrect refactor of source constants

* Use replicaset name as part of service name fallback (#249)

* Use replicaset name as part of service name fallback

* Add chooseServiceName unit test

* Change import statement ordering

* Fix service name source being added multiple times for multiple injections (#254)

* added fix to not override the service name source for multiple auto-inject

---------

Co-authored-by: POOJA REDDY NATHALA <poojardy@amazon.com>
Co-authored-by: zhihonl <61301537+zhihonl@users.noreply.github.com>
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