Skip to content

Commit

Permalink
Merge pull request #18448 from bizob2828/remove-api-docs-refs
Browse files Browse the repository at this point in the history
chore: Updated all references to internal api docs and point to the g…
  • Loading branch information
rhetoric101 authored Aug 27, 2024
2 parents 082db2e + 95cecc9 commit ce34f1b
Show file tree
Hide file tree
Showing 17 changed files with 97 additions and 2,209 deletions.

Large diffs are not rendered by default.

1,048 changes: 17 additions & 1,031 deletions src/content/docs/apm/agents/nodejs-agent/api-guides/nodejs-agent-api.mdx

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,7 @@ For custom metric names, use `<class>/<method>` or `<category>/<name>`. For exam

The public API for recording metric data consists of two methods on `newrelic`:

* [`recordMetric`](/docs/apm/agents/nodejs-agent/api-guides/nodejs-agent-api/#record_metric): Use to create a new custom metric.
* [`incrementMetric`](/docs/apm/agents/nodejs-agent/api-guides/nodejs-agent-api/#increment_metric): Use to update the value of a custom metric.
* [`recordMetric`](https://newrelic.github.io/node-newrelic/API.html#recordMetric): Use to create a new custom metric.
* [`incrementMetric`](https://newrelic.github.io/node-newrelic/API.html#incrementMetric): Use to update the value of a custom metric.

## Example custom metric [#example]

Here is an example that shows how you can use metrics to track currency flowing through a site:

```js
app.post('/cart/checkout', function(req, res) {
var total = computeCartTotal(req.user);
newrelic.recordMetric('Cart/ChargeAmount', total);
// ...
});
```

## View custom metrics [#viewing-custom]

To view custom metrics, see [visualize your custom metric after creating it](/docs/query-your-data/explore-query-data/data-explorer/introduction-data-explorer#visualize-metric) and [metrics and events](/docs/query-your-data/explore-query-data/data-explorer/introduction-data-explorer) to search metrics, create customizable charts, and add those charts to New Relic dashboards.
For more information, see the [example application](https://github.com/newrelic/newrelic-node-examples/tree/69d500e02077d2565c4762c21bf779e3e39845bf/custom-instrumentation/attributes-events-metrics) on GitHub.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ When you [enable high-security mode](/docs/agents/nodejs-agent/installation-conf
If you need different security settings than default or high-security mode, you can customize these settings:

* [Node.js agent configuration file](/docs/agents/nodejs-agent/installation-configuration/nodejs-agent-configuration)
* [Custom attributes](/docs/agents/nodejs-agent/api-guides/nodejs-agent-api#add-custom-param)
* [Node.js agent API](/docs/agents/nodejs-agent/api-guides/guide-using-nodejs-agent-api)
* [Custom attributes](https://newrelic.github.io/node-newrelic/API.html#addCustomAttribute)
* [Node.js agent API]()https://newrelic.github.io/node-newrelic/API.html)

<table>
<thead>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ redirects:
freshnessValidatedDate: never
---

Our Node.js agent includes built-in instrumentation of the most popular Node.js frameworks, app servers, databases, and message queuing systems. For frameworks and libraries that aren't instrumented out of the box, you can extend the agent with our [Node.js agent API](/docs/apm/agents/nodejs-agent/api-guides/nodejs-agent-api/).
Our Node.js agent includes built-in instrumentation of the most popular Node.js frameworks, app servers, databases, and message queuing systems. For frameworks and libraries that aren't instrumented out of the box, you can extend the agent with our [Node.js agent API](https://newrelic.github.io/node-newrelic/API.html).

Our Node.js agent is publicly available on the [Node Package Manager (npm) repository](https://npmjs.org/package/newrelic) as well as on [GitHub](https://github.com/newrelic/node-newrelic). Ready to try out New Relic's Node.js agent? [Create a New Relic account](https://newrelic.com/signup)!

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,14 @@ If a service is not passing the trace header to other services, you can use the
To instrument the calling service:

1. Ensure the [version of the APM agent](#compatibility-requirements) that monitors the calling service supports distributed tracing.
2. Invoke the agent API call for generating a distributed trace payload (see the [Node.js agent API](/docs/agents/nodejs-agent/api-guides/nodejs-agent-api#transaction-handle-createDistributedTracePayload).
2. Invoke the agent API call for generating a distributed trace payload (see the [Node.js agent API](https://newrelic.github.io/node-newrelic/TransactionHandle.html#insertDistributedTraceHeaders)).

<Callout variant="important">
To maintain proper ordering of spans in a trace, ensure you <DNT>**generate the payload in the context of the span that sends it**</DNT>.
</Callout>
3. Add that payload to the call made to the destination service (for example, in a header).
4. (Optional) Identify the call as an external call (see the [Node.js agent API](/docs/agents/nodejs-agent/api-guides/nodejs-agent-api#custom-instrumentation-api).

For more information, see the [distributed tracing example application](https://github.com/newrelic/newrelic-node-examples/tree/0a036fd669b4b47b8afbc7add8696980f799f0da/custom-instrumentation/distributed-tracing) on GitHub.
</Collapser>

<Collapser
Expand All @@ -233,10 +234,10 @@ If a service is not passing the trace header to other services, you can use the
No transaction found when calling Transaction.acceptDistributedTracePayload.
```

Use [`startWebTransaction`](/docs/agents/nodejs-agent/api-guides/nodejs-agent-api#startWebTransaction) to create a web transaction or [`startBackgroundTransaction`](/docs/agents/nodejs-agent/api-guides/nodejs-agent-api#startBackgroundTransaction) to capture a [non-web transaction](/docs/apm/transactions/intro-transactions/monitor-background-processes-other-non-web-transactions).
Use [`startWebTransaction`](https://newrelic.github.io/node-newrelic/API.html#startWebTransaction) to create a web transaction or [`startBackgroundTransaction`](https://newrelic.github.io/node-newrelic/API.html#startBackgroundTransaction) to capture a [non-web transaction](/docs/apm/transactions/intro-transactions/monitor-background-processes-other-non-web-transactions). For more information, check out the [startWebTransaction](https://github.com/newrelic/newrelic-node-examples/tree/0a036fd669b4b47b8afbc7add8696980f799f0da/custom-instrumentation/start-web-transaction) and [startBackgroundTransaction](https://github.com/newrelic/newrelic-node-examples/tree/0a036fd669b4b47b8afbc7add8696980f799f0da/custom-instrumentation/background-transactions) example applications on GitHub.

3. Extract the payload from the call that you received (for example, in a header).

4. Invoke the call for accepting the payload (see the [Node.js agent API](/docs/agents/nodejs-agent/api-guides/nodejs-agent-api#transaction-handle-acceptDistributedTracePayload).
4. Invoke the call for accepting the payload (see the [Node.js agent API](https://newrelic.github.io/node-newrelic/TransactionHandle.html#acceptDistributedTraceHeaders)) or check out the [distributed tracing example application](https://github.com/newrelic/newrelic-node-examples/tree/0a036fd669b4b47b8afbc7add8696980f799f0da/custom-instrumentation/distributed-tracing) on GitHub.
</Collapser>
</CollapserGroup>
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ node --experimental-loader newrelic/esm-loader.mjs -r newrelic your-program.js
## Custom instrumentation [#custom-instrumentation]

The Node.js APM agent supports adding custom instrumentation to your ES module applications.
You can create instrumentation in ES module applications using most of the [instrumentation registration methods on the API](/docs/apm/agents/nodejs-agent/api-guides/nodejs-agent-api/#custom-instrumentation-api).
You can create instrumentation in ES module applications using most of the [instrumentation registration methods on the API](https://newrelic.github.io/node-newrelic/API.html#instrument).
Due to the nature of ES module imports, we are unable to support `newrelic.instrumentLoadedModule`. ES module bindings are not assignable, which prevent the agent from replacing a module's exported members with instrumentation after the module has been loaded.

To see a demonstration of how to use the custom instrumentation API in an ES module application, check out our [example](https://github.com/newrelic/newrelic-node-examples/blob/main/esm-app/custom-instrumentation/index.js) in GitHub.
To see a demonstration of how to use the custom instrumentation API in an ES module application, check out our [example](https://github.com/newrelic/newrelic-node-examples/blob/4284ee7eab69708238db0a44f97ff7e839e165cf/esm-app/custom-instrumentation/index.js) in GitHub.

## Learn More [#learn-more]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ To install the Node.js agent:
<Callout variant="important">
If you are unable to use the `-r` require flag you can also use `require('newrelic')` as the first line of your app's main module. <DNT>**Note**</DNT> If you are using [Babel](https://babeljs.io/docs/en/index.html) or a similar transpiler `require('newrelic')` will cause instrumentation issues.

If neither of these options work for you, (e.g. asynchronously loading api keys from a remote location during application bootstrapping), you may also add stock instrumentation to an already loaded [supported module](https://github.com/newrelic/node-newrelic/blob/0113eb5f0e707dc662a17d262a841503bab88841/lib/instrumentations.js#L6#L6) by using [`newrelic.instrumentLoadedModule`](/docs/apm/agents/nodejs-agent/api-guides/nodejs-agent-api/#instrumentLoadedModule):
If neither of these options work for you, (for example, asynchronously loading API keys from a remote location during application bootstrapping), you may also add stock instrumentation to an already loaded [supported module](https://github.com/newrelic/node-newrelic/blob/0113eb5f0e707dc662a17d262a841503bab88841/lib/instrumentations.js#L6#L6) by using [`newrelic.instrumentLoadedModule`](https://newrelic.github.io/node-newrelic/API.html#instrumentLoadedModule):

```js
// module loaded before newrelic
Expand All @@ -121,7 +121,7 @@ To install the Node.js agent:
You can further [customize your agent behavior](/docs/agents/nodejs-agent/installation-configuration/nodejs-agent-configuration) via `newrelic.js` or an environment variable. To keep the agent configuration separate from your app, edit the [`NEW_RELIC_HOME` environmental variable](/docs/agents/nodejs-agent/installation-configuration/nodejs-agent-configuration#home).
For more information, see our [API doc](/docs/apm/agents/nodejs-agent/api-guides/nodejs-agent-api/).
For more information, see our [API doc](https://newrelic.github.io/node-newrelic/API.html).
<InstallFeedback/>
Expand Down
Loading

0 comments on commit ce34f1b

Please sign in to comment.