Skip to content

[FLINK-39130][metrics] Allow native types in MetricConfig#27642

Merged
1996fanrui merged 1 commit intoapache:masterfrom
Izeren:FLINK-39126/support-metric-export-batching
Feb 25, 2026
Merged

[FLINK-39130][metrics] Allow native types in MetricConfig#27642
1996fanrui merged 1 commit intoapache:masterfrom
Izeren:FLINK-39126/support-metric-export-batching

Conversation

@Izeren
Copy link
Copy Markdown
Contributor

@Izeren Izeren commented Feb 20, 2026

What is the purpose of the change

This allows using native types for the MetricConfig. Example usage is for FLIP-553 to allow configuring metric export batch size as: 1500 rather than "1500"

Brief change log

  • Add support for MetricConfig to recognize Number values.

Verifying this change

  • Unit tests for MetricConfig.java

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

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

Documentation

  • Does this pull request introduce a new feature? (yes / no)
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)

@flinkbot
Copy link
Copy Markdown
Collaborator

flinkbot commented Feb 20, 2026

CI report:

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

// -- String values via setProperty (legacy behavior) --

@Test
void testGetIntegerFromString() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I am wondering whether we could have a parameterized test for this. As the tests are basically the same for each native type.

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.

For defaults and strings, makes sense, will do. For "cross" not sure it is going to be more readable

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

that split makes sense

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.

Actually, I have tried it out, and for cross it is still more readable, so I made all categories parametrized

@Izeren Izeren force-pushed the FLINK-39126/support-metric-export-batching branch from 183bee7 to ba37c11 Compare February 23, 2026 10:33
Copy link
Copy Markdown
Member

@1996fanrui 1996fanrui left a comment

Choose a reason for hiding this comment

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

Thanks for the fix, IIUC, this is a bug for all 2.x series, right?

If so, would you mind backporting it to all 2.x branch? thanks in advance.

@Izeren
Copy link
Copy Markdown
Contributor Author

Izeren commented Feb 23, 2026

@1996fanrui, I am not sure whether it is a "bug". Because MetricConfig was never supporting numbers provided not as strings. If you believe it is beneficial, I can backport it once it is merged

@Izeren
Copy link
Copy Markdown
Contributor Author

Izeren commented Feb 23, 2026

@1996fanrui, actually, I now think you are right and it was a regression in 2.0 since YAML parser was introduced which was able to process native types and not store them as strings. I will convert this subtask into bug and will backport this in previous 2 versions as well once we get this one merged

@1996fanrui
Copy link
Copy Markdown
Member

@1996fanrui, actually, I now think you are right and it was a regression in 2.0 since YAML parser was introduced which was able to process native types and not store them as strings. I will convert this subtask into bug and will backport this in previous 2 versions as well once we get this one merged

Thanks for looking into! Let's leave this open for a while to see if there are any other comments before merging.

@Izeren
Copy link
Copy Markdown
Contributor Author

Izeren commented Feb 25, 2026

@1996fanrui, I have created backport PRs for the last 2 releases:
#27670
#27671

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.

4 participants