Skip to content

Comments

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

Open
Izeren wants to merge 1 commit intoapache:masterfrom
Izeren:FLINK-39126/support-metric-export-batching
Open

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

Conversation

@Izeren
Copy link
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
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

public int getInteger(String key, int defaultValue) {
String argument = getProperty(key, null);
return argument == null ? defaultValue : Integer.parseInt(argument);
final Object value = get(key);
Copy link
Contributor

Choose a reason for hiding this comment

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

I am looking at the the flip this looks like the last subtask to to in it.

But all the callers to MetricConfig will still call getString. It looks like we re missing another task to change the callers to call the appropriate native getter. Or better still add in the callers to this PR

Copy link
Contributor Author

@Izeren Izeren Feb 23, 2026

Choose a reason for hiding this comment

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

As part of the FLIP, I will introduce additional configs, like batch_size and my intention is to use it with getInt. I could include both changes in 1 PR as separate commits, however this change is rather a dependency than a part of the same "feature", so I have turned it into subtask on its own

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

@Test
void testGetIntegerFromString() {
Copy link
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
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
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
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
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.

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