ballerinax/newrelic Ballerina library
The New Relic Observability Extension is one of the observability extensions in the Ballerina language.
It provides an implementation for tracing and metrics and, publishing both metrics and traces to a New Relic platform.
Enabling New Relic Extension
To package the New Relic extension into the Jar, follow the following steps.
- Add the following import to your program.
- Add the following to the
Ballerina.tomlwhen building your program.
To enable the extension and publish traces and metrics to New Relic, add the following to the
Config.toml when running your program.
User can configure the environment variable
BALLERINA_NEWRELIC_API_KEY instead of
If both are configured,
Config.toml will be overwritten by the environment variable value.
Observe Metrics in New Relic
Instead of using prometheus as an intermediate metric reporter that remote writes the metrics to New Relic,
Ballerina New Relic Observability Extension directly publishes metrics to New Relic on the following metric API
Instrumentation of metrics is done using the com.newrelic.telemetry.
The exporter provides the following metrics.
|Response time of a HTTP request in seconds
|Maximum response time of a HTTP request
|Minimum response time of a HTTP request
|Average response time of a HTTP request
|Standard deviation of response time of a HTTP request
|Summary of HTTP request-response times across various time frames and quantiles
|Response time of a HTTP request in nano seconds
|Total number of requests
|Total number of response errors
|Total number of inprogress requests
|Number of publishers in kafka
|Number of consumers in kafka
|Number of errors happened while publishing in kafka
Observe Traces in New Relic
Ballerina New Relic Observability Extension directly publishes traces to New Relic on the following trace API
Traces are published to New Relic on OpenTelemetry format.
Instrumentation of traces is done using the io.opentelemetry and
GRPC protocol is used send traces.