File tree Expand file tree Collapse file tree 3 files changed +16
-8
lines changed Expand file tree Collapse file tree 3 files changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ project adheres to [Semantic Versioning](http://semver.org/).
12
12
### Changed
13
13
14
14
- Add ` Registry.PROMETHEUS_CONTENT_TYPE ` and ` Registry.OPENMETRICS_CONTENT_TYPE ` constants to the TypeScript types
15
+ - Correctly read and set ` contentType ` top level export
15
16
16
17
### Added
17
18
Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ export class Registry<RegistryContentType = PrometheusContentType> {
81
81
/**
82
82
* Gets the Content-Type of the metrics for use in the response headers.
83
83
*/
84
- contentType : RegistryContentType ;
84
+ readonly contentType : RegistryContentType ;
85
85
86
86
/**
87
87
* Set the content type of a registry. Used to change between Prometheus and
@@ -114,8 +114,8 @@ export type Collector = () => void;
114
114
export const register : Registry ;
115
115
116
116
/**
117
- * HTTP Content-Type for metrics response headers, defaults to Prometheus text
118
- * format.
117
+ * HTTP Content-Type for metrics response headers for the default registry,
118
+ * defaults to Prometheus text format.
119
119
*/
120
120
export const contentType : RegistryContentType ;
121
121
Original file line number Diff line number Diff line change 7
7
8
8
exports . register = require ( './lib/registry' ) . globalRegistry ;
9
9
exports . Registry = require ( './lib/registry' ) ;
10
- exports . contentType = require ( './lib/registry' ) . globalRegistry . contentType ;
11
- exports . prometheusContentType =
12
- require ( './lib/registry' ) . PROMETHEUS_CONTENT_TYPE ;
13
- exports . openMetricsContentType =
14
- require ( './lib/registry' ) . OPENMETRICS_CONTENT_TYPE ;
10
+ Object . defineProperty ( exports , 'contentType' , {
11
+ configurable : false ,
12
+ enumerable : true ,
13
+ get ( ) {
14
+ return exports . register . contentType ;
15
+ } ,
16
+ set ( value ) {
17
+ exports . register . setContentType ( value ) ;
18
+ } ,
19
+ } ) ;
20
+ exports . prometheusContentType = exports . Registry . PROMETHEUS_CONTENT_TYPE ;
21
+ exports . openMetricsContentType = exports . Registry . OPENMETRICS_CONTENT_TYPE ;
15
22
exports . validateMetricName = require ( './lib/validation' ) . validateMetricName ;
16
23
17
24
exports . Counter = require ( './lib/counter' ) ;
You can’t perform that action at this time.
0 commit comments