Skip to content

Commit

Permalink
Addresses review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardoemery committed Sep 17, 2018
1 parent a905d2b commit e0b97ee
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions opencensus/stats/exporters/prometheus_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,21 @@ class Options(object):
""" Options contains options for configuring the exporter.
The address can be empty as the prometheus client will
assume it's localhost
:type namespace: str
:param namespace: The prometheus namespace to be used. Defaults to ''.
:type port: int
:param port: The Prometheus port to be used. Defaults to 8000.
:type address: str
:param address: The Prometheus address to be used. Defaults to ''.
:type registry: registry
:param registry: The Prometheus address to be used. Defaults to ''.
:type registry: :class:`~prometheus_client.core.CollectorRegistry`
:param registry: A Prometheus collector registry instance.
"""
def __init__(self,
namespace='',
Expand Down Expand Up @@ -124,6 +139,20 @@ def add_view_data(self, view_data):
def to_metric(self, desc, view):
""" to_metric translate the data that OpenCensus create
to Prometheus format, using Prometheus Metric object
:type desc: str
:param desc: The view descriptor
:type view: object of :class:
`~opencensus.stats.view.View`
:param object of opencensus.stats.view.View view:
View object to translate
:rtype: :class:`~prometheus_client.core.CounterMetricFamily` or
:class:`~prometheus_client.core.HistogramMetricFamily` or
:class:`~prometheus_client.core.UntypedMetricFamily` or
:class:`~prometheus_client.core.GaugeMetricFamily`
:returns: A Prometheus metric object
"""
agg_data = view.aggregation.aggregation_data

Expand Down Expand Up @@ -221,6 +250,23 @@ class PrometheusStatsExporter(base.StatsExporter):
""" Exporter exports stats to Prometheus, users need
to register the exporter as an HTTP Handler to be
able to export.
:type options:
:class:`~opencensus.stats.exporters.prometheus_exporters.Options`
:param options: An options object with the parameters to instantiate the
prometheus exporter.
:type gatherer: :class:`~prometheus_client.core.CollectorRegistry`
:param gatherer: A Prometheus collector registry instance.
:type transport:
:class:`opencensus.common.transports.sync.SyncTransport` or
:class:`opencensus.common.transports.async.AsyncTransport`
:param transport: An instance of a Transpor to send data with.
:type collector:
:class:`~opencensus.stats.exporters.prometheus_exporters.Collector`
:param collector: An instance of the Prometheus Collector object.
"""
def __init__(self,
options,
Expand Down

0 comments on commit e0b97ee

Please sign in to comment.