newrelic-telemetry-sdk

New Relic Telemetry SDK


Keywords
monitoring, newrelic, python, telemetry
License
Apache-2.0
Install
pip install newrelic-telemetry-sdk==0.5.1

Documentation

header

New Relic Telemetry SDK

ci coverage docs black

newrelic-telemetry-sdk-python provides a Python library for sending data into New Relic using the Python urllib3 library.

See dimensional metrics, events, logs, and spans/traces in New Relic, without having to use an agent!

Installing newrelic_telemetry_sdk

To start, the newrelic-telemetry-sdk package must be installed. To install through pip:

If that fails, download the library from its GitHub page and install it using:

Reporting your first metric

There are 3 different types of metrics:

  • GaugeMetric
  • CountMetric
  • SummaryMetric

Metric descriptions

Metric type Interval required Description Example
Gauge No A single value at a single point in time. Room Temperature.
Count Yes Track the total number of occurrences of an event. Number of errors that have occurred.
Summary Yes Track count, sum, min, and max values over time. The summarized duration of 100 HTTP requests.

Example

The example code assumes you've set the following environment variables:

  • NEW_RELIC_LICENSE_KEY

Reporting your first event

Events represent a record of something that has occurred on a system being monitored. The example code assumes you've set the following environment variables:

  • NEW_RELIC_LICENSE_KEY

Reporting your first log message

Log messages are generated by applications, usually via the Python logging module. These messages are used to audit and diagnose issues with an operating application. The example code assumes you've set the following environment variables:

  • NEW_RELIC_LICENSE_KEY

Reporting your first span

Spans provide an easy way to time components of your code. The example code assumes you've set the following environment variables:

  • NEW_RELIC_LICENSE_KEY

Find and use data

Tips on how to find and query your data in New Relic:

For general querying information, see:

Limitations

The New Relic Telemetry APIs are rate limited. Please reference the documentation for New Relic Metrics API and New Relic Trace API requirements and limits on the specifics of the rate limits.