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

Add support for datadog.profiling #1443

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

szegedi
Copy link
Collaborator

@szegedi szegedi commented Jul 4, 2024

What this PR does / why we need it:

Adds support for datadog.profiling variable to enable Continuous Profiler in pods.

Allows Continuous Profiler to be enabled (or disabled) by Helm Charts config on the controller pod. The cluster-agent, running on the controller pod, will read an environment variable and use this to mutate the configuration of other pods to set the environment variables that will activate profiling within the tracer/profiler client libraries.

Checklist

[Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated fields.]

  • Chart Version bumped
  • Documentation has been updated with helm-docs (run: .github/helm-docs.sh)
  • CHANGELOG.md has been updated
  • Variables are documented in the README.md
  • For Datadog Operator chart or value changes update the test baselines (run: make update-test-baselines)

Comment on lines 269 to 272
{{- if .Values.datadog.profiling.enabled }}
- name: DD_ADMISSION_CONTROLLER_AUTO_INSTRUMENTATION_PROFILING_ENABLED
value: {{ .Values.datadog.profiling.enabled | quote }}
{{- end }}
Copy link
Collaborator

Choose a reason for hiding this comment

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

After the reading the doc you created. I don't think this if does what you want it to do about nil values. cf helm chart docs

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think it does what I want (omits the env var on null), but it doesn't do what I want for "false" (which would be emitting explicit "false" value, but it also omits the env var) so I need to change that. Right now it's:

% helm template ./datadog --set datadog.profiling.enabled=null | grep PROFILING -A 1
% helm template ./datadog --set datadog.profiling.enabled=false | grep PROFILING -A 1
% helm template ./datadog --set datadog.profiling.enabled=auto | grep PROFILING -A 1
          - name: DD_ADMISSION_CONTROLLER_AUTO_INSTRUMENTATION_PROFILING_ENABLED
            value: "auto"
% helm template ./datadog --set datadog.profiling.enabled=true | grep PROFILING -A 1
          - name: DD_ADMISSION_CONTROLLER_AUTO_INSTRUMENTATION_PROFILING_ENABLED
            value: "true"

but with a change to the predicate to say {{- if not (eq .Values.datadog.profiling.enabled nil) }} it's doing what I'd expect it to. If there's maybe some other aspect that I'm not seeing, please let me know.

Comment on lines 529 to 531
## These will only have an effect on containers that have Datadog client libraries installed,
## either manually or via Single Step Instrumentation (under the `datadog.apm.instrumentation`
## section).
Copy link
Collaborator

Choose a reason for hiding this comment

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

If you follow the implementation ASM did in the cluster-agent then it will only trigger on pod with SSI and not those with manually installed library. Injecting vars into manually installed pods should be done by the end of Q3 following the work done by APM on service discovery.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I pretty much took over the comment from the ASM part as well – it, too, says "either manually or via Single Step Instrumentation" so I guess it should say the same in both places?

@eliottness eliottness added enhancement New feature or request chart/datadog This issue or pull request is related to the datadog chart labels Jul 9, 2024
@szegedi szegedi force-pushed the szegedi/profiling-ssi-kubernetes branch 3 times, most recently from 6947c77 to 1e57d7b Compare August 7, 2024 12:36
@szegedi szegedi force-pushed the szegedi/profiling-ssi-kubernetes branch from 1e57d7b to fc2f6aa Compare August 8, 2024 13:19
@szegedi szegedi force-pushed the szegedi/profiling-ssi-kubernetes branch from fc2f6aa to ac3a0b6 Compare September 10, 2024 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chart/datadog This issue or pull request is related to the datadog chart enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants