Skip to content

Commit

Permalink
docs(prom-example): remove deprecated startServer option (#2802)
Browse files Browse the repository at this point in the history
Co-authored-by: Valentin Marchaud <[email protected]>
  • Loading branch information
naseemkullah and vmarchaud authored Feb 22, 2022
1 parent 630a261 commit 144e11a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 22 deletions.
17 changes: 7 additions & 10 deletions examples/prometheus/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@
const { MeterProvider } = require('@opentelemetry/sdk-metrics-base');
const { PrometheusExporter } = require('@opentelemetry/exporter-prometheus');

const exporter = new PrometheusExporter(
{
startServer: true,
},
() => {
console.log(
`prometheus scrape endpoint: http://localhost:${PrometheusExporter.DEFAULT_OPTIONS.port}${PrometheusExporter.DEFAULT_OPTIONS.endpoint}`,
);
},
);
const { endpoint, port } = PrometheusExporter.DEFAULT_OPTIONS;

const exporter = new PrometheusExporter({}, () => {
console.log(
`prometheus scrape endpoint: http://localhost:${port}${endpoint}`,
);
});

const meter = new MeterProvider({
exporter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,13 @@ 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 exporter = new PrometheusExporter(
{
startServer: true,
},
() => {
console.log(
`prometheus scrape endpoint: http://localhost:${PrometheusExporter.DEFAULT_OPTIONS.port}${PrometheusExporter.DEFAULT_OPTIONS.endpoint}`,
);
},
);
const { endpoint, port } = PrometheusExporter.DEFAULT_OPTIONS;

const exporter = new PrometheusExporter({}, () => {
console.log(
`prometheus scrape endpoint: http://localhost:${port}${endpoint}`,
);
});

const meter = new MeterProvider({
exporter,
Expand All @@ -34,12 +31,12 @@ meter.createObservableGauge('cpu_core_usage', {

function getAsyncValue() {
return new Promise((resolve) => {
setTimeout(()=> {
setTimeout(() => {
resolve(Math.random());
}, 100);
});
}

setInterval(function(){
setInterval(function () {
console.log("simulating an app being kept open")
}, 5000);

0 comments on commit 144e11a

Please sign in to comment.