-
Notifications
You must be signed in to change notification settings - Fork 821
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update prometheus examples (#2939)
- Loading branch information
1 parent
60a17ee
commit 6436d85
Showing
19 changed files
with
51 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
"env": { | ||
"mocha": true, | ||
"node": true | ||
}, | ||
...require('../../eslint.config.js') | ||
} |
File renamed without changes.
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
'use strict'; | ||
|
||
const { DiagConsoleLogger, DiagLogLevel, diag } = require('@opentelemetry/api'); | ||
const { MeterProvider } = require('@opentelemetry/sdk-metrics-base'); | ||
This comment has been minimized.
Sorry, something went wrong. |
||
const { PrometheusExporter } = require('@opentelemetry/exporter-prometheus'); | ||
|
||
// Optional and only needed to see the internal diagnostic logging (during development) | ||
diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.DEBUG); | ||
|
||
const { endpoint, port } = PrometheusExporter.DEFAULT_OPTIONS; | ||
|
||
const exporter = new PrometheusExporter({}, () => { | ||
console.log( | ||
`prometheus scrape endpoint: http://localhost:${port}${endpoint}`, | ||
); | ||
}); | ||
|
||
// Creates MeterProvider and installs the exporter as a MetricReader | ||
const meterProvider = new MeterProvider(); | ||
meterProvider.addMetricReader(exporter); | ||
This comment has been minimized.
Sorry, something went wrong.
SourovKH
|
||
const meter = meterProvider.getMeter('example-prometheus'); | ||
|
||
// Creates metric instruments | ||
const requestCounter = meter.createCounter('requests', { | ||
description: 'Example of a Counter', | ||
}); | ||
|
||
const upDownCounter = meter.createUpDownCounter('test_up_down_counter', { | ||
description: 'Example of a UpDownCounter', | ||
}); | ||
|
||
const attributes = { pid: process.pid, environment: 'staging' }; | ||
|
||
// Record metrics | ||
setInterval(() => { | ||
requestCounter.add(1, attributes); | ||
upDownCounter.add(Math.random() > 0.5 ? 1 : -1, attributes); | ||
}, 1000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
17 changes: 0 additions & 17 deletions
17
experimental/packages/opentelemetry-sdk-metrics-base/examples/.eslintrc.json
This file was deleted.
Oops, something went wrong.
49 changes: 0 additions & 49 deletions
49
experimental/packages/opentelemetry-sdk-metrics-base/examples/metrics/README.md
This file was deleted.
Oops, something went wrong.
42 changes: 0 additions & 42 deletions
42
experimental/packages/opentelemetry-sdk-metrics-base/examples/metrics/metrics/observer.js
This file was deleted.
Oops, something went wrong.
Binary file removed
BIN
-189 KB
...l/packages/opentelemetry-sdk-metrics-base/examples/metrics/metrics/observer.png
Binary file not shown.
Binary file removed
BIN
-251 KB
...ages/opentelemetry-sdk-metrics-base/examples/metrics/metrics/observer_batch.png
Binary file not shown.
Binary file removed
BIN
-251 KB
...ges/opentelemetry-sdk-metrics-base/examples/metrics/metrics/observer_batch2.png
Binary file not shown.
35 changes: 0 additions & 35 deletions
35
experimental/packages/opentelemetry-sdk-metrics-base/examples/metrics/package.json
This file was deleted.
Oops, something went wrong.
this package itself is deprecated
please use @opentelemetry/sdk-metrics
https://www.npmjs.com/package/@opentelemetry/sdk-metrics