qiuyanjun888 opened a new pull request, #28438: URL: https://github.com/apache/flink/pull/28438
## What is the purpose of the change Flink `Counter` values are not guaranteed to be monotonic because counters support `dec()` and `inc()` with negative values. The OpenTelemetry reporter currently drops negative deltas when converting counters, which can lose valid counter updates. This pull request preserves non-incremental counter deltas by exporting Flink counters as non-monotonic delta sums. Jira: https://issues.apache.org/jira/browse/FLINK-39893 ## Brief change log - Mark converted OpenTelemetry counter sums as non-monotonic. - Keep negative counter deltas instead of dropping them. - Add a regression test for a negative/non-incremental counter delta. ## Verifying this change This change added tests and can be verified as follows: - `./mvnw -pl flink-metrics/flink-metrics-otel -Dtest=OpenTelemetryMetricAdapterTest -DskipITs -Dfast test` - `./mvnw -pl flink-metrics/flink-metrics-otel -Dtest=OpenTelemetryMetricAdapterTest,OpenTelemetryMetricReporterTest -DskipITs -Dfast test` - `./mvnw -pl flink-metrics/flink-metrics-otel -DskipTests -DskipITs -Dfast -Drat.skip=true spotless:check checkstyle:check` I also ran the full `flink-metrics-otel` module tests. The non-container unit tests passed, but the module-level run could not complete in this environment because Testcontainers could not find `/var/run/docker.sock` for the OpenTelemetry protocol/container tests. ## 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? no --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes (please specify the tool below) Generated-by: Hermes Agent (OpenAI GPT-5.5) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
