jonathansudhakar1 commented on issue #20319: URL: https://github.com/apache/beam/issues/20319#issuecomment-7313737466
@stankiewicz, this still applies on current master. `WriteToSpannerFn` counts batches and mutation groups (received, succeeded, failed), plus latency, timeouts and retries ([counters](https://github.com/apache/beam/blob/91c391fb67d342c20dbe4fa167e8fd5a60ecb743/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/spanner/SpannerIO.java#L2915-L2938)). It reports nothing about bytes, so a running job's metrics don't show how much data has been written. Proposed change (small, Java only), if it's still wanted: - **One new counter**, `spanner_write_bytes`, in the same `WriteGrouped` namespace as the others (the name is open). It's incremented by `MutationSizeEstimator.sizeOf` for each mutation group, but only after that group commits: the whole batch on the batch path, or each group that succeeds on the per-group retry path under `REPORT_FAILURES` ([processElement](https://github.com/apache/beam/blob/91c391fb67d342c20dbe4fa167e8fd5a60ecb743/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/spanner/SpannerIO.java#L2997-L3041)). Failed groups aren't counted. - **What it measures:** the same mutation-size estimate that `withBatchSizeBytes` uses, not bytes on the wire. The comment on the counter would say so. - **Cost:** one more `sizeOf` pass per group. The batching steps already compute it ([filter](https://github.com/apache/beam/blob/91c391fb67d342c20dbe4fa167e8fd5a60ecb743/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/spanner/SpannerIO.java#L2878), [gather](https://github.com/apache/beam/blob/91c391fb67d342c20dbe4fa167e8fd5a60ecb743/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/spanner/SpannerIO.java#L2742)). Passing the size along from there would change the batch element type, so I'd rather recompute it. - **Tests:** new `SpannerIOWriteTest` cases with the existing fakes. They'd check the counter for the batch path, for the `REPORT_FAILURES` retry path (only the groups that succeed are counted), and for `FAIL_FAST` (nothing is counted for a failed batch). Is a byte counter still useful here? If so, is a plain counter fine, or would you rather have something else, such as a distribution of bytes per batch? -- 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]
