We have a few transform-level tests where we check counter behavior in Mozilla's telemetry pipeline codebase. See:
https://github.com/mozilla/gcp-ingestion/blob/fa98ac0c8fa09b5671a961062e6cf0985ec48b0e/ingestion-beam/src/test/java/com/mozilla/telemetry/decoder/GeoIspLookupTest.java#L77-L83 But I'm not familiar with how much metrics testing exists within the apache/beam codebase. On Wed, Sep 1, 2021 at 12:08 AM Enis Sert <[email protected]> wrote: > Hi, > > I'm planning to add an `org.apache.beam.sdk.metrics.Counter` to my Beam > PR and bump it when some event happens, similar to > https://github.com/apache/beam/blob/master/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryServicesImpl.java#L988. > However, I couldn't figure out how to test it with unit tests (i.e. I can't > verify that the counter is incremented at all, but I can verify that > the block containing it is executed). Can someone share an example? > > Thanks, > esert >
