Skip to content

Add container-based config discovery support for gitlab_runner - #24608

Draft
martavicentenavarro wants to merge 1 commit into
masterfrom
feat/martavicentenavarro/DSCVR-485-gitlab_runner-config-discovery
Draft

Add container-based config discovery support for gitlab_runner#24608
martavicentenavarro wants to merge 1 commit into
masterfrom
feat/martavicentenavarro/DSCVR-485-gitlab_runner-config-discovery

Conversation

@martavicentenavarro

@martavicentenavarro martavicentenavarro commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds container-based config discovery support to gitlab_runner, using a manual from_ports strategy targeting the default metrics port (9252).

  • gitlab_url, prometheus_url, and allowed_metrics are now optional in the spec, since discovery can't derive them from a container.
  • allowed_metrics defaults to [] instead of raising when omitted, so discovery-generated instances don't crash at runtime (covered by a new regression test).
  • Clarified the allowed_metrics spec example, regenerated conf.yaml.example, and documented discovery prerequisites in the README.

Known gap: discovery can't derive gitlab_url, so the gitlab_runner.can_connect service check is never emitted for auto-discovered instances. test_e2e_discovery only asserts the Prometheus service check for this reason.

Motivation

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

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

@martavicentenavarro

Copy link
Copy Markdown
Contributor Author

@codex review

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

ℹ️ 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 gitlab_runner/datadog_checks/gitlab_runner/data/conf.yaml.example
@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Jul 20, 2026

Copy link
Copy Markdown

Tests  Code Coverage

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 94.27% (+5.91%)

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

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: 2b1b9439de

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

Adds container-based config discovery support to gitlab_runner using a manual from_ports strategy targeting the default metrics port (9252).

Relaxes gitlab_url, prometheus_url, and allowed_metrics from required to optional in the spec so discovery-generated candidates pass validation, and defaults allowed_metrics to an empty list instead of raising when it's absent from init_config.

Also clarifies the allowed_metrics spec example, regenerates conf.yaml.example, and documents discovery prerequisites and the gitlab_runner.can_connect gap in the README.

Environment: Datadog workspace

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@martavicentenavarro
martavicentenavarro force-pushed the feat/martavicentenavarro/DSCVR-485-gitlab_runner-config-discovery branch from 8335eef to 99e0bec Compare July 24, 2026 13:26
@dd-octo-sts

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