Skip to content

Commit

Permalink
Update default values, and add descriptions to them
Browse files Browse the repository at this point in the history
  • Loading branch information
klippx committed Sep 19, 2023
1 parent 9c8f47f commit bfebf77
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
11 changes: 7 additions & 4 deletions plugins/node/opentelemetry-instrumentation-runtime/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ const { MeterProvider } = require('@opentelemetry/sdk-metrics');
const { HostMetrics } = require('@opentelemetry/host-metrics');
const { PrometheusExporter } = require('@opentelemetry/exporter-prometheus');
const { registerInstrumentations } = require('@opentelemetry/instrumentation');
const {
RuntimeInstrumentation,
} = require('@opentelemetry/instrumentation-runtime');

const exporter = new PrometheusExporter(
{
Expand All @@ -48,10 +51,10 @@ registerInstrumentations({

Runtime instrumentation has currently one option. You can set the following:

| Options | Type | Description |
| --------------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `monitorEventLoopDelayResolution` | `number` | Sampling rate in milliseconds. [perf_hooks.monitorEventLoopDelay](https://nodejs.org/api/perf_hooks.html#perf_hooksmonitoreventloopdelayoptions) |
| `monitorEventLoopUtilizationResolution` | `number` | Sampling rate in milliseconds. [perf_hooks.performance.eventLoopUtilization](https://nodejs.org/api/perf_hooks.html#performanceeventlooputilizationutilization1-utilization2) |
| Options | Type | Description |
| --------------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `monitorEventLoopDelayResolution` | `number` | Sampling rate for data collection, in milliseconds. [perf_hooks.monitorEventLoopDelay](https://nodejs.org/api/perf_hooks.html#perf_hooksmonitoreventloopdelayoptions) |
| `monitorEventLoopUtilizationResolution` | `number` | Delta interval for calculation, in milliseconds. [perf_hooks.performance.eventLoopUtilization](https://nodejs.org/api/perf_hooks.html#performanceeventlooputilizationutilization1-utilization2) |

## Useful links

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ export class RuntimeInstrumentation extends InstrumentationBase {

constructor(
config: RuntimeInstrumentationConfig = {
monitorEventLoopDelayResolution: 1000,
monitorEventLoopUtilizationResolution: 1000,
monitorEventLoopDelayResolution: 10,
monitorEventLoopUtilizationResolution: 30000,
}
) {
super('@opentelemetry/instrumentation-runtime', VERSION, config);
Expand All @@ -59,6 +59,7 @@ export class RuntimeInstrumentation extends InstrumentationBase {
this._lastIntervalELU = initialELU;
this.ELU = initialELU;
this.config = config;
this.enable();
}

protected override _updateMetricInstruments() {
Expand Down
10 changes: 6 additions & 4 deletions plugins/node/opentelemetry-instrumentation-runtime/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@ import { InstrumentationConfig } from '@opentelemetry/instrumentation';
export interface RuntimeInstrumentationConfig extends InstrumentationConfig {
/**
* The sampling rate in milliseconds of event loop delay.
* Must be greater than zero.
* @default 1000
* Setting this too high will result in inaccurate data, as the baseline
* will be skewed by this value.
* @default 10
*/
monitorEventLoopDelayResolution?: number;
/**
* The sampling rate in milliseconds of event loop utilization.
* Must be greater than zero.
* @default 1000
* If you are using PeriodicExportingMetricReader it is recommended to set
* this value to (at most) half of what exportIntervalMillis is set to.
* @default 30000
*/
monitorEventLoopUtilizationResolution?: number;
}

0 comments on commit bfebf77

Please sign in to comment.