1
1
import { Attributes } from "@opentelemetry/api" ;
2
- import type { Objective } from "./objectives" ;
2
+ import { setBuildInfo } from "./buildInfo" ;
3
+ import {
4
+ COUNTER_DESCRIPTION ,
5
+ COUNTER_NAME ,
6
+ GAUGE_DESCRIPTION ,
7
+ GAUGE_NAME ,
8
+ HISTOGRAM_DESCRIPTION ,
9
+ HISTOGRAM_NAME ,
10
+ } from "./constants" ;
3
11
import { getMeter } from "./instrumentation" ;
12
+ import type { Objective } from "./objectives" ;
4
13
import {
5
14
ALSInstance ,
6
15
getALSCaller ,
@@ -10,7 +19,6 @@ import {
10
19
isObject ,
11
20
isPromise ,
12
21
} from "./utils" ;
13
- import { setBuildInfo } from "./buildInfo" ;
14
22
15
23
let asyncLocalStorage : ALSInstance | undefined ;
16
24
if ( typeof window === "undefined" ) {
@@ -224,9 +232,15 @@ export function autometrics<F extends FunctionSig>(
224
232
225
233
const meter = getMeter ( ) ;
226
234
setBuildInfo ( ) ;
227
- const counter = meter . createCounter ( "function.calls.count" ) ;
228
- const histogram = meter . createHistogram ( "function.calls.duration" ) ;
229
- const gauge = meter . createUpDownCounter ( "function.calls.concurrent" ) ;
235
+ const counter = meter . createCounter ( COUNTER_NAME , {
236
+ description : COUNTER_DESCRIPTION ,
237
+ } ) ;
238
+ const histogram = meter . createHistogram ( HISTOGRAM_NAME , {
239
+ description : HISTOGRAM_DESCRIPTION ,
240
+ } ) ;
241
+ const gauge = meter . createUpDownCounter ( GAUGE_NAME , {
242
+ description : GAUGE_DESCRIPTION ,
243
+ } ) ;
230
244
const caller = getALSCaller ( asyncLocalStorage ) ;
231
245
232
246
counter . add ( 0 , {
0 commit comments