This repository was archived by the owner on Sep 17, 2025. It is now read-only.
Add Metric and supporting classes#347
Merged
c24t merged 10 commits intocensus-instrumentation:masterfrom Oct 16, 2018
Merged
Conversation
mayurkale22
reviewed
Oct 12, 2018
| :param value: Value of the exemplar point, determines which bucket the | ||
| exemplar belongs to. | ||
|
|
||
| :type timestamp: str |
Member
Author
There was a problem hiding this comment.
See above, unless time has some special meaning I'm missing here.
c24t
added a commit
to c24t/opencensus-python
that referenced
this pull request
Oct 13, 2018
and improve test coverage.
and improve test coverage.
and add a check for cumulative metrics with missing start timestamps.
mayurkale22
approved these changes
Oct 16, 2018
Contributor
liyanhui1228
left a comment
There was a problem hiding this comment.
LGTM with minor comments.
|
|
||
| Defines a Metric which has one or more timeseries. | ||
|
|
||
| :type descriptor: class: '~opencensus.metrics.export.metric_descriptor.MetricDescriptor' # noqa |
Contributor
There was a problem hiding this comment.
Why adding # noqa here?
Member
Author
There was a problem hiding this comment.
Force of habit for long lines, I moved this and another noqa to the end of the docstring in 4a47970.
| metric_descriptor.MetricDescriptorType.SUMMARY): | ||
| check_type = value.ValueSummary | ||
| else: | ||
| raise ValueError("Unknown metric descriptor type") |
Contributor
There was a problem hiding this comment.
# This relation mapping could be put at the top of this file
DESCRIPTOR_VALUE = {
metric_descriptor.MetricDescriptorType.GAUGE_INT64: value.ValueLong,
metric_descriptor.MetricDescriptorType.CUMULATIVE_INT64: value.ValueLong,
...
}
check_type = DESCRIPTOR_VALUE.get(self.descriptor.type)
if check_type is None:
raise ValueError("Unknown metric descriptor type")
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Like #342, this diff adds a few metrics classes following the proto spec and java implementation. The new classes are
Metric,TimeSeries, and the value classValueDistribution.This diff is written in the style of #337, following the java package structure. I included preconditions to match the comments in the metrics proto file, but this client's behavior isn't guaranteed to match the java client's.
Addresses #335.