-
Notifications
You must be signed in to change notification settings - Fork 867
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
Updated example for custom metrics and add backwards compatibility warnings and upgrade guide for metrics APIs #2516
Merged
Merged
Changes from 4 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
41d4cb8
Add backward compatibility issues to doc
e26d920
Update example for custom metrics
2932d37
Merge branch 'master' into naman-metrics-bc
namannandan e1339e1
fix lint error
b0d6461
Merge branch 'master' into naman-metrics-bc
namannandan 2ea3e84
Merge branch 'master' into naman-metrics-bc
namannandan 9af12bf
Update custom metrics example to work with backwards compatible API
d7fe4eb
Update custom metrics API documentation
c282d5f
Fix linter error
c4965dd
fix documentation
ebf6cad
Merge branch 'master' into naman-metrics-bc
namannandan 2401f6e
Merge branch 'master' into naman-metrics-bc
namannandan cecc10d
Merge branch 'master' into naman-metrics-bc
namannandan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
so the old metrics were always counters? If that's the case then keeping BC automatically shouldn't be too hard
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.
The prior metrics implementation did not have
types
associated with them. The new metrics implementation does add support for MetricTypes.In addition, while the prior metrics implementation did not have a way to specify metrics and their specifications (name, unit, dimension names and type) in a central configuration file, the new metrics implementation introduced this, as a result which, the semantics of
add_metric
method was changedfrom: Create a metric object and store in a list to emit
to: Add a metric object consisting only of its specifications (name, unit, dimension names and type) to a metics cache. The dimension values are provided at the time of updating a metric using the add_or_update method.
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.
Couple of options to ensure backwards compatibility are as follows:
add_metric_bc
which has the same signature as that of the old add_metric API. This method can internally calladd_metric
and thenadd_or_update
on the metric object. The default metric type in this case would becounter
.add_metric
method toadd_metric_to_cache
and reimplement theadd_metric
method to have the same signature as the old implementation. Then, theadd_metric
API can internally calladd_metric_to_cache
method and theadd_or_update
on the metric object.Please share your thoughts on these approaches.
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 like 2,
add_metric_to_cache()
seems more like an internal detail whereas what a user wants to do isadd_metric()
. While the semantics do change, the code won't break and that seems like a winThere 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.
Draft PR to implement backwards compatibility for
add_metric
API: #2525