-
Notifications
You must be signed in to change notification settings - Fork 94
added custom metric sample #177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
This is failing on the black formatter, but I formatted and sorted the imports |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a custom metric sample to demonstrate how to record the workflow type in the activity schedule-to-start latency.
- Added a new workflow (ExecuteActivityWorkflow) and associated client code for executing activities.
- Introduced a custom activity interceptor to record custom metrics in the activity worker.
- Updated README files to include instructions for running the custom metric components.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| custom_metric/workflow_worker.py | Introduces a simple workflow that executes an activity. |
| custom_metric/client.py | Provides a client to start the new workflow. |
| custom_metric/activity_worker.py | Implements an interceptor for recording custom metrics for activity timing. |
| custom_metric/README.md | Updates sample usage instructions for the custom metric sample. |
| README.md | Adds the custom_metric sample to the main project documentation. |
custom_metric/activity_worker.py
Outdated
| ) | ||
|
|
||
|
|
||
| class SimpleWorkerInterceptor(Interceptor): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sample is not just demonstrating custom metric, which can be done inside the activity, it's demonstrating interceptors. May be a little confusing to someone just wanting to understand the custom metric part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion! I implemented it because what you mentioned off-PR, I thought you suggested to do this with an interceptor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this specific custom metric that makes sense, but people can create custom metrics without interceptors. I think it's fine to stay, may just need to clarify in README via that one/two-sentence explainer that the purpose of this sample is to demonstrate a custom schedule to start metric via interceptor, as opposed to just general custom metric.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a little blurb. I hope it's along the lines you're thinking
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test or two? (I know not all samples have tests, something we regret, but adding them helps us catch if they start breaking)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added!
|
@cretz thanks for the review! I think all your comments have been acknowledged and fixed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just minor stuff. Only thing really needed I think is to give the workflow its own file. Don't forget to poe format.
cretz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks!
What was changed
Added a custom metric sample
Why?
Help folks with questions about custom metrics
Checklist
How was this tested:
Checked the metric output against the existing metric
Any docs updates needed?
Updated main python samples readme