File tree 3 files changed +10
-12
lines changed
packages/opentelemetry-exporter-prometheus
3 files changed +10
-12
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ All notable changes to experimental packages in this project will be documented
21
21
22
22
### :house : (Internal)
23
23
24
+ * refactor(exporter-prometheus): replace ` MetricAttributes ` and ` MetricAttributeValues ` with ` Attributes ` and ` AttributeValues ` [ #4993 ] ( https://github.com/open-telemetry/opentelemetry-js/pull/4993 )
25
+
24
26
## 0.53.0
25
27
26
28
### :boom : Breaking Change
Original file line number Diff line number Diff line change 14
14
* limitations under the License.
15
15
*/
16
16
17
- import {
18
- diag ,
19
- MetricAttributes ,
20
- MetricAttributeValue ,
21
- } from '@opentelemetry/api' ;
17
+ import { diag , Attributes , AttributeValue } from '@opentelemetry/api' ;
22
18
import {
23
19
ResourceMetrics ,
24
20
InstrumentType ,
@@ -48,7 +44,7 @@ function escapeString(str: string) {
48
44
*
49
45
* `undefined` is converted to an empty string.
50
46
*/
51
- function escapeAttributeValue ( str : MetricAttributeValue = '' ) {
47
+ function escapeAttributeValue ( str : AttributeValue = '' ) {
52
48
if ( typeof str !== 'string' ) {
53
49
str = JSON . stringify ( str ) ;
54
50
}
@@ -136,10 +132,10 @@ function toPrometheusType(metricData: MetricData): PrometheusDataTypeLiteral {
136
132
137
133
function stringify (
138
134
metricName : string ,
139
- attributes : MetricAttributes ,
135
+ attributes : Attributes ,
140
136
value : number ,
141
137
timestamp ?: number ,
142
- additionalAttributes ?: MetricAttributes
138
+ additionalAttributes ?: Attributes
143
139
) {
144
140
let hasAttribute = false ;
145
141
let attributesStr = '' ;
Original file line number Diff line number Diff line change 15
15
*/
16
16
17
17
import * as assert from 'assert' ;
18
- import { MetricAttributes , UpDownCounter } from '@opentelemetry/api' ;
18
+ import { Attributes , UpDownCounter } from '@opentelemetry/api' ;
19
19
import {
20
20
Aggregation ,
21
21
AggregationTemporality ,
@@ -610,7 +610,7 @@ describe('PrometheusSerializer', () => {
610
610
NaN : NaN ,
611
611
null : null ,
612
612
undefined : undefined ,
613
- } as unknown as MetricAttributes ) ;
613
+ } as unknown as Attributes ) ;
614
614
} ) ;
615
615
616
616
assert . strictEqual (
@@ -649,7 +649,7 @@ describe('PrometheusSerializer', () => {
649
649
backslashN : '\u005c\u006e' , // \n => \\n (\u005c\u005c\u006e)
650
650
backslashDoubleQuote : '\u005c\u0022' , // \" => \\\" (\u005c\u005c\u005c\u0022)
651
651
backslashLineFeed : '\u005c\u000a' , // \↵ => \\\n (\u005c\u005c\u005c\u006e)
652
- } as unknown as MetricAttributes ) ;
652
+ } as unknown as Attributes ) ;
653
653
} ) ;
654
654
655
655
assert . strictEqual (
@@ -674,7 +674,7 @@ describe('PrometheusSerializer', () => {
674
674
// error while linting: text format parsing error in line 282: expected '=' after label name, found '-'
675
675
counter . add ( 1 , {
676
676
'account-id' : '123456' ,
677
- } as unknown as MetricAttributes ) ;
677
+ } as unknown as Attributes ) ;
678
678
} ) ;
679
679
680
680
assert . strictEqual ( result , 'test_total{account_id="123456"} 1\n' ) ;
You can’t perform that action at this time.
0 commit comments