Skip to content

Conversation

@barryib
Copy link

@barryib barryib commented Jan 16, 2026

What is the purpose of the change

This pull request adds support for passing the Datadog API Key via an environment variable (DATADOG_API_KEY) instead of only through configuration properties. This enables secure credential management in containerized and cloud-native deployments where environment variables are commonly used.

Brief change log

  • Add DATADOG_API_KEY environment variable support in DatadogHttpReporterFactory
  • Configuration property apikey takes precedence over environment variable for backward compatibility
  • Environment variable provides fallback when no configuration property is provided
  • Add comprehensive test suite with 9 test cases covering environment variable support and various configuration scenarios

Resolves FLINK-36456

API Key Resolution Order

The API key is resolved in the following priority order:

  1. Configuration property apikey (if provided and non-empty)
  2. Environment variable DATADOG_API_KEY (fallback)
  3. null (if neither is provided)

Verifying this change

This change added tests and can be verified as follows:

  • Added 9 new test cases validating environment variable support:
    • testApiKeyFromConfiguration - Verifies API key from config works
    • testApiKeyFromEnvironmentVariable - Tests environment variable fallback
    • testConfigurationApiKeyTakesPrecedenceOverEnvironmentVariable - Ensures config takes priority
    • testDefaultProxyPort - Validates default proxy port (8080)
    • testCustomProxySettings - Tests custom proxy configuration
    • testDataCenterConfiguration - Verifies EU data center support
    • testMaxMetricsPerRequestConfiguration - Tests custom metrics per request
    • testTagsConfiguration - Validates tag configuration
    • testUseLogicalIdentifierConfiguration - Tests logical identifier flag
  • All existing tests remain unchanged and pass
  • The change is backward compatible with existing configurations

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): no
  • The public API, i.e., is any changed class annotated with @Public(Evolving): no
  • The serializers: no
  • The runtime per-record code paths (performance sensitive): no
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
  • The S3 file system connector: no

Documentation

  • Does this pull request introduce a new feature? yes
  • If yes, how is the feature documented? JavaDocs - The getApiKey() method includes comprehensive JavaDoc explaining the resolution order and behavior

@barryib barryib changed the title feat: Add support to pass Datadog API Key as environment variable [FLINK-36456] feat: Add support to pass Datadog API Key as environment variable Jan 16, 2026
@flinkbot
Copy link
Collaborator

flinkbot commented Jan 16, 2026

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

- Add DATADOG_API_KEY environment variable support in DatadogHttpReporterFactory
- Configuration property 'apikey' takes precedence over environment variable
- Environment variable provides fallback when no configuration is provided
- Add comprehensive test suite covering environment variable support and configuration scenarios

The API key resolution follows this order:
1. Configuration property 'apikey' (if provided and non-empty)
2. Environment variable 'DATADOG_API_KEY' (fallback)

This enhancement allows secure credential management using environment variables,
which is particularly useful in containerized and cloud deployments.

Signed-off-by: Thierno IB. BARRY <ibrahima.br@gmail.com>
@barryib barryib force-pushed the feature/datadog-api-key-env-var branch from 2659790 to 00bac62 Compare January 16, 2026 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants