Skip to content

[FLINK-40592][metrics] Fix PushGateway basic authentication without JAXB - #29151

Open
weicheng-07 wants to merge 1 commit into
apache:masterfrom
weicheng-07:flink-40592-pushgateway-basic-auth
Open

[FLINK-40592][metrics] Fix PushGateway basic authentication without JAXB#29151
weicheng-07 wants to merge 1 commit into
apache:masterfrom
weicheng-07:flink-40592-pushgateway-basic-auth

Conversation

@weicheng-07

@weicheng-07 weicheng-07 commented Sep 10, 2026

Copy link
Copy Markdown

What is the purpose of the change

Fixes FLINK-40592.
Configuring both credentials causes PrometheusPushGatewayReporter to fail during initialization when JAXB is absent. Use JDK Base64 encoding so Basic authentication no longer requires JAXB.

Brief change log

  • Add a private connection factory that encodes the Authorization header with UTF-8 and java.util.Base64, preserving the default connection factory and existing credential behavior.
  • Add six parameterized cases that isolate JAXB and verify Authorization headers on HTTP PUT and DELETE, including non-ASCII, empty, absent, and incomplete credentials.

Verifying this change

Local verification was performed before applying the patch to the latest master, preserving the two changed files byte for byte.

  • ./mvnw -Djdk17 -Pjava17-target -pl flink-metrics/flink-metrics-prometheus clean verify passed on macOS aarch64 with JDK 17 and Maven 3.9.16: 34 tests, including all six new cases; Checkstyle, Spotless, and japicmp passed.
  • Before the fix, the same new test reproduces three JAXB initialization errors; the other three cases pass.
  • Packaged-JAR checks reproduced the baseline failure. With the fix, all six cases passed using Java 11-targeted artifacts on Java 11 and Java 17-targeted artifacts on Java 17 and 21.
  • Community Azure Pipelines build #78940 passed for commit 6f0650c, including compilation, QA checks, all six module test groups, and all four E2E groups.

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): yes — the reporter is @PublicEvolving; only private implementation changes, with no public signature or configuration changes.
  • The serializers: no.
  • The runtime per-record code paths (performance sensitive): no.
  • Anything that affects deployment or recovery: no; the change is limited to metrics reporter authentication.
  • The S3 file system connector: no.

Documentation

  • Does this pull request introduce a new feature? no.
  • If yes, how is the feature documented? not applicable.

Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: OpenAI Codex 0.153.4

Encode the Basic Authorization header with JDK Base64 and UTF-8 while
preserving the default connection factory and credential configuration.
Cover PUT and DELETE requests with regression tests that isolate JAXB.

Generated-by: OpenAI Codex 0.153.4
@flinkbot

flinkbot commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

CI report:

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

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