Skip to content

Commit

Permalink
chore: add language identifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
brnhensley committed May 29, 2023
1 parent e4d05bb commit ea1f038
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ redirects:

## Syntax

```
```py
newrelic.agent.data_source_generator(name=None, **properties)
```

Wraps a metric-data-generating data source.

## Description

The data source APIs provide a way to generate metrics using a [pull-style API](/docs/agents/python-agent/supported-features/python-custom-metrics#push-versus-pull-interfaces) rather than the push-style API implemented by [record_custom_metric](/docs/agents/python-agent/python-agent-api/record_custom_metric). For more about why and how to use data sources for custom metrics, see [Custom metric data sources](/docs/agents/python-agent/supported-features/python-custom-metrics#custom-metric-data-sources).
The data source APIs provide a way to generate metrics using a [pull-style API](/docs/agents/python-agent/supported-features/python-custom-metrics#push-versus-pull-interfaces) rather than the push-style API implemented by [`record_custom_metric`](/docs/agents/python-agent/python-agent-api/record_custom_metric). For more about why and how to use data sources for custom metrics, see [Custom metric data sources](/docs/agents/python-agent/supported-features/python-custom-metrics#custom-metric-data-sources).

The `data_source_generator` decorator is used to wrap a simple metric-data-generating data source that directly returns an iterable/generator with the metrics for each sample. The function the decorator is applied to must take no arguments. This would be used where there is no need to retain state information between calls to generate any metrics, and where the one instance of the data source can be used against multiple applications.

Expand Down Expand Up @@ -86,7 +86,7 @@ Returns a function.

An example of using `data_source_generator` to wrap a function that returns metric values:

```
```py
import psutil
import os

Expand Down

0 comments on commit ea1f038

Please sign in to comment.