-
Notifications
You must be signed in to change notification settings - Fork 532
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(instrumentation-runtime-node)!: add prom-client-metrics #2136
Changes from 18 commits
ed6596f
046072e
d7c5108
ad88f98
2cd9093
184b212
922d677
3cba596
54858de
926f052
dbb34ff
ade0ab9
7a98bfd
7418c78
fdfea51
6a84254
5efdd9d
a69fc5c
2d31e98
184be5e
8bf14b5
5121a0b
fd8d803
6506489
012f370
247403e
d99c458
43ba51c
2189d51
460003f
310a2b2
feb3f36
6b5fc8b
97d8d92
cab7e6c
b663012
a6a9e81
4941407
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -26,7 +26,7 @@ const prometheusExporter = new PrometheusExporter({ | |||||
const sdk = new NodeSDK({ | ||||||
metricReader: prometheusExporter, | ||||||
instrumentations: [new RuntimeNodeInstrumentation({ | ||||||
eventLoopUtilizationMeasurementInterval: 5000, | ||||||
monitoringPrecision: 5000, | ||||||
})], | ||||||
}); | ||||||
|
||||||
|
@@ -44,7 +44,7 @@ Go to [`localhost:9464/metrics`](http://localhost:9464/metrics), and you should | |||||
nodejs_performance_event_loop_utilization 0.010140079547955264 | ||||||
``` | ||||||
|
||||||
> Metrics will only be exported after it has collected two ELU readings (at least approximately `RuntimeNodeInstrumentationConfig.eventLoopUtilizationMeasurementInterval` milliseconds after initialization). Otherwise, you may see: | ||||||
> Metrics will only be exported after it has collected two ELU readings (at least approximately `RuntimeNodeInstrumentationConfig.monitoringPrecision` milliseconds after initialization). Otherwise, you may see: | ||||||
> | ||||||
> ```txt | ||||||
> # no registered metrics | ||||||
|
@@ -56,7 +56,7 @@ nodejs_performance_event_loop_utilization 0.010140079547955264 | |||||
|
||||||
| name | type | unit | default | description | | ||||||
|---|---|---|---|---| | ||||||
| [`eventLoopUtilizationMeasurementInterval`](./src/types.ts#L25) | `int` | millisecond | `5000` | The approximate number of milliseconds for which to calculate event loop utilization averages. A larger value will result in more accurate averages at the expense of less granular data. Should be set to below the scrape interval of your metrics collector to avoid duplicated data points. | | ||||||
| [`monitoringPrecision`](./src/types.ts#L25) | `int` | millisecond | `5000` | The approximate number of milliseconds for which to calculate event loop utilization averages. A larger value will result in more accurate averages at the expense of less granular data. Should be set to below the scrape interval of your metrics collector to avoid duplicated data points. | | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion(non-blocking): update the default You changed the default to
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in 6b5fc8b |
||||||
|
||||||
## Supported Node.js versions | ||||||
|
||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
export const V8_HEAP_SIZE_NAME_ATTRIBUTE = 'heap.space.name'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume these are just temporary until the next semconv release? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. actually, they already exist on the current release (they didn't when the PR was created), so @pikalovArtemN you can replace for the final values. For example, this one is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fix |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import { MetricCollector } from '../types/metricCollector'; | ||
import { Meter } from '@opentelemetry/api'; | ||
import { RuntimeNodeInstrumentationConfig } from '../types'; | ||
|
||
export abstract class BaseCollector implements MetricCollector { | ||
protected _config: RuntimeNodeInstrumentationConfig = {}; | ||
|
||
protected namePrefix: string; | ||
|
||
protected constructor( | ||
config: RuntimeNodeInstrumentationConfig = {}, | ||
namePrefix: string | ||
) { | ||
this._config = config; | ||
this.namePrefix = namePrefix; | ||
} | ||
|
||
public disable(): void { | ||
this._config.enabled = false; | ||
this.internalDisable(); | ||
} | ||
|
||
public enable(): void { | ||
this._config.enabled = true; | ||
this.internalEnable(); | ||
} | ||
|
||
public abstract updateMetricInstruments(meter: Meter): void; | ||
|
||
protected abstract internalEnable(): void; | ||
|
||
protected abstract internalDisable(): void; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor Q: It looks like the default is 10 ms (from lower down in this README). Should the example here show 10 rather than 5000?