@@ -27,6 +27,7 @@ import { MetricOptions } from './types';
2727import { MetricKind , MetricDescriptor , MetricRecord } from './export/types' ;
2828import { Batcher } from './export/Batcher' ;
2929import { hashLabels } from './Utils' ;
30+ import { InstrumentationLibrary } from '@opentelemetry/core' ;
3031
3132/** This is a SDK implementation of {@link Metric} interface. */
3233export abstract class Metric < T extends BaseBoundInstrument >
@@ -42,7 +43,8 @@ export abstract class Metric<T extends BaseBoundInstrument>
4243 private readonly _name : string ,
4344 private readonly _options : MetricOptions ,
4445 private readonly _kind : MetricKind ,
45- readonly resource : Resource
46+ readonly resource : Resource ,
47+ readonly instrumentationLibrary : InstrumentationLibrary
4648 ) {
4749 this . _monotonic = _options . monotonic ;
4850 this . _disabled = _options . disabled ;
@@ -88,6 +90,7 @@ export abstract class Metric<T extends BaseBoundInstrument>
8890 labels : instrument . getLabels ( ) ,
8991 aggregator : instrument . getAggregator ( ) ,
9092 resource : this . resource ,
93+ instrumentationLibrary : this . instrumentationLibrary ,
9194 } ) ) ;
9295 }
9396
@@ -111,9 +114,10 @@ export class CounterMetric extends Metric<BoundCounter> implements api.Counter {
111114 name : string ,
112115 options : MetricOptions ,
113116 private readonly _batcher : Batcher ,
114- resource : Resource
117+ resource : Resource ,
118+ instrumentationLibrary : InstrumentationLibrary
115119 ) {
116- super ( name , options , MetricKind . COUNTER , resource ) ;
120+ super ( name , options , MetricKind . COUNTER , resource , instrumentationLibrary ) ;
117121 }
118122 protected _makeInstrument ( labels : api . Labels ) : BoundCounter {
119123 return new BoundCounter (
@@ -146,9 +150,16 @@ export class ValueRecorderMetric extends Metric<BoundValueRecorder>
146150 name : string ,
147151 options : MetricOptions ,
148152 private readonly _batcher : Batcher ,
149- resource : Resource
153+ resource : Resource ,
154+ instrumentationLibrary : InstrumentationLibrary
150155 ) {
151- super ( name , options , MetricKind . VALUE_RECORDER , resource ) ;
156+ super (
157+ name ,
158+ options ,
159+ MetricKind . VALUE_RECORDER ,
160+ resource ,
161+ instrumentationLibrary
162+ ) ;
152163
153164 this . _absolute = options . absolute !== undefined ? options . absolute : true ; // Absolute default is true
154165 }
@@ -178,9 +189,10 @@ export class ObserverMetric extends Metric<BoundObserver>
178189 name : string ,
179190 options : MetricOptions ,
180191 private readonly _batcher : Batcher ,
181- resource : Resource
192+ resource : Resource ,
193+ instrumentationLibrary : InstrumentationLibrary
182194 ) {
183- super ( name , options , MetricKind . OBSERVER , resource ) ;
195+ super ( name , options , MetricKind . OBSERVER , resource , instrumentationLibrary ) ;
184196 }
185197
186198 protected _makeInstrument ( labels : api . Labels ) : BoundObserver {
0 commit comments