Skip to content

Conversation

@swang392
Copy link
Contributor

@swang392 swang392 commented Jan 16, 2026

What does this PR do?

Refactors shared Metadata:

  • separated sharedMetadata into sharedMetadata and baseForwarder
  • fetch clusterID once at startup, and do not start the metadata forwarder if this step fails (the metadata cannot be used by FA without cluster ID)
  • fix inconsistencies between metadata forwarder implementation -- payload method naming, constant organization, logging
  • Update tests to include a fakeClient with kube-system namespace to satisfy updated clusterId fetching mechanism

Motivation

What inspired you to submit this pull request?

Additional Notes

Anything else we should know when reviewing?

Minimum Agent Versions

Are there minimum versions of the Datadog Agent and/or Cluster Agent required?

  • Agent: vX.Y.Z
  • Cluster Agent: vX.Y.Z

Describe your test plan

Noop -- this is a refactor PR so there should be no change in functionality. Tested on abra https://github.com/DataDog/k8s-datadog-agent-ops/pull/7185 and confirmed that metadata for operator, helm and CRDs are being collected.

Checklist

  • PR has at least one valid label: bug, enhancement, refactoring, documentation, tooling, and/or dependencies
  • PR has a milestone or the qa/skip-qa label
  • All commits are signed (see: signing commits)

@codecov-commenter
Copy link

codecov-commenter commented Jan 16, 2026

Codecov Report

❌ Patch coverage is 58.66667% with 31 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.37%. Comparing base (43bd941) to head (2c644c2).

Files with missing lines Patch % Lines
cmd/main.go 0.00% 9 Missing ⚠️
pkg/controller/utils/metadata/operator_metadata.go 33.33% 8 Missing ⚠️
pkg/controller/utils/metadata/shared_metadata.go 80.00% 3 Missing and 3 partials ⚠️
pkg/controller/utils/metadata/crd_metadata.go 66.66% 3 Missing and 1 partial ⚠️
pkg/controller/utils/metadata/helm_metadata.go 66.66% 3 Missing and 1 partial ⚠️

❌ Your patch status has failed because the patch coverage (58.66%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2501      +/-   ##
==========================================
- Coverage   38.38%   38.37%   -0.01%     
==========================================
  Files         300      300              
  Lines       25555    25569      +14     
==========================================
+ Hits         9809     9813       +4     
- Misses      15002    15010       +8     
- Partials      744      746       +2     
Flag Coverage Δ
unittests 38.37% <58.66%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
pkg/controller/utils/metadata/crd_metadata.go 36.41% <66.66%> (+0.32%) ⬆️
pkg/controller/utils/metadata/helm_metadata.go 32.18% <66.66%> (+0.29%) ⬆️
pkg/controller/utils/metadata/shared_metadata.go 86.76% <80.00%> (+0.82%) ⬆️
pkg/controller/utils/metadata/operator_metadata.go 31.00% <33.33%> (-2.34%) ⬇️
cmd/main.go 10.62% <0.00%> (-0.24%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 43bd941...2c644c2. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@swang392 swang392 added this to the v1.23.0 milestone Jan 16, 2026
@swang392 swang392 marked this pull request as ready for review January 16, 2026 19:22
@swang392 swang392 requested a review from a team as a code owner January 16, 2026 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants