You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "alxd112 (via GitHub)" <gi...@apache.org> on 2024/05/31 10:21:14 UTC
[PR] Feature add metrics counting the number of bytes read/written from/to GCS bucket per job [beam]
alxd112 opened a new pull request, #31466:
URL: https://github.com/apache/beam/pull/31466
addresses #31465
Added new metrics that can be enabled via the following command line flags: "--enable_bucket_read_metric_counter" and "--enable_bucket_write_metric_counter". These metrics reports the number of bytes read/written from/to a GCS bucket per job.
------------------------
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
- [x] Mention the appropriate issue in your description (for example: `addresses #123`), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment `fixes #<ISSUE NUMBER>` instead.
- [ ] Update `CHANGES.md` with noteworthy changes.
- [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
See the [Contributor Guide](https://beam.apache.org/contribute) for more tips on [how to make review process smoother](https://github.com/apache/beam/blob/master/CONTRIBUTING.md#make-the-reviewers-job-easier).
To check the build health, please visit [https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md](https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md)
GitHub Actions Tests Status (on master branch)
------------------------------------------------------------------------------------------------
[](https://github.com/apache/beam/actions?query=workflow%3A%22Build+python+source+distribution+and+wheels%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Python+Tests%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Java+Tests%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Go+tests%22+branch%3Amaster+event%3Aschedule)
See [CI.md](https://github.com/apache/beam/blob/master/CI.md) for more information about GitHub Actions CI or the [workflows README](https://github.com/apache/beam/blob/master/.github/workflows/README.md) to see a list of phrases to trigger workflows.
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Feature add metrics counting the number of bytes read/written from/to GCS bucket per job [beam]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #31466:
URL: https://github.com/apache/beam/pull/31466#issuecomment-2154760237
Assigning reviewers. If you would like to opt out of this review, comment `assign to next reviewer`:
R: @shunping for label python.
R: @shunping for label io.
Available commands:
- `stop reviewer notifications` - opt out of the automated review tooling
- `remind me after tests pass` - tag the comment author after tests pass
- `waiting on author` - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)
The PR bot will only process comments in the main thread (not review comments).
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Feature add metrics counting the number of bytes read/written from/to GCS bucket per job [beam]
Posted by "shunping (via GitHub)" <gi...@apache.org>.
shunping commented on PR #31466:
URL: https://github.com/apache/beam/pull/31466#issuecomment-2154915865
Could you please fix the lint? @alxd112
```
************* Module apache_beam.options.pipeline_options
apache_beam/options/pipeline_options.py:907:0: C0301: Line too long (83/80) (line-too-long)
apache_beam/options/pipeline_options.py:913:0: C0301: Line too long (86/80) (line-too-long)
************* Module apache_beam.runners.dataflow.internal.apiclient
apache_beam/runners/dataflow/internal/apiclient.py:492:0: C0301: Line too long (105/80) (line-too-long)
apache_beam/runners/dataflow/internal/apiclient.py:493:0: C0301: Line too long (107/80) (line-too-long)
************* Module apache_beam.io.gcp.gcsio_test
apache_beam/io/gcp/gcsio_test.py:31:0: C0411: third party import "import mock" should be placed before "from apache_beam.metrics.execution import MetricsEnvironment" (wrong-import-order)
apache_beam/io/gcp/gcsio_test.py:33:0: C0412: Imports from package apache_beam are not grouped (ungrouped-imports)
```
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Feature add metrics counting the number of bytes read/written from/to GCS bucket per job [beam]
Posted by "shunping (via GitHub)" <gi...@apache.org>.
shunping commented on code in PR #31466:
URL: https://github.com/apache/beam/pull/31466#discussion_r1634853392
##########
sdks/python/apache_beam/options/pipeline_options.py:
##########
@@ -900,6 +900,17 @@ def _add_argparse_args(cls, parser):
'Controls the OAuth scopes that will be requested when creating '
'GCP credentials. Note: If set programmatically, must be set as a '
'list of strings'))
+ parser.add_argument(
Review Comment:
Can we also add a default value for the new arguments?
##########
sdks/python/apache_beam/options/pipeline_options.py:
##########
@@ -900,6 +900,17 @@ def _add_argparse_args(cls, parser):
'Controls the OAuth scopes that will be requested when creating '
'GCP credentials. Note: If set programmatically, must be set as a '
'list of strings'))
+ parser.add_argument(
+ '--enable_bucket_read_metric_counter',
+ action='store_true',
+ help='Create metrics reporting the approximate number of bytes read '
+ 'per bucket.')
+ parser.add_argument(
Review Comment:
Same as the previous comment.
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Feature add metrics counting the number of bytes read/written from/to GCS bucket per job [beam]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #31466:
URL: https://github.com/apache/beam/pull/31466#issuecomment-2151050229
## [Codecov](https://app.codecov.io/gh/apache/beam/pull/31466?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 71.13%. Comparing base [(`fa4ead9`)](https://app.codecov.io/gh/apache/beam/commit/fa4ead99a6b2cd5b50f9efed99016c215061e2d4?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`6473a40`)](https://app.codecov.io/gh/apache/beam/commit/6473a402a34b59f0448959d8f53b21b329cad83a?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
> Report is 37 commits behind head on master.
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #31466 +/- ##
============================================
- Coverage 71.14% 71.13% -0.01%
Complexity 3008 3008
============================================
Files 1055 1055
Lines 133439 133485 +46
Branches 3248 3248
============================================
+ Hits 94929 94956 +27
- Misses 35382 35401 +19
Partials 3128 3128
```
| [Flag](https://app.codecov.io/gh/apache/beam/pull/31466/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [python](https://app.codecov.io/gh/apache/beam/pull/31466/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `81.27% <100.00%> (-0.02%)` | :arrow_down: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/beam/pull/31466?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Feature add metrics counting the number of bytes read/written from/to GCS bucket per job [beam]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #31466:
URL: https://github.com/apache/beam/pull/31466#issuecomment-2160785885
R: @riteshghorse for final approval
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Feature add metrics counting the number of bytes read/written from/to GCS bucket per job [beam]
Posted by "alxd112 (via GitHub)" <gi...@apache.org>.
alxd112 closed pull request #31466: Feature add metrics counting the number of bytes read/written from/to GCS bucket per job
URL: https://github.com/apache/beam/pull/31466
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Feature add metrics counting the number of bytes read/written from/to GCS bucket per job [beam]
Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn commented on code in PR #31466:
URL: https://github.com/apache/beam/pull/31466#discussion_r1635013221
##########
sdks/python/apache_beam/io/gcp/gcsio.py:
##########
@@ -530,19 +541,63 @@ def _updated_to_seconds(updated):
updated.microsecond / 1000000.0)
+def increment_bucket_read_counter_metric(read):
+ def inner(self, *args, **kwargs):
+ bytesRead = read(self, *args, **kwargs)
+ if self.enable_read_bucket_metric:
+ Metrics.counter(
+ self.__class__,
+ "GCS_read_bytes_counter_" + self._blob.bucket.name).inc(
+ len(bytesRead))
+ return bytesRead
+
+ return inner
+
+
class BeamBlobReader(BlobReader):
- def __init__(self, blob, chunk_size=DEFAULT_READ_BUFFER_SIZE):
+ def __init__(
+ self,
+ blob,
+ chunk_size=DEFAULT_READ_BUFFER_SIZE,
+ enable_read_bucket_metric=False):
super().__init__(blob, chunk_size=chunk_size)
+ self.enable_read_bucket_metric = enable_read_bucket_metric
self.mode = "r"
+ @increment_bucket_read_counter_metric
Review Comment:
Decorator here seems unnecessary. Already overwrite read() and write() method and the counter increment could just happen there
The refactor should also consider minimize the overhead when bucket_metric is not enabled.
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Feature add metrics counting the number of bytes read/written from/to GCS bucket per job [beam]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #31466:
URL: https://github.com/apache/beam/pull/31466#issuecomment-2141788437
Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment `assign set of reviewers`
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Feature add metrics counting the number of bytes read/written from/to GCS bucket per job [beam]
Posted by "robertwb (via GitHub)" <gi...@apache.org>.
robertwb merged PR #31466:
URL: https://github.com/apache/beam/pull/31466
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org