Skip to content

Flink: Do not ship optional flink-metrics-dropwizard dependency#16155

Open
mxm wants to merge 17 commits intoapache:mainfrom
mxm:dropwizard
Open

Flink: Do not ship optional flink-metrics-dropwizard dependency#16155
mxm wants to merge 17 commits intoapache:mainfrom
mxm:dropwizard

Conversation

@mxm
Copy link
Copy Markdown
Contributor

@mxm mxm commented Apr 29, 2026

Flink does not bundle flink-metrics-dropwizard [1][2], which enables histogram metrics. Users need to manually include the dependency for histograms to work.

In Iceberg, we used to include the dependency in the flink-runtime jar. Ryan had removed the dependency in #16093 to avoid LICENSE issues, but we added it back in #16126 with the corresponding LICENSE changes, to avoid breaking changes for users.

After discussing with Peter, we decided to remove the bundling going forward (1.11.0 and later). This PR makes sure there are no regressions removing the dependency. I've updated the docs and the changelog to inform users of the change.

References:

  1. https://nightlies.apache.org/flink/flink-docs-stable/docs/ops/metrics/#histogram
  2. https://github.com/apache/flink/blob/ccf45727eeb2e920f7939f453db67a411e3cb109/flink-dist/pom.xml#L284

Flink does not bundle flink-metrics-dropwizard, which enables
histogram metrics. Users need to manually include the dependency for histograms
to work.

In Iceberg, we used to include the dependency in the flink-runtime jar. Ryan had
removed the dependency in apache#16093 to avoid LICENSE issues, but we added it back
in apache#16126 with the corresponding LICENSE changes, to avoid breaking changes for
users.

After discussing with Peter, we decided to remove the bundling going
forward. This PR makes sure there are no regressions removing the
dependency. I've updated the docs and the changelog to inform users of the change.

References:
- https://nightlies.apache.org/flink/flink-docs-stable/docs/ops/metrics/#histogram
- https://github.com/apache/flink/blob/ccf45727eeb2e920f7939f453db67a411e3cb109/flink-dist/pom.xml#L284
@manuzhang
Copy link
Copy Markdown
Member

we decided to remove the bundling going forward.

Do you mean after 1.11.0 release?

@mxm
Copy link
Copy Markdown
Contributor Author

mxm commented Apr 29, 2026

we decided to remove the bundling going forward.

Do you mean after 1.11.0 release?

For 1.11.0 already, unless there are any objections raised in this PR. I updated the description to state that.

Comment thread site/docs/releases.md Outdated
</dependencies>
```

### 1.11.0 release
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This will be published immediately while 1.11.0 is not released yet.

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.

Where do we put the pending release notes?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We don't have such a place. Maybe open an issue for @aihuaxu to track?

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.

I've reverted the change and created #16170. Unfortunately, I couldn't tag it with the release tag.

I wonder whether it would make sense to create a file in the repo with the pending release notes? Seems easier to maintain.

this.dataFilesSizeHistogram =
writerMetrics.histogram(
"dataFilesSizeHistogram",
new DropwizardHistogramWrapper(dropwizardDataFilesSizeHistogram));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I might miss something - just wonder why Flink's built-in DescriptiveStatisticsHistogram does not work here?

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.

@stevenzwu: Do you happen to remember why we chose DropwizardHistogramWrapper originally?

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.

According to the Flink docs, using Dropwizard metrics is still the official way to use Histogram metrics. DescriptiveStatisticsHistogram was added to flink-runtime for internal metrics around the same time of the initial implementation here. The semantics (e.g. bucketing) of the internal histogram are different. I would defer this to a follow-up, as the behavior of the implementation might change.


private static Histogram registerHistogram(MetricGroup group, String name) {
Histogram histogram = newDropwizardHistogram();
return histogram != null ? group.histogram(name, histogram) : null;
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.

Is group.histogram just the histogram that is passed to it? If so then you may not need this method. It looks good either way though.

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.

Yes, group.histogram registers the passed histogram and then returns it. I'd prefer to keep the method, because inlining would make the histogram initialization more verbose.

Copy link
Copy Markdown
Contributor

@rdblue rdblue left a comment

Choose a reason for hiding this comment

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

I'd probably opt to make the Ctor instances constants like @pvary suggests, but overall I think this looks good and that choice is up to @mxm.

Copy link
Copy Markdown
Contributor

@pvary pvary left a comment

Choose a reason for hiding this comment

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

I'm fine with either solution.
I leave to @mxm to decide what he prefers

@mxm
Copy link
Copy Markdown
Contributor Author

mxm commented May 6, 2026

I prefer keeping the CTORS wrapped in a static field. The PR is ready from my side.

Thank you for your thoughtful comments @pvary @rdblue @manuzhang @pan3793!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants