-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
Add OpenCensus metrics quickstart #2079
Conversation
cc @mayurkale22 |
/cc @andrewsg Please review the PR. |
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.
We'll need tests before merging, and ideally a readme. The code itself lgtm.
ms = random() * 5 * 1000 | ||
print("Latency {}: {}".format(ii, ms)) | ||
|
||
mmap = stats.stats.stats_recorder.new_measurement_map() |
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 is already imported as from opensensus.stats import stats
, so that would make this opencensus.stats.stats.stats.stats_recorder
. Is that really accurate? It's not a typo of too many stats?
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.
It's a lot of stutter, but that's correct. stats
1 is the package, stats
2 is the module, stats
3 is the global Stats
object.
opencensus/metrics_quickstart.py
Outdated
exporter, transport = stats_exporter.new_stats_exporter() | ||
|
||
# Record 100 fake latency values between 0 and 5 seconds. | ||
for ii in range(100): |
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.
Why ii
here instead of i
? Actually, can we use a more descriptive variable?
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 to avoid single-letter names. I don't know what would be more descriptive here, possibly _
to indicate that we're not using the var for anything.
@andrewsg let me know if this is what you're looking for in the README and tests. |
Looks great, thanks! |
Add quickstart docs for exporting metrics to stackdriver via the opencensus client.
See previous PRs for the same feature in go, java, and node.