Skip to content

feat: Add APM to DatadogInstrumentation CRD#2984

Merged
betterengineering merged 1 commit into
mainfrom
mark.spicer/add-datadog-instrumentation-apm
May 8, 2026
Merged

feat: Add APM to DatadogInstrumentation CRD#2984
betterengineering merged 1 commit into
mainfrom
mark.spicer/add-datadog-instrumentation-apm

Conversation

@betterengineering

@betterengineering betterengineering commented May 6, 2026

Copy link
Copy Markdown
Member

What does this PR do?

This commit adds the schema required to utilize the DatadogInstrumentation CRD for APM. Relates to #2962

Example
apiVersion: datadoghq.com/v1alpha1
kind: DatadogInstrumentation
metadata:
  name: redis-check
  namespace: cache
spec:
  targetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: example-service
  config:
    apm:
      enabled: true
      ddTraceVersions:
        python: "3"
      ddTraceConfigs:
        - name: "DD_PROFILING_ENABLED"
          value: "true"

Motivation

Two relevant RFCs:

Additional Notes

All this adds is the schema. The consumer of this schema is the Datadog Cluster Agent.

Describe your test plan

Ran:

make generate
make manifests
go test ./api/...
bin/darwin-arm64/operator-sdk bundle validate ./bundle

Also verified make generate && make manifests produces no additional diff after generated files are up to date.

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)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1ed1d9455e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

config:
description: Config defines the Datadog instrumentation configuration to apply to the target workload.
properties:
apm:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Update the OLM bundle CRD with the APM schema

This adds spec.config.apm to the generated CRD under config/crd, but the stored OLM bundle CRD was not regenerated: bundle/manifests/datadoghq.com_datadoginstrumentations.yaml still has only config.properties.checks and no apm/ddTraceConfigs entry (verified with rg ddTraceConfigs bundle/manifests/datadoghq.com_datadoginstrumentations.yaml). Because bundle.Dockerfile copies bundle/manifests into the published bundle, installations through the operator bundle will install the old CRD and Kubernetes will prune spec.config.apm, so the Cluster Agent will never see the APM settings for those users.

Useful? React with 👍 / 👎.

@codecov-commenter

codecov-commenter commented May 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 40.74%. Comparing base (540be47) to head (5605095).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2984      +/-   ##
==========================================
- Coverage   40.76%   40.74%   -0.03%     
==========================================
  Files         332      332              
  Lines       28198    28274      +76     
==========================================
+ Hits        11495    11520      +25     
- Misses      15928    15979      +51     
  Partials      775      775              
Flag Coverage Δ
unittests 40.74% <ø> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 1 file with indirect coverage changes


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 540be47...5605095. Read the comment docs.

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

@datadog-prod-us1-5

datadog-prod-us1-5 Bot commented May 6, 2026

Copy link
Copy Markdown

Code Coverage

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 41.06% (-0.01%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 5605095 | Docs | Datadog PR Page | Give us feedback!

type DatadogInstrumentationAPMConfig struct {
// Enabled turns on APM via Single Step Instrumentation to automatically install the Datadog SDKs for supported
// languages with no additional configuration required.
Enabled bool `json:"enabled,omitempty"`

@Mathew-Estafanous Mathew-Estafanous May 6, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is an enabled section needed? The APM config already implies this based if the section is added (enabled) or removed (disabled).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The other two fields are optional and have default values. So I thought it would be weird if we did something like:

config:
  apm: {}

The current design looks like this, and it's what most users would need to do:

config:
  apm:
    enabled: true

I agree though, this case feels redundent:

config:
  apm:
    enabled: true
    ddTraceVersions:
      python: "3"

Do you think there is a way around this?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ahh I see. I can't think of anything better to be honest and apm: {} is definitely not the right choice. I'm good to keep enabled. 👍🏽

@Mathew-Estafanous Mathew-Estafanous left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks great!

This commit adds the schema required to utilize the
DatadogInstrumentation CRD for APM.
@betterengineering
betterengineering force-pushed the mark.spicer/add-datadog-instrumentation-apm branch from 3d07f44 to 5605095 Compare May 8, 2026 15:53
@betterengineering
betterengineering merged commit d97a3dc into main May 8, 2026
49 of 57 checks passed
@betterengineering
betterengineering deleted the mark.spicer/add-datadog-instrumentation-apm branch May 8, 2026 16:18
@betterengineering betterengineering added the backport label added by backport action label May 8, 2026
Mathew-Estafanous added a commit that referenced this pull request May 12, 2026
This commit adds the schema required to utilize the
DatadogInstrumentation CRD for APM.

(cherry picked from commit d97a3dc)

Co-authored-by: Mark Spicer <[email protected]>
Co-authored-by: Mathew Estafanous <[email protected]>
Mathew-Estafanous added a commit that referenced this pull request May 14, 2026
gh-worker-dd-mergequeue-cf854d Bot pushed a commit that referenced this pull request May 14, 2026
Revert "fix: make apm config a pointer (#2995)"

This reverts commit 6416ca2.

Revert "feat: Add APM to DatadogInstrumentation CRD (#2984)"

This reverts commit d97a3dc.

Co-authored-by: mathew.estafanous <[email protected]>
Mathew-Estafanous added a commit that referenced this pull request May 14, 2026
…3017)

Revert "fix: make apm config a pointer (#2995)"

This reverts commit 6416ca2.

Revert "feat: Add APM to DatadogInstrumentation CRD (#2984)"

This reverts commit d97a3dc.

Co-authored-by: mathew.estafanous <[email protected]>

(cherry picked from commit 6d3740a)
tbavelier pushed a commit that referenced this pull request May 20, 2026
Revert "fix: make apm config a pointer (#2995)"

This reverts commit 6416ca2.

Revert "feat: Add APM to DatadogInstrumentation CRD (#2984)"

This reverts commit d97a3dc.

Co-authored-by: mathew.estafanous <[email protected]>
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