This repository was archived by the owner on Jul 31, 2023. It is now read-only.
Add support for metrics in prometheus exporter#1105
Merged
rghetia merged 5 commits intocensus-instrumentation:devfrom Apr 15, 2019
Merged
Add support for metrics in prometheus exporter#1105rghetia merged 5 commits intocensus-instrumentation:devfrom
rghetia merged 5 commits intocensus-instrumentation:devfrom
Conversation
songy23
reviewed
Apr 12, 2019
| t.Fatalf("failed to create prometheus exporter: %v", err) | ||
| } | ||
| view.RegisterExporter(exporter) | ||
| //view.RegisterExporter(exporter) |
Contributor
There was a problem hiding this comment.
Nit: if these are not needed any more then just remove them.
songy23
approved these changes
Apr 12, 2019
exporter/prometheus/prometheus.go
Outdated
| // ExportMetrics exports to the Prometheus. | ||
| // Each OpenCensus Metric will be converted to | ||
| // corresponding Prometheus Metric: | ||
| // SumData will be converted to Untyped Metric, |
Contributor
There was a problem hiding this comment.
These comments no longer apply here.
Contributor
Author
There was a problem hiding this comment.
fixed. I have referred to Metric Types (like TypeCumulativeInt64) in modified comment instead of stats aggregation type (like sum).
exporter/prometheus/prometheus.go
Outdated
| } | ||
| return prometheus.NewConstHistogram(desc, uint64(v.Count), v.Sum, points, labelValues...) | ||
| default: | ||
| return nil, pointTypeError(point) |
Contributor
There was a problem hiding this comment.
Nit: leave a TODO to support Summary metrics.
| view.RegisterExporter(exporter) | ||
| reportPeriod := time.Millisecond | ||
| view.SetReportingPeriod(reportPeriod) | ||
| //view.RegisterExporter(exporter) |
Contributor
There was a problem hiding this comment.
There are a few more commented lines that can be removed.
Contributor
Author
There was a problem hiding this comment.
removed all of them.
songy23
approved these changes
Apr 15, 2019
exporter/prometheus/prometheus.go
Outdated
| c.mu.Lock() | ||
| defer c.mu.Unlock() | ||
| func pointTypeError(point metricdata.Point) error { | ||
| return fmt.Errorf("point type %T is not yet supported", point) |
Contributor
There was a problem hiding this comment.
Nit: the error message could be a bit confusing, consider "point type %T doesn't match with metric type".
songy23
approved these changes
Apr 15, 2019
rghetia
added a commit
to rghetia/opencensus-go
that referenced
this pull request
Apr 25, 2019
…n#1105) * Add prometheus support. * remove view related code and refactor metric specific code. * fix review comments. * remove dead code and fix comments. * fix error message.
rghetia
added a commit
that referenced
this pull request
Apr 25, 2019
* Add prometheus support. * remove view related code and refactor metric specific code. * fix review comments. * remove dead code and fix comments. * fix error message.
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.
fixes #1040