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 otel collector configdata annotations #1628

Merged
merged 1 commit into from
Jan 17, 2025
Merged

Conversation

khewonc
Copy link
Contributor

@khewonc khewonc commented Jan 16, 2025

What does this PR do?

  • Add annotations for otel configdata
  • Use pointer receivers to match other features

Motivation

When changing configdata, the pod was not restarting to use the updated configmap data

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

  • Create a DDA with otel enabled and configdata set. Example:
    conf:
    configData: |-
    receivers:
    otlp:
    protocols:
    grpc:
    endpoint: 0.0.0.0:4317
    http:
    endpoint: 0.0.0.0:4318
    exporters:
    debug:
    verbosity: detailed
    datadog:
    api:
    key: ${env:DD_API_KEY}
    processors:
    batch:
    connectors:
    service:
    pipelines:
    traces:
    receivers: [otlp]
    processors: [batch]
    exporters: [datadog]
    metrics:
    receivers: [otlp]
    processors: [batch]
    exporters: [datadog]
    logs:
    receivers: [otlp]
    processors: [batch]
    exporters: [datadog]
  • Ensure the node agent pod and otel configmap (<dda-name>-otel-agent-config) have the same annotation checksum/otel_agent-custom-config: <md5-hash>
  • Change the DDA otel configdata section and apply the changes. For example, change endpoint: 0.0.0.0:4317 to endpoint: 0.0.0.0:3333
  • The node agent pod should restart. Ensure the new agent pod and otel configmap's checksum/otel_agent-custom-config has changed from the previous value
  • Check that the changes from configdata are reflected in the otel agent by exec'ing into the otel-agent container and looking at the otel-config.yaml file:
kubectl exec -it -c otel-agent -- bash
cat /etc/datadog-agent/otel-config.yaml

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

@khewonc khewonc added the bug Something isn't working label Jan 16, 2025
@khewonc khewonc added this to the v1.12.0 milestone Jan 16, 2025
@khewonc khewonc requested a review from a team as a code owner January 16, 2025 15:36
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 66.66667% with 10 lines in your changes missing coverage. Please review.

Project coverage is 48.84%. Comparing base (bc3a576) to head (2798ece).

Files with missing lines Patch % Lines
...ller/datadogagent/feature/otelcollector/feature.go 66.66% 8 Missing and 2 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1628      +/-   ##
==========================================
+ Coverage   48.82%   48.84%   +0.02%     
==========================================
  Files         217      217              
  Lines       20874    20894      +20     
==========================================
+ Hits        10191    10205      +14     
- Misses      10147    10151       +4     
- Partials      536      538       +2     
Flag Coverage Δ
unittests 48.84% <66.66%> (+0.02%) ⬆️

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

Files with missing lines Coverage Δ
...ller/datadogagent/feature/otelcollector/feature.go 86.50% <66.66%> (-2.31%) ⬇️

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 bc3a576...2798ece. Read the comment docs.

@khewonc khewonc merged commit 4919aee into main Jan 17, 2025
21 checks passed
@khewonc khewonc deleted the khewonc/otel-cd-annotations branch January 17, 2025 14:42
swang392 added a commit that referenced this pull request Jan 17, 2025
Co-authored-by: khewonc <39867936+khewonc@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants