Skip to content

Conversation

ChrsMark
Copy link
Member

@ChrsMark ChrsMark commented Jun 20, 2025

This PR removes the resource/k8s processor in honour of the k8sattributes processor that provides native support for the Service attributes.

This change is aligned with the respective Semantic Conventions' guidance: https://opentelemetry.io/docs/specs/semconv/non-normative/k8s-attributes/#service-attributes

This is also aligned with the logic the OpenTelemetry Operator applies:

Potential breaking change

The k8sattributes processor does not override service attributes if those are already set. Hence, this change only affects use-cases that were relying on the enrichment that the resource/k8s does. This should be mainly logs and metrics since the SDKs usually set those attributes on their own.

With this change the service.version calculation is not affected at all. The service.name calculation now gives priority to k8s.{deployment, daemonset, ...}.name before using the k8s.container.name. That's the only possible "breaking" change but should not be really impactful.

This PR requires k8sattributes processor to be at least v0.127.0. v0.127.0 was introduced by #8511 to main and 8.19.x.

@ChrsMark ChrsMark requested a review from a team as a code owner June 20, 2025 08:09
Copy link
Contributor

mergify bot commented Jun 20, 2025

This pull request does not have a backport label. Could you fix it @ChrsMark? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-./d./d is the label that automatically backports to the 8./d branch. /d is the digit
  • backport-active-all is the label that automatically backports to all active branches.
  • backport-active-8 is the label that automatically backports to all active minor branches for the 8 major.
  • backport-active-9 is the label that automatically backports to all active minor branches for the 9 major.

@ChrsMark ChrsMark added the backport-8.19 Automated backport to the 8.19 branch label Jun 20, 2025
@ChrsMark ChrsMark force-pushed the use_k8sattributesprocessor_service_attrs branch 2 times, most recently from f541e93 to b38637c Compare June 20, 2025 08:34
@ChrsMark ChrsMark requested a review from a team as a code owner June 20, 2025 08:34
@pierrehilbert pierrehilbert added the Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team label Jun 20, 2025
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

Copy link
Contributor

@rogercoll rogercoll left a comment

Choose a reason for hiding this comment

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

LGTM

Do we know if there's been any proposal to remove the original extracted attributes? All matching signals will have two resource attributes with the same value

@ChrsMark
Copy link
Member Author

LGTM

Do we know if there's been any proposal to remove the original extracted attributes? All matching signals will have two resource attributes with the same value

There is no such proposal so far.
The fact that service.* attributes are derived from other existing attributes does not necessarily mean that original attributes should be deleted, right?

@ChrsMark ChrsMark requested a review from swiatekm June 23, 2025 11:01
Copy link
Contributor

@swiatekm swiatekm left a comment

Choose a reason for hiding this comment

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

Are we sure this doesn't affect any of the content for K8s Otel Observability?

@ChrsMark
Copy link
Member Author

Ah @rogercoll did you mean the ones extracted at https://github.com/elastic/elastic-agent/blob/main/deploy/helm/edot-collector/kube-stack/values.yaml#L120C1-L126C26? I think we can remove them as well since they were deleted anyways in resource/k8s processor. I will fix that.

@ChrsMark ChrsMark force-pushed the use_k8sattributesprocessor_service_attrs branch from 0b7a420 to 5e35b85 Compare June 23, 2025 14:09
@gizas
Copy link
Contributor

gizas commented Jun 24, 2025

I dont see a problem as long as service.version and service.name are populated. Reading the old issues (1, 2) we just want to mimic what Agent had in order to support the inventory page. Only side effect from this change is that we might have diffrent names/versions because we change slightly the logic but is ok I think.

To be on safe side, can you please add the https://opentelemetry.io/docs/specs/semconv/non-normative/k8s-attributes/#service-attributes on the changelog in order our users to have access to the logic? Maybe also explain the fields in the description.

I agree, we can delete app.label.name and app.label.version

gizas
gizas previously approved these changes Jun 24, 2025
@ChrsMark ChrsMark force-pushed the use_k8sattributesprocessor_service_attrs branch from 93760ac to 6d1f85e Compare June 24, 2025 07:33
@ChrsMark ChrsMark force-pushed the use_k8sattributesprocessor_service_attrs branch from 6d1f85e to b8045fb Compare June 24, 2025 07:34
@ChrsMark ChrsMark requested review from rogercoll and swiatekm June 24, 2025 07:34
gizas
gizas previously approved these changes Jun 24, 2025
Signed-off-by: ChrsMark <[email protected]>
@ChrsMark ChrsMark force-pushed the use_k8sattributesprocessor_service_attrs branch from b8045fb to 9cf6007 Compare June 24, 2025 07:36
@ChrsMark ChrsMark enabled auto-merge (squash) June 24, 2025 09:26
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @ChrsMark

@ChrsMark ChrsMark merged commit b2aa165 into elastic:main Jun 24, 2025
19 checks passed
mergify bot pushed a commit that referenced this pull request Jun 24, 2025
…vice attributes (#8599)

* Remove resource/k8s processor and use k8sattributes processor for service attributes

Signed-off-by: ChrsMark <[email protected]>

* remove k8s labels extraction

Signed-off-by: ChrsMark <[email protected]>

* update changelog

Signed-off-by: ChrsMark <[email protected]>

---------

Signed-off-by: ChrsMark <[email protected]>
(cherry picked from commit b2aa165)
ChrsMark added a commit that referenced this pull request Jun 24, 2025
…vice attributes (#8599) (#8653)

* Remove resource/k8s processor and use k8sattributes processor for service attributes



* remove k8s labels extraction



* update changelog



---------


(cherry picked from commit b2aa165)

Signed-off-by: ChrsMark <[email protected]>
Co-authored-by: Christos Markou <[email protected]>
v1v added a commit that referenced this pull request Jun 25, 2025
…-hosted

* feature/hosted-stack-using-oblt-cli: (26 commits)
  Use the current official docker image for oblt-cli
  Mark the elasticinframetrics processor as deprecated and schedule for removal (#8659)
  [main][Automation] Update versions (#8668)
  chore: Update create_deployment_csp_configuration.yaml (#8669)
  Attempt to make test more reliable by querying ES directly (#8422)
  [test] split up ess and beats serverless integration tests (#8551)
  Remove resource/k8s processor and use k8sattributes processor for service attributes (#8599)
  fix: use --force-confold for deb tests in TestUpgradeAgentWithTamperProtectedEndpoint_DEB (#8649)
  [main][Automation] Bump stack images versions to 9.1.0-ea0b7542 (#8612)
  chore: Update to elastic/beats@f6594fb72670 (#8640)
  [deb/rpm] restart endpoint with tamper protection after elastic-agent  (#8637)
  ci: don't preinstall fleet packages on retried CI steps (#8636)
  chore: Update to elastic/beats@6b6941eed496 (#8619)
  [main][Automation] Bump VM Image version to 1750467641 (#8617)
  flaky: skip TestUpgradeAgentWithTamperProtectedEndpoint_RPM (#8626)
  Add skip-changelog PR label for bump VM PRs (#8627)
  build(deps): bump github.com/elastic/go-seccomp-bpf from 1.5.0 to 1.6.0 (#8611)
  [ci] fix k8s integration tests flakiness (#8575)
  bump apmconfig Otel extension to v0.3.0 (#8600)
  Enhancement/6394 allow deb rpm to upgrade with endpoint tamper protection (#6907)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-8.19 Automated backport to the 8.19 branch Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants