Skip to content

Update python metrics example in programming guide#36334

Merged
hjtran merged 5 commits intoapache:masterfrom
hjtran:metricedocs
Oct 3, 2025
Merged

Update python metrics example in programming guide#36334
hjtran merged 5 commits intoapache:masterfrom
hjtran:metricedocs

Conversation

@hjtran
Copy link
Copy Markdown
Contributor

@hjtran hjtran commented Sep 30, 2025

It was non-functional and also used the older pipeline execution pattern.

Also added test that more or less mirrors the example to make sure it actually works.


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • 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.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.

@codecov
Copy link
Copy Markdown

codecov bot commented Oct 1, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.83%. Comparing base (35969b3) to head (ca9c3b3).
⚠️ Report is 213 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #36334      +/-   ##
============================================
+ Coverage     56.79%   56.83%   +0.03%     
  Complexity     3385     3385              
============================================
  Files          1220     1220              
  Lines        185122   185580     +458     
  Branches       3508     3508              
============================================
+ Hits         105148   105475     +327     
- Misses        76649    76780     +131     
  Partials       3325     3325              
Flag Coverage Δ
python 80.94% <ø> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hjtran hjtran marked this pull request as ready for review October 1, 2025 10:33
@hjtran
Copy link
Copy Markdown
Contributor Author

hjtran commented Oct 1, 2025

Failures look unrelated

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Oct 1, 2025

Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment assign set of reviewers

@hjtran
Copy link
Copy Markdown
Contributor Author

hjtran commented Oct 1, 2025

assign set of reviewers

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Oct 1, 2025

Assigning reviewers:

R: @shunping for label python.
R: @liferoad for label website.

Note: If you would like to opt out of this review, comment assign to next reviewer.

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).


metrics = result.metrics().query(
metrics.MetricsFilter.with_namespace("namespace").with_name("counter1"))
metrics_ = p.result.metrics().query(
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.

better name for metrics_?

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.

Yeah I struggled to find a name that didn't overshadow the module name. I've changed it now to query_result

@hjtran hjtran merged commit 82952c8 into apache:master Oct 3, 2025
92 of 102 checks passed
@damccorm damccorm mentioned this pull request Oct 4, 2025
3 tasks
@damccorm
Copy link
Copy Markdown
Contributor

damccorm commented Oct 4, 2025

FYI, looks like we missed a license on the test file breaking precommits. #36386 should fix

@hjtran
Copy link
Copy Markdown
Contributor Author

hjtran commented Oct 4, 2025

Thanks for the fix, sorry for missing it!

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.

3 participants