Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@

Endpoint and operation isolation is available in your profiles by default, but you may want to isolate a different piece of logic. For example, if the monolith is sensitive to specific customers, you can add a custom filter to the profiles:

{{< programming-lang-wrapper langs="java,go" >}}
{{< programming-lang-wrapper langs="java,go,nodejs" >}}

Check warning on line 81 in content/en/profiler/guide/isolate-outliers-in-monolithic-services.md

View workflow job for this annotation

GitHub Actions / vale

Datadog.words_case_sensitive

Use 'Node.js' instead of 'nodejs'.
{{< programming-lang lang="java">}}


Expand Down Expand Up @@ -124,6 +124,31 @@
[1]: https://pkg.go.dev/runtime/pprof#Do
[2]: https://pkg.go.dev/gopkg.in/DataDog/dd-trace-go.v1/profiler#WithCustomProfilerLabelKeys
[3]: https://pkg.go.dev/github.com/DataDog/dd-trace-go/v2/profiler#WithCustomProfilerLabelKeys
{{< /programming-lang >}}
{{< programming-lang lang="nodejs">}}

Check warning on line 128 in content/en/profiler/guide/isolate-outliers-in-monolithic-services.md

View workflow job for this annotation

GitHub Actions / vale

Datadog.words_case_sensitive

Use 'Node.js' instead of 'nodejs'.

The Node.js profiler supports custom labels for your business logic as of `dd-trace` version 5.97.0 on Node.js 24 or later.

To add labels, use `tracer.profiling.runWithLabels()`:

```javascript
const tracer = require('dd-trace').init()

tracer.profiling.runWithLabels({ customer_name: <value> }, () => {
/* customer-specific logic here */
})
```

All wall time and CPU time samples taken during the function's execution, including across async continuations, carry the custom labels. Nested `runWithLabels` calls merge labels. Inner values take precedence for duplicate keys.

To specify which label keys you want to use for filtering, call `setCustomLabelKeys()` one time before calling `runWithLabels()`:

```javascript
tracer.profiling.setCustomLabelKeys(['customer_name'])
```

Then, open wall time or CPU time profiles for your service and select the `customer_name` value you're interested in under the `CPU time by` dropdown.

{{< /programming-lang >}}
{{< /programming-lang-wrapper >}}

Expand Down
Loading