Skip to content

fix(sinks): separate Datadog validation from runtime construction - #26145

Open
kurochan wants to merge 1 commit into
vectordotdev:masterfrom
kurochan:improve-no-env
Open

fix(sinks): separate Datadog validation from runtime construction#26145
kurochan wants to merge 1 commit into
vectordotdev:masterfrom
kurochan:improve-no-env

Conversation

@kurochan

@kurochan kurochan commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Separate Datadog sink configuration validation from runtime construction.

In restricted environments such as CI, containers, and AI coding-agent sandboxes,
vector validate --no-environment is expected to validate structural configuration
without opening outbound connections or initializing runtime resources such as native
TLS trust stores.

Previously, Datadog sink validation could reach runtime client/TLS construction even
when no outbound request was made. In restricted sandbox environments, the macOS
Keychain may be unavailable; attempting to load native root certificates through it
caused validation to panic.

This PR makes the boundary explicit:

  • Move configuration-only validation for the Datadog logs, metrics, events, and
    traces sinks into ValidatedSink::validate.
  • Keep client, proxy, TLS, global Datadog option, and effective endpoint construction
    in the runtime build path.
  • Move the APM stats flusher from a build-time detached task into the
    TracesSink::run lifecycle.
    • Request a final flush after both successful and failed trace drivers.
    • Bound shutdown acknowledgement waiting to 10 seconds so a stuck endpoint cannot
      delay shutdown indefinitely.
  • Avoid unnecessary native certificate-store initialization when certificate
    verification is disabled.
  • Consolidate shared Datadog endpoint, TLS, and client construction logic to reduce
    sink-specific validation/build drift.

Regular vector validate continues to build all sinks and remains the validation
mode for errors that require effective runtime construction. --no-environment
intentionally does not guarantee detection of every runtime construction error.

The APM flusher acknowledgement confirms that the final flush was attempted; it does
not guarantee that Datadog accepted the payload.

References

N/A

Vector configuration

No new user configuration was added. Unit tests cover the Datadog logs, metrics,
events, and traces sinks with their existing inline configurations and custom
endpoints.

How did you test this PR?

  • cargo test -p vector --lib datadog
  • cargo test -p vector-core tls::settings::test
  • cargo test -p vector --lib sinks::datadog::traces::sink::tests
  • cargo check -p vector --lib
  • make check-clippy
  • cargo fmt --all -- --check
  • make check-changelog-fragments

Is this a breaking change?

  • Yes
  • No

Does this PR include user facing changes?

  • Yes. A changelog fragment will be added in a follow-up commit after the PR number is assigned.
  • No. A maintainer will apply the no-changelog label to this PR.

@github-actions github-actions Bot added domain: sinks Anything related to the Vector's sinks domain: core Anything related to core crates i.e. vector-core, core-common, etc labels Aug 19, 2026
@kurochan
kurochan force-pushed the improve-no-env branch 2 times, most recently from 39bef88 to 78bf4f2 Compare August 19, 2026 01:40
@kurochan
kurochan marked this pull request as ready for review August 19, 2026 01:41
@kurochan
kurochan requested a review from a team as a code owner August 19, 2026 01:41

@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: 78bf4f2fb0

ℹ️ 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 src/sinks/datadog/mod.rs
Comment on lines +130 to +135
pub fn validate_endpoint(&self) -> crate::Result<()> {
if let Some(endpoint) = &self.endpoint {
HttpEndpoint::parse(endpoint)?;
}

Ok(())

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Validate explicit sites when no endpoint is set

When endpoint is absent but site is explicitly malformed (for example, site = "bad site"), this helper returns Ok(()) without constructing the site-derived URL. The logs, metrics, and traces validators now rely on this helper, whereas their previous implementations parsed the URL derived from the configured site, so vector validate --no-environment now accepts a structurally unusable local configuration and defers the error until runtime construction. Validate a locally supplied site's derived base URL while continuing to defer values that come only from global runtime options.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codex fixed

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: core Anything related to core crates i.e. vector-core, core-common, etc domain: sinks Anything related to the Vector's sinks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant