@opentelemetry/exporter-prometheus
Advanced tools
Comparing version 0.33.0 to 0.34.0
@@ -42,3 +42,3 @@ /// <reference types="node" /> | ||
* Request handler that responds with the current state of metrics | ||
* @param request Incoming HTTP request of server instance | ||
* @param _request Incoming HTTP request of server instance | ||
* @param response HTTP response objet used to response to request | ||
@@ -45,0 +45,0 @@ */ |
@@ -26,3 +26,2 @@ "use strict"; | ||
const url_1 = require("url"); | ||
const NO_REGISTERED_METRICS = '# no registered metrics'; | ||
class PrometheusExporter extends sdk_metrics_1.MetricReader { | ||
@@ -69,7 +68,3 @@ // This will be required when histogram is implemented. Leaving here so it is not forgotten | ||
} | ||
let result = this._serializer.serialize(resourceMetrics); | ||
if (result === '') { | ||
result = NO_REGISTERED_METRICS; | ||
} | ||
response.end(result); | ||
response.end(this._serializer.serialize(resourceMetrics)); | ||
}, err => { | ||
@@ -163,3 +158,3 @@ response.end(`# failed to export metrics: ${err}`); | ||
* Request handler that responds with the current state of metrics | ||
* @param request Incoming HTTP request of server instance | ||
* @param _request Incoming HTTP request of server instance | ||
* @param response HTTP response objet used to response to request | ||
@@ -166,0 +161,0 @@ */ |
import { ResourceMetrics } from '@opentelemetry/sdk-metrics'; | ||
import { Resource } from '@opentelemetry/resources'; | ||
export declare class PrometheusSerializer { | ||
@@ -11,3 +12,4 @@ private _prefix; | ||
private _serializeHistogramDataPoint; | ||
protected _serializeResource(resource: Resource): string; | ||
} | ||
//# sourceMappingURL=PrometheusSerializer.d.ts.map |
@@ -126,2 +126,3 @@ "use strict"; | ||
} | ||
const NO_REGISTERED_METRICS = '# no registered metrics'; | ||
class PrometheusSerializer { | ||
@@ -139,3 +140,6 @@ constructor(prefix, appendTimestamp = true) { | ||
} | ||
return str; | ||
if (str === '') { | ||
str += NO_REGISTERED_METRICS; | ||
} | ||
return this._serializeResource(resourceMetrics.resource) + str; | ||
} | ||
@@ -226,4 +230,11 @@ _serializeScopeMetrics(scopeMetrics) { | ||
} | ||
_serializeResource(resource) { | ||
const name = 'target_info'; | ||
const help = `# HELP ${name} Target metadata`; | ||
const type = `# TYPE ${name} gauge`; | ||
const results = stringify(name, resource.attributes, 1).trim(); | ||
return `${help}\n${type}\n${results}\n`; | ||
} | ||
} | ||
exports.PrometheusSerializer = PrometheusSerializer; | ||
//# sourceMappingURL=PrometheusSerializer.js.map |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "0.33.0"; | ||
export declare const VERSION = "0.34.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -20,3 +20,3 @@ "use strict"; | ||
// this is autogenerated file, see scripts/version-update.js | ||
exports.VERSION = '0.33.0'; | ||
exports.VERSION = '0.34.0'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@opentelemetry/exporter-prometheus", | ||
"version": "0.33.0", | ||
"version": "0.34.0", | ||
"description": "OpenTelemetry Exporter Prometheus provides a metrics endpoint for Prometheus", | ||
@@ -46,4 +46,4 @@ "main": "build/src/index.js", | ||
"devDependencies": { | ||
"@opentelemetry/api": "^1.0.0", | ||
"@types/mocha": "9.1.1", | ||
"@opentelemetry/api": "^1.3.0", | ||
"@types/mocha": "10.0.0", | ||
"@types/node": "18.6.5", | ||
@@ -60,11 +60,12 @@ "@types/sinon": "10.0.13", | ||
"peerDependencies": { | ||
"@opentelemetry/api": "^1.0.0" | ||
"@opentelemetry/api": "^1.3.0" | ||
}, | ||
"dependencies": { | ||
"@opentelemetry/api-metrics": "0.33.0", | ||
"@opentelemetry/core": "1.7.0", | ||
"@opentelemetry/sdk-metrics": "0.33.0" | ||
"@opentelemetry/core": "1.8.0", | ||
"@opentelemetry/resources": "1.8.0", | ||
"@opentelemetry/sdk-metrics": "1.8.0" | ||
}, | ||
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-exporter-prometheus", | ||
"gitHead": "ad88c3d9aa0100fe259b93f4b660e84417b757ac" | ||
"sideEffects": false, | ||
"gitHead": "7972edf6659fb6e0d5928a5cf7a35f26683e168f" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
69726
590
+ Added@opentelemetry/api@1.3.0(transitive)
+ Added@opentelemetry/core@1.8.0(transitive)
+ Added@opentelemetry/resources@1.8.0(transitive)
+ Added@opentelemetry/sdk-metrics@1.8.0(transitive)
+ Added@opentelemetry/semantic-conventions@1.8.0(transitive)
- Removed@opentelemetry/api-metrics@0.33.0
- Removed@opentelemetry/api@1.2.0(transitive)
- Removed@opentelemetry/api-metrics@0.33.0(transitive)
- Removed@opentelemetry/core@1.7.0(transitive)
- Removed@opentelemetry/resources@1.7.0(transitive)
- Removed@opentelemetry/sdk-metrics@0.33.0(transitive)
- Removed@opentelemetry/semantic-conventions@1.7.0(transitive)
Updated@opentelemetry/core@1.8.0