Skip to content

newrelic/nri-conviva

New Relic Open Source community project banner.

NRI Conviva Integration

GitHub forks GitHub stars GitHub watchers

GitHub all releases GitHub release (latest by date) GitHub last commit GitHub Release Date

GitHub issues GitHub issues closed GitHub pull requests GitHub pull requests closed

The project provides a New Relic Infrastructure integration that uses the Conviva v3 Metrics API to pull metrics from Conviva and push them into New Relic as dimensional metrics.

Installation

As this is a custom integration it must be installed manually. All directions assume a standard Infrastructure installation.

Linux

  1. Download nri-conviva from the GitHub Release directory
  2. Place nri-conviva in /var/db/newrelic-infra/custom-integrations
  3. Copy the sample configuration to /etc/newrelic-infra/integrations.d/

Windows

TODO

Usage

The New Relic Infrastructure integration for Conviva supports the following Conviva v3 Metrics API concepts.

Configuration

The New Relic Infrastructure integration for Conviva configuration file follows the standard configuration format for New Relic Infrastructure integrations. A sample is included that shows examples of all options. A description of the options is as follows.

Environment variables

The following configuration options are supported in the env section of the configuration file.

Variable Name Description Default
CLIENT_ID The Conviva v3 API client ID The OS environment variable named CONVIVA_CLIENT_ID
CLIENT_SECRET The Conviva v3 API client secret The OS environment variable named CONVIVA_CLIENT_SECRET
CONFIG_PATH Path to the Conviva collector configuration file ${config.path}

Note that the CONFIG_PATH variable will be auto-populated with the path to the temporary file created by the agent containing the contents of the config section. If you prefer to keep the integration specific configuration separate from the standard integration configuration, you may pass a static path in the CONFIG_PATH variable.

Conviva collector configuration

The Conviva collector configuration is specified in the config section of the configuration file. The collector configuration specifies the endpoint URL, the default time range and interval granularity, and the metrics that the integration should collect on each invocation. The following configuration options are supported.

Variable Name Description Default
apiV3Url The Conviva v3 API endpoint https://api.conviva.com/insights/3.0
startOffset An offset from the current time for the start of the query time range, specified as a Go duration string
endOffset An offset from the current time for the end of the query time range, specified as a Go duration string
granularity The time interval granularity for the query, specified in ISO 8601 format
realTime Flag that can be used to toggle the use of real time metrics vs historical metrics
metrics The array of metric definitions specifying the metrics to collect []
Metrics

The metrics that the Conviva collector should collect are specfied as a list of metric definitions in the metrics configuration option. The following options are supported in a metric definition.

Variable Name Description Default
metric The name of a single metric to collect
metricGroup The name of a metric group to collect
names A list of multiple metric names to collect in a single query
dimensions A list of group by dimension names to collect for the metric or metric group []
filters A set of filtering dimensions to filter results by where each filter is specified as a key:value pair where the key is a dimension name and the value is a list of values to include {}
startOffset A query specific override for the global startOffset
endOffset A query specific override for the global endOffset
granularity A query specific override for the global granularity
realTime A query specific override for the global realTime flag
Time range and granularity

The time range and granularity used to query the Conviva v3 Metrics API are specified via the startOffset, endOffset, and granularity configuration options. These options can be configured globally for all queries as part of the top-level collector configuration options and can be overriden for individual queries in the metric definition options.

If a startOffset is provided but no endOffset is specified, the endOffset will default to 0, causing the current time to be passed for the end_epoch value when the API call is made.

If an endOffset is provided but no startOffset is provided, the endOffset will be ignored and neither start_epoch nor end_epoch will be passed when the API call is made. In this case, the default time range will be used by Conviva.

Real-time vs historical metrics

By default, the Conviva integration will fetch metrics using the real-time metrics endpoint (https://api.conviva.com/insights/3.0/real-time-metrics). The Conviva integration will automatically switch to use the historical metrics endpoint (https://api.conviva.com/insights/3.0/metrics) if the startOffset is greater than 15 minutes in the past. Additionally, use of the real-time metrics endpoint can be explicitly disabled by setting the realTime flag to false at the global or metric definition level.

NOTE:

The Conviva v3 Metrics API can return inconsistent results for "recent" data when querying historical metrics. In our testing, querying for data in the last 10 minutes at 1 minute granularity was problematic. The minimum values for startOffset, endOffset, and granularity where we were able to see consistent results are 20m, 10m, and PT1M, respectively. When querying for recent data, it is recommended to query real-time metrics (the default).

Dimensions

Dimensions can only be queried one at a time. This has two ramifications.

  1. There is a 1:1 relationship between a "group by" dimension and an API call. In other words, the more dimensions you specify in the dimensions array, the more API calls have to be made.
  2. There is a 1:1 relationship between a Conviva metric name + dimension and the dimensional metric that is created for it in New Relic. This means that it is not currently possible to do queries like SELECT average(conviva.bitrate) FROM Metric WHERE browser_name = 'Chrome' *AND* geo_country_code = 'us.
Filters

Logical OR filtering is supported by specifying multiple values for a single filtering dimension. While it is possible to specify multiple values for multiple filtering dimensions in the configuration, logical OR filtering only works for filtering of the same dimension. For complex logic, a saved filter is required. Currently, querying with saved filters is not supported.

Building

Golang is required to build the integration. We recommend Golang 1.18 or higher.

After cloning this repository, go to the directory of the NGINX integration and build it:

$ make build

The command above executes the tests for the NGINX integration and builds an executable file called nri-conviva under the bin directory.

To start the integration, run nri-conviva:

$ ./bin/nri-conviva

If you want to know more about usage of ./bin/nri-conviva, pass the -help parameter:

$ ./bin/nri-conviva -help

External dependencies are managed through the go modules. All the external dependencies and its versions are listed in the go.mod file. The vendor folder is not required anymore.

Testing

To run the tests execute:

$ make test

Support

New Relic has open-sourced this project. This project is provided AS-IS WITHOUT WARRANTY OR DEDICATED SUPPORT. Issues and contributions should be reported to the project here on GitHub.

We encourage you to bring your experiences and questions to the Explorers Hub where our community members collaborate on solutions and new ideas.

Privacy

At New Relic we take your privacy and the security of your information seriously, and are committed to protecting your information. We must emphasize the importance of not sharing personal data in public forums, and ask all users to scrub logs and diagnostic information for sensitive information, whether personal, proprietary, or otherwise.

We define “Personal Data” as any information relating to an identified or identifiable individual, including, for example, your name, phone number, post code or zip code, Device ID, IP address, and email address.

For more information, review New Relic’s General Data Privacy Notice.

Contribute

We encourage your contributions to improve [project name]! Keep in mind that when you submit your pull request, you'll need to sign the CLA via the click-through using CLA-Assistant. You only have to sign the CLA one time per project.

If you have any questions, or to execute our corporate CLA (which is required if your contribution is on behalf of a company), drop us an email at opensource@newrelic.com.

A note about vulnerabilities

As noted in our security policy, New Relic is committed to the privacy and security of our customers and their data. We believe that providing coordinated disclosure by security researchers and engaging with the security community are important means to achieve our security goals.

If you believe you have found a security vulnerability in this project or any of New Relic's products or websites, we welcome and greatly appreciate you reporting it to New Relic through HackerOne.

If you would like to contribute to this project, review these guidelines.

To all contributors, we thank you! Without your contribution, this project would not be what it is today. We also host a community project page dedicated to Project Name.

License

The [New Relic Integration for Conviva] is licensed under the Apache 2.0 License.

[If applicable: The [project name] also uses source code from third-party libraries. You can find full details on which libraries are used and the terms under which they are licensed in the third-party notices document.]