Switch SD exporter to polling#577
Switch SD exporter to polling#577c24t merged 23 commits intocensus-instrumentation:stackdriver-metricsfrom
Conversation
contrib/opencensus-ext-stackdriver/tests/test_stackdriver_stats.py
Outdated
Show resolved
Hide resolved
contrib/opencensus-ext-stackdriver/tests/test_stackdriver_stats.py
Outdated
Show resolved
Hide resolved
| @@ -0,0 +1,143 @@ | |||
| # Copyright 2019, OpenCensus Authors | |||
There was a problem hiding this comment.
Note that this transport serves a different purpose than opencensus.common.transports.
On master:
exporter.export -> exporter.transport.export -> exporter.emit -> ... -> exporter.create_time_series
vs. on this branch:
background_thread -> exporter.export -> exporter.create_time_series
I'm open to a different name or structure here.
There was a problem hiding this comment.
This serves a similar purpose to https://github.com/census-instrumentation/opencensus-go/blob/master/metric/metricexport/reader.go#L62, what about interval_metric_reader?
There was a problem hiding this comment.
High level question about this flow since I'm a little behind how stackdriver-metrics works. What happens when measure_to_view_map.export is called now? I see it is deprecated is it a no-op somehow?
There was a problem hiding this comment.
Nothing! We should be able to remove this and many other supporting classes (e.g. ViewData) once stackdriver and prometheus are migrated.
There was a problem hiding this comment.
@songy23 it's long, but maybe worth it for the consistency between packages.
songy23
left a comment
There was a problem hiding this comment.
Overall APIs look good, happy to see export in Python becomes more consistent with other languages.
| @@ -0,0 +1,143 @@ | |||
| # Copyright 2019, OpenCensus Authors | |||
There was a problem hiding this comment.
This serves a similar purpose to https://github.com/census-instrumentation/opencensus-go/blob/master/metric/metricexport/reader.go#L62, what about interval_metric_reader?
colincadams
left a comment
There was a problem hiding this comment.
Overall I like this! Would the goal be to eventually do this for all exporters, once stackdriver-metrics is complete and merged in?
All stats/metrics exporters at least. The idea is that metrics are generated by producers, and the whole stats module is a single producer. The API for exporting traces will still let us push. |
This PR adds support for polling metrics from the stackdriver exporter. It builds on #560, which removed the ability to push metrics to the exporter via
MeasureToViewMap.record.I've added a
PeriodicTaskclass (similar to the java client'sIntervalMetricReader) that periodically callsexporter.export(producer.get_metrics()). To keep the API changes to a minimum I've changednew_stats_exporterto create and start the task, but we may want to change this to make the exporter ignorant of the transport instead.@songy23 and @colincadams I'm interested to hear your thoughts on the API changes here.