• EnglishEspañol日本語한국어Português
  • Log inStart now

Introduction to creating metric data from non-metric data

You can generate metric-type data from other types of data in New Relic, including events, logs, and spans. Metrics are aggregates of your data and are optimal for analyzing and monitoring trends over long time periods.

This document explains:

Why create metrics from other data types?

Using metrics allows for more efficient data storage. This in turn allows you to query your data and build charts more easily. The difference between metrics and other types of data in New Relic is based on time. For more information, see Understand data types.

  • Events, logs, spans: These types of data represent a single record at a specific moment in time. For example, you may have an event for every request to the system. This data is ideal for in-depth troubleshooting and analysis.
  • Metrics: These provide an aggregated view of your events, logs, or spans. Metrics are better for showing trends over longer time ranges. For example, you can aggregate the total number of requests per service to one metric and then examine this information month over month.

Why use metrics?

Comments

Flexibility

  • Metrics are dimensional. You can choose what metadata (like host name or app name) is attached to them.
  • Common metric measurements, like average, sum, minimum, and maximum, are already calculated.

Data aggregation and retention

  • The data has already been pre-aggregated into longer-period time buckets.
  • Data retention is 13 months.

Query capabilities

  • You can query using the Metric data type.
  • When you create metrics, this does not delete your events or other types of data. However, metrics are better for longer-range querying and charting.

Here's a video showing how to generate metric data from event data (7:47 minutes):

To get started converting your data to metrics, create a rule.

Available operations

To show, create, and delete rules for generating metrics from events, logs, or spans, use NerdGraph, our GraphQL-format API. Before performing any operation, we recommend reading Intro to NerdGraph and exploring your data with the GraphiQL API tool.

These operations fall under two basic request types:

  • Mutations, which are operations that make changes to existing rules or settings (for example, creating a new metrics rule).
  • Queries, for fetching existing data (for example, fetching existing metrics rules).

All operations are role-based in NerdGraph as the currently logged-in New Relic user.

Mutations

Mutation operations for events to metrics, logs to metrics, or spans to metrics include:

Queries

Query operations include:

Use the NerdGraph API explorer tool

You can use NerdGraph API explorer, our GraphiQL tool, to explore the data structure. You can also use it to build and run the operations to convert events, logs, and spans to metrics. To use this tool:

  1. Create the metrics operation's request with the required parameters.
  2. Go to one.newrelic.com > All capabilities > Apps > NerdGraph API explorer and paste your query into the box.
  3. To execute the operation, click the red Execute query button. Or, to get the curl format, select Tools > Copy as CURL.
  4. Validate the response in the response box.
  5. Optional: To verify that your rule-creation operation was performed successfully, run a list query for that rule ID.
Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.