Skip to content

Add process autodiscovery infrastructure and support to krakend - #24238

Merged
vitkyrka merged 7 commits into
masterfrom
vitkyrka/disco-config-process
Jul 20, 2026
Merged

Add process autodiscovery infrastructure and support to krakend#24238
vitkyrka merged 7 commits into
masterfrom
vitkyrka/disco-config-process

Conversation

@vitkyrka

@vitkyrka vitkyrka commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds process autodiscovery infrastructure, and support to the krakend integration. When krakend runs as a process in environments without containers, the agent's process autodiscovery listener matches it via a CEL expression and the existing configuration discovery flow finds the metrics endpoint and schedules the check automatically.

The essential change to add the support to krakend is the change to auto_conf.yaml (regenerated from spec.yaml). The other changes are infrastructure to allow process autodiscovery support to be added to integrations and to be E2E tested while keeping the amount of changes required in each integration relatively small.

The main challenge is cleanly re-using the existing container-based E2E infrastructure for process autodiscovery testing without running krakend as a true host process (since that would require a lot of extra work in each integration's tests to set up the respective services without using containers).

The chosen approach is to keep the existing Docker Compose setup unchanged and instead hide the containers from the agent by setting DD_AUTOCONFIG_EXCLUDE_FEATURES=docker, which makes the agent's process autodiscovery component handle the processes as normal host processes. This environment variable is pass to the agent check invocation. The Docker environment for the agent also needs a few extra caps and config options for the processes tests, but these options should not affect the container-based tests.

Note that the PR drops the mostly useless test_get_e2e_discovery_metadata test which doesn't add much value since it needs 1:1 update every time some metadata is added to get_e2e_discovery_metadata (like in this PR), and it also can't even call get_e2e_discovery_metadata in the way that tests actually do (auto check_root computation), so it doesn't catch any bugs either.

Motivation

https://datadoghq.atlassian.net/browse/DSCVR-493

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Add qa/required if this PR needs QA validation, or qa/skip-qa if it does not. Exactly one of the two is required.
  • If you need to backport this PR to another branch, you can add the backport/<branch-name> label to the PR and it will automatically open a backport PR once this one is merged

@datadog-prod-us1-4

datadog-prod-us1-4 Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Tests  Code Coverage

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 0.00%
Overall Coverage: 88.37%

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

@dd-octo-sts dd-octo-sts Bot added the ddev label Jun 29, 2026
@vitkyrka
vitkyrka force-pushed the vitkyrka/disco-config-process branch 2 times, most recently from e2025d0 to 504c1b2 Compare June 29, 2026 15:17
@vitkyrka
vitkyrka force-pushed the vitkyrka/disco-config-process branch from 6ed4871 to baaed78 Compare June 30, 2026 16:08

Copy link
Copy Markdown
Contributor Author

@codex review

@vitkyrka vitkyrka changed the title Add process autodiscovery support for krakend Add process autodiscovery infrastructure and support to krakend Jun 30, 2026

@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: baaed78950

ℹ️ 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".

Comment thread krakend/tests/conftest.py Outdated
@vitkyrka
vitkyrka marked this pull request as ready for review July 1, 2026 07:57
@vitkyrka
vitkyrka requested review from a team as code owners July 1, 2026 07:57
@vitkyrka
vitkyrka requested a review from a team July 1, 2026 07:58

@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: c04e675036

ℹ️ 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".

Comment thread krakend/hatch.toml Outdated
@vitkyrka
vitkyrka removed the request for review from a team July 1, 2026 08:27
@vitkyrka
vitkyrka marked this pull request as draft July 1, 2026 08:45
@vitkyrka
vitkyrka force-pushed the vitkyrka/disco-config-process branch from c04e675 to 010a0d8 Compare July 1, 2026 09:25
@vitkyrka
vitkyrka force-pushed the vitkyrka/disco-config-process branch 2 times, most recently from 8cab8bf to 98f90cd Compare July 2, 2026 12:43
@vitkyrka
vitkyrka marked this pull request as ready for review July 2, 2026 13:24
@jeff-morgan-dd jeff-morgan-dd self-assigned this Jul 2, 2026
jeff-morgan-dd
jeff-morgan-dd previously approved these changes Jul 2, 2026
@vitkyrka
vitkyrka force-pushed the vitkyrka/disco-config-process branch 2 times, most recently from 34b7658 to d34a050 Compare July 13, 2026 09:13
Base automatically changed from vitkyrka/ddev-agent-env to master July 13, 2026 10:06
vitkyrka and others added 5 commits July 13, 2026 10:07
Adds process-based autodiscovery for krakend, on top of the existing
container-based autodiscovery, using a CEL selector to match the
krakend process by name. Both flavors run as parametrized variants of
the same e2e test in a single environment: the process variant scopes
DD_AUTOCONFIG_EXCLUDE_FEATURES=docker to just that discovery invocation
(via the new ddev --env support) so that invocation's autodiscovery run
never learns about containers, letting the otherwise container-bound
krakend process be matched by process-based autodiscovery instead.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@vitkyrka
vitkyrka force-pushed the vitkyrka/disco-config-process branch from d34a050 to 16a25d4 Compare July 13, 2026 11:01
@temporal-github-worker-1
temporal-github-worker-1 Bot dismissed jeff-morgan-dd’s stale review July 13, 2026 11:01

Review from jeff-morgan-dd is dismissed. Related teams and files:

  • documentation
    • krakend/assets/configuration/spec.yaml
    • krakend/datadog_checks/krakend/data/auto_conf.yaml
vitkyrka and others added 2 commits July 13, 2026 12:01
…s flag

Only krakend needs the process-autodiscovery env vars and capabilities;
returning them unconditionally to all 8 callers grants unneeded caps to
7 unrelated integrations and, for ray, silently clobbers its own env_vars
via a shallow dict merge.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
AGENTS.md only permits a leading underscore on class instance methods
or non-obvious-behavior helpers in reusable library modules; this is a
plain module-level free function, so it shouldn't have one.

Environment: Datadog workspace

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@dd-octo-sts

dd-octo-sts Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Validation Report

All 21 validations passed.

Show details
Validation Description Status
agent-reqs Verify check versions match the Agent requirements file
ci Validate CI configuration and code coverage settings
codeowners Validate every integration has a CODEOWNERS entry
config Validate default configuration files against spec.yaml
dep Verify dependency pins are consistent and Agent-compatible
http Validate integrations use the HTTP wrapper correctly
imports Validate check imports do not use deprecated modules
integration-style Validate check code style conventions
jmx-metrics Validate JMX metrics definition files and config
labeler Validate PR labeler config matches integration directories
legacy-signature Validate no integration uses the legacy Agent check signature
license-headers Validate Python files have proper license headers
licenses Validate third-party license attribution list
metadata Validate metadata.csv metric definitions
models Validate configuration data models match spec.yaml
openmetrics Validate OpenMetrics integrations disable the metric limit
package Validate Python package metadata and naming
qa-label Validate the pull request declares whether it needs QA for the next Agent release
readmes Validate README files have required sections
saved-views Validate saved view JSON file structure and fields
version Validate version consistency between package and changelog

View full run

@vitkyrka
vitkyrka added this pull request to the merge queue Jul 20, 2026
Merged via the queue into master with commit 5f35075 Jul 20, 2026
395 of 399 checks passed
@vitkyrka
vitkyrka deleted the vitkyrka/disco-config-process branch July 20, 2026 07:11
@dd-octo-sts dd-octo-sts Bot added this to the 7.83.0 milestone Jul 20, 2026
github-actions Bot pushed a commit that referenced this pull request Jul 20, 2026
* process autodiscovery for krakend

Adds process-based autodiscovery for krakend, on top of the existing
container-based autodiscovery, using a CEL selector to match the
krakend process by name. Both flavors run as parametrized variants of
the same e2e test in a single environment: the process variant scopes
DD_AUTOCONFIG_EXCLUDE_FEATURES=docker to just that discovery invocation
(via the new ddev --env support) so that invocation's autodiscovery run
never learns about containers, letting the otherwise container-bound
krakend process be matched by process-based autodiscovery instead.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* assert

* comment

* time

* drop

* Gate get_e2e_discovery_metadata's process-AD env/caps behind a process flag

Only krakend needs the process-autodiscovery env vars and capabilities;
returning them unconditionally to all 8 callers grants unneeded caps to
7 unrelated integrations and, for ray, silently clobbers its own env_vars
via a shallow dict merge.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Remove leading underscore from assert_discovery_used_expected_mechanism

AGENTS.md only permits a leading underscore on class instance methods
or non-obvious-behavior helpers in reusable library modules; this is a
plain module-level free function, so it shouldn't have one.

Environment: Datadog workspace

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com> 5f35075
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