Skip to content

Add process autodiscovery infrastructure and support to krakend#24238

Draft
vitkyrka wants to merge 1 commit into
vitkyrka/ddev-agent-envfrom
vitkyrka/disco-config-process
Draft

Add process autodiscovery infrastructure and support to krakend#24238
vitkyrka wants to merge 1 commit into
vitkyrka/ddev-agent-envfrom
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.

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

Pipelines  Tests  Code Coverage

Fix all issues with BitsAI

⚠️ Warnings

🚦 2 Pipeline jobs failed

PR All | test / j06ca546 / SNMP   View in Datadog   GitHub Actions

PR | test / check   View in Datadog   GitHub Actions

🧪 1 Test failed in 1 job

PR All | run   GitHub Actions

All test failures are known flaky — job may pass on retry.

❄️ Known flaky: test_e2e_snmp_listener from test_e2e_snmp_listener.py   View in Datadog
Needed at least 1 candidates for &#39;datadog.snmp.check_duration&#39;, got 0
Expected:
        MetricStub(name=&#39;datadog.snmp.check_duration&#39;, type=0, value=None, tags=[&#39;autodiscovery_subnet:172.18.0.0/28&#39;, &#39;device_vendor:apc&#39;, &#39;firmware_version:2.0.3-test&#39;, &#39;loader:python&#39;, &#39;model:APC Smart-UPS 600&#39;, &#39;serial_num:test_serial&#39;, &#39;snmp_device:172.18.0.1&#39;, &#39;snmp_profile:apc_ups&#39;, &#39;ups_name:testIdentName&#39;], hostname=None, device=None, flush_first_value=None)
Difference to closest:
        Expected tag snmp_device:172.18.0.1
        Found snmp_device:172.18.0.2

Similar submitted:
Score   Most similar
1.00    MetricStub(name=&#39;datadog.snmp.check_duration&#39;, type=0, value=0.21939873695373535, tags=[&#39;autodiscovery_subnet:172.18.0.0/28&#39;, &#39;device_vendor:apc&#39;, &#39;firmware_version:2.0.3-test&#39;, &#39;loader:python&#39;, &#39;model:APC Smart-UPS 600&#39;, &#39;serial_num:test_serial&#39;, &#39;snmp_device:172.18.0.2&#39;, &#39;snmp_profile:apc_ups&#39;, &#39;ups_name:testIdentName&#39;], hostname=&#39;runnervmjbsos&#39;, device=None, flush_first_value=False)
...

Not introduced in this PR.

ℹ️ Info

No other issues found (see more)

❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 57.14%
Overall Coverage: 88.13% (+0.00%)

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: cbbf8e2 | 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 marked this pull request as ready for review July 1, 2026 09:51
@vitkyrka vitkyrka marked this pull request as draft July 1, 2026 14:34
@vitkyrka vitkyrka force-pushed the vitkyrka/disco-config-process branch 2 times, most recently from 70374be to 669d600 Compare July 1, 2026 16:05
@vitkyrka vitkyrka changed the base branch from master to graphite-base/24238 July 1, 2026 16:29
@vitkyrka vitkyrka force-pushed the vitkyrka/disco-config-process branch from 669d600 to 377010f Compare July 1, 2026 16:29
@vitkyrka vitkyrka changed the base branch from graphite-base/24238 to vitkyrka/ddev-agent-env July 1, 2026 16:29

vitkyrka commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

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 377010f to cbbf8e2 Compare July 1, 2026 16:32
@vitkyrka vitkyrka force-pushed the vitkyrka/ddev-agent-env branch from 8d60800 to b585bc6 Compare July 1, 2026 16:32
@dd-octo-sts

dd-octo-sts Bot commented Jul 1, 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

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.

1 participant