API Reference¶
Trace Exporter¶
-
class
opencensus_ext_newrelic.trace.
DefaultTransport
(exporter, grace_period=None, max_batch_size=600, wait_period=5.0)[source]¶ Bases:
opencensus.common.transports.async_.AsyncTransport
-
class
opencensus_ext_newrelic.trace.
NewRelicTraceExporter
(insert_key, service_name, transport=<class 'opencensus_ext_newrelic.trace.DefaultTransport'>, host=None, port=443)[source]¶ Bases:
opencensus.trace.base_exporter.Exporter
Export Span data to the New Relic platform
This class is responsible for marshalling trace data to the New Relic platform.
- Parameters
insert_key (str) – Insights insert key
service_name (str) – (optional) The name of the entity to report spans into. Defaults to “Python Application”.
transport (
opencensus.common.transports.base.Transport
) – (optional) Class for creating new transport objects. It should extend from the base_exporteropencensus.common.transports.base.Transport
type and implementopencensus.common.transports.base.Transport.export()
. Defaults to an async transport sending data every 5 seconds. The other option isopencensus.common.transports.async.AsyncTransport
.host (int) – (optional) Override the host for the API endpoint.
port – (optional) Override the port for the API endpoint.
Usage:
>>> import os >>> from opencensus_ext_newrelic import NewRelicTraceExporter >>> insert_key = os.environ.get("NEW_RELIC_INSERT_KEY") >>> trace_exporter = NewRelicTraceExporter( ... insert_key, service_name="My Service") >>> trace_exporter.stop()
-
emit
(span_datas)[source]¶ Immediately marshal span data to the tracing backend
- Parameters
span_datas (list) – list of
opencensus.trace.span_data.SpanData
to emit
Stats Exporter¶
-
class
opencensus_ext_newrelic.stats.
NewRelicStatsExporter
(insert_key, service_name, interval=5, host=None, port=443)[source]¶ Bases:
object
Export Metric data to the New Relic platform
This class is responsible for marshalling metric data to the New Relic platform.
- Parameters
Usage:
>>> import os >>> from opencensus_ext_newrelic import NewRelicStatsExporter >>> insert_key = os.environ.get("NEW_RELIC_INSERT_KEY") >>> stats_exporter = NewRelicStatsExporter( ... insert_key, service_name="My Service") >>> stats_exporter.stop()
-
export_metrics
(metrics)[source]¶ Immediately send all metric data to the monitoring backend.
- Parameters
metrics (
opencensus.metrics.export.metric.Metric
) – list of Metric objects to send to the monitoring backend