datadog-operator icon indicating copy to clipboard operation
datadog-operator copied to clipboard

DatadogAgentProfiles valid metric

Open khewonc opened this issue 1 year ago • 1 comments

What does this PR do?

Includes code from https://github.com/DataDog/datadog-operator/pull/1224, which should be merged first

Adds a metric for valid/invalid DatadogAgentProfiles:

# HELP datadogagentprofile_valid 1 if the DatadogAgentProfile is valid. 0 if the DatadogAgentProfile is invalid
# TYPE datadogagentprofile_valid gauge
datadogagentprofile_valid{datadogagentprofile="dap-test"} 1
datadogagentprofile_valid{datadogagentprofile="invalid-dap"} 0

Motivation

https://datadoghq.atlassian.net/browse/CECO-1241

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

  • Spin up an operator with profiles enabled
  • Apply a DDA and a valid profile and an invalid profile (one way is to remove the profileAffinity section)
  • Check that the metric datadog.operator.datadogagentprofile_valid in app (or datadogagentprofile_valid with curl) with tag datadogagentprofile:xxx has a value of 1 for the valid profile and 0 for the invalid profile
# check via curl (below) or in app
kubectl exec -it <operator> -- curl localhost:8383/metrics
  • Delete one or both of the profiles
  • Check that the corresponding metric(s) is deleted

Checklist

  • [x] PR has at least one valid label: bug, enhancement, refactoring, documentation, tooling, and/or dependencies
  • [x] PR has a milestone or the qa/skip-qa label

khewonc avatar Jun 21 '24 19:06 khewonc

Codecov Report

:x: Patch coverage is 46.66667% with 8 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 54.98%. Comparing base (d0f739b) to head (3119d08). :warning: Report is 485 commits behind head on main.

Files with missing lines Patch % Lines
controllers/datadogagent_controller.go 20.00% 3 Missing and 1 partial :warning:
controllers/metrics/datadogagentprofile.go 33.33% 2 Missing :warning:
...ontrollers/datadogagent/controller_reconcile_v2.go 75.00% 1 Missing :warning:
pkg/agentprofile/agent_profile.go 66.66% 1 Missing :warning:

:x: Your patch status has failed because the patch coverage (46.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    #1245      +/-   ##
==========================================
- Coverage   54.99%   54.98%   -0.02%     
==========================================
  Files         243      243              
  Lines       28023    28031       +8     
==========================================
+ Hits        15411    15412       +1     
- Misses      11741    11747       +6     
- Partials      871      872       +1     
Flag Coverage Δ
unittests 54.98% <46.66%> (-0.02%) :arrow_down:

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

Files with missing lines Coverage Δ
...ontrollers/datadogagent/controller_reconcile_v2.go 53.91% <75.00%> (ø)
pkg/agentprofile/agent_profile.go 63.35% <66.66%> (+0.03%) :arrow_up:
controllers/metrics/datadogagentprofile.go 66.66% <33.33%> (-33.34%) :arrow_down:
controllers/datadogagent_controller.go 67.82% <20.00%> (-2.98%) :arrow_down:

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 d0f739b...3119d08. Read the comment docs.

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

codecov-commenter avatar Jun 21 '24 19:06 codecov-commenter