1515 */
1616
1717import {
18- CounterHandle ,
18+ BoundCounter ,
1919 DistributedContext ,
20- GaugeHandle ,
20+ BoundGauge ,
2121 Meter ,
2222 Metric ,
2323 MetricOptions ,
2424 MetricUtils ,
25- MeasureHandle ,
25+ BoundMeasure ,
2626 SpanContext ,
2727 LabelSet ,
2828 Labels ,
@@ -40,7 +40,7 @@ export class NoopMeter implements Meter {
4040 * @param name the name of the metric.
4141 * @param [options] the metric options.
4242 */
43- createMeasure ( name : string , options ?: MetricOptions ) : Metric < MeasureHandle > {
43+ createMeasure ( name : string , options ?: MetricOptions ) : Metric < BoundMeasure > {
4444 return NOOP_MEASURE_METRIC ;
4545 }
4646
@@ -49,7 +49,7 @@ export class NoopMeter implements Meter {
4949 * @param name the name of the metric.
5050 * @param [options] the metric options.
5151 */
52- createCounter ( name : string , options ?: MetricOptions ) : Metric < CounterHandle > {
52+ createCounter ( name : string , options ?: MetricOptions ) : Metric < BoundCounter > {
5353 return NOOP_COUNTER_METRIC ;
5454 }
5555
@@ -58,7 +58,7 @@ export class NoopMeter implements Meter {
5858 * @param name the name of the metric.
5959 * @param [options] the metric options.
6060 */
61- createGauge ( name : string , options ?: MetricOptions ) : Metric < GaugeHandle > {
61+ createGauge ( name : string , options ?: MetricOptions ) : Metric < BoundGauge > {
6262 return NOOP_GAUGE_METRIC ;
6363 }
6464
@@ -68,33 +68,33 @@ export class NoopMeter implements Meter {
6868}
6969
7070export class NoopMetric < T > implements Metric < T > {
71- private readonly _handle : T ;
71+ private readonly _instrument : T ;
7272
73- constructor ( handle : T ) {
74- this . _handle = handle ;
73+ constructor ( instrument : T ) {
74+ this . _instrument = instrument ;
7575 }
7676 /**
77- * Returns a Handle associated with specified LabelSet.
78- * It is recommended to keep a reference to the Handle instead of always
77+ * Returns a Bound Instrument associated with specified LabelSet.
78+ * It is recommended to keep a reference to the Bound Instrument instead of always
7979 * calling this method for every operations.
80- * @param labels the canonicalized LabelSet used to associate with this metric handle .
80+ * @param labels the canonicalized LabelSet used to associate with this metric instrument .
8181 */
82- getHandle ( labels : LabelSet ) : T {
83- return this . _handle ;
82+ bind ( labels : LabelSet ) : T {
83+ return this . _instrument ;
8484 }
8585
8686 /**
87- * Returns a Handle for a metric with all labels not set.
87+ * Returns a Bound Instrument for a metric with all labels not set.
8888 */
89- getDefaultHandle ( ) : T {
90- return this . _handle ;
89+ getDefaultBound ( ) : T {
90+ return this . _instrument ;
9191 }
9292
9393 /**
94- * Removes the Handle from the metric, if it is present.
95- * @param labels the canonicalized LabelSet used to associate with this metric handle .
94+ * Removes the Binding from the metric, if it is present.
95+ * @param labels the canonicalized LabelSet used to associate with this metric instrument .
9696 */
97- removeHandle ( labels : LabelSet ) : void {
97+ unbind ( labels : LabelSet ) : void {
9898 // @todo : implement this method
9999 return ;
100100 }
@@ -111,21 +111,21 @@ export class NoopMetric<T> implements Metric<T> {
111111 }
112112}
113113
114- export class NoopCounterMetric extends NoopMetric < CounterHandle >
114+ export class NoopCounterMetric extends NoopMetric < BoundCounter >
115115 implements Pick < MetricUtils , 'add' > {
116116 add ( value : number , labelSet : LabelSet ) {
117- this . getHandle ( labelSet ) . add ( value ) ;
117+ this . bind ( labelSet ) . add ( value ) ;
118118 }
119119}
120120
121- export class NoopGaugeMetric extends NoopMetric < GaugeHandle >
121+ export class NoopGaugeMetric extends NoopMetric < BoundGauge >
122122 implements Pick < MetricUtils , 'set' > {
123123 set ( value : number , labelSet : LabelSet ) {
124- this . getHandle ( labelSet ) . set ( value ) ;
124+ this . bind ( labelSet ) . set ( value ) ;
125125 }
126126}
127127
128- export class NoopMeasureMetric extends NoopMetric < MeasureHandle >
128+ export class NoopMeasureMetric extends NoopMetric < BoundMeasure >
129129 implements Pick < MetricUtils , 'record' > {
130130 record (
131131 value : number ,
@@ -134,28 +134,28 @@ export class NoopMeasureMetric extends NoopMetric<MeasureHandle>
134134 spanContext ?: SpanContext
135135 ) {
136136 if ( typeof distContext === 'undefined' ) {
137- this . getHandle ( labelSet ) . record ( value ) ;
137+ this . bind ( labelSet ) . record ( value ) ;
138138 } else if ( typeof spanContext === 'undefined' ) {
139- this . getHandle ( labelSet ) . record ( value , distContext ) ;
139+ this . bind ( labelSet ) . record ( value , distContext ) ;
140140 } else {
141- this . getHandle ( labelSet ) . record ( value , distContext , spanContext ) ;
141+ this . bind ( labelSet ) . record ( value , distContext , spanContext ) ;
142142 }
143143 }
144144}
145145
146- export class NoopCounterHandle implements CounterHandle {
146+ export class NoopBoundCounter implements BoundCounter {
147147 add ( value : number ) : void {
148148 return ;
149149 }
150150}
151151
152- export class NoopGaugeHandle implements GaugeHandle {
152+ export class NoopBoundGauge implements BoundGauge {
153153 set ( value : number ) : void {
154154 return ;
155155 }
156156}
157157
158- export class NoopMeasureHandle implements MeasureHandle {
158+ export class NoopBoundMeasure implements BoundMeasure {
159159 record (
160160 value : number ,
161161 distContext ?: DistributedContext ,
@@ -165,13 +165,13 @@ export class NoopMeasureHandle implements MeasureHandle {
165165 }
166166}
167167
168- export const NOOP_GAUGE_HANDLE = new NoopGaugeHandle ( ) ;
169- export const NOOP_GAUGE_METRIC = new NoopGaugeMetric ( NOOP_GAUGE_HANDLE ) ;
168+ export const NOOP_BOUND_GAUGE = new NoopBoundGauge ( ) ;
169+ export const NOOP_GAUGE_METRIC = new NoopGaugeMetric ( NOOP_BOUND_GAUGE ) ;
170170
171- export const NOOP_COUNTER_HANDLE = new NoopCounterHandle ( ) ;
172- export const NOOP_COUNTER_METRIC = new NoopCounterMetric ( NOOP_COUNTER_HANDLE ) ;
171+ export const NOOP_BOUND_COUNTER = new NoopBoundCounter ( ) ;
172+ export const NOOP_COUNTER_METRIC = new NoopCounterMetric ( NOOP_BOUND_COUNTER ) ;
173173
174- export const NOOP_MEASURE_HANDLE = new NoopMeasureHandle ( ) ;
175- export const NOOP_MEASURE_METRIC = new NoopMeasureMetric ( NOOP_MEASURE_HANDLE ) ;
174+ export const NOOP_BOUND_MEASURE = new NoopBoundMeasure ( ) ;
175+ export const NOOP_MEASURE_METRIC = new NoopMeasureMetric ( NOOP_BOUND_MEASURE ) ;
176176
177177export const NOOP_LABEL_SET = { } as LabelSet ;
0 commit comments