Skip to content

Commit 02fedd7

Browse files
committed
Add support to remove instruments
1 parent 9fe48c9 commit 02fedd7

31 files changed

+405
-0
lines changed

api/all/src/main/java/io/opentelemetry/api/metrics/DefaultMeter.java

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ public void add(long value, Attributes attributes) {}
7575

7676
@Override
7777
public void add(long value) {}
78+
79+
@Override
80+
public void remove(Attributes attributes) {}
81+
82+
@Override
83+
public void remove(Attributes attributes, Context context) {}
7884
}
7985

8086
private static class NoopDoubleCounter implements DoubleCounter {
@@ -86,6 +92,12 @@ public void add(double value, Attributes attributes) {}
8692

8793
@Override
8894
public void add(double value) {}
95+
96+
@Override
97+
public void remove(Attributes attributes) {}
98+
99+
@Override
100+
public void remove(Attributes attributes, Context context) {}
89101
}
90102

91103
private static class NoopLongCounterBuilder implements LongCounterBuilder {
@@ -167,6 +179,12 @@ public void add(long value, Attributes attributes) {}
167179

168180
@Override
169181
public void add(long value) {}
182+
183+
@Override
184+
public void remove(Attributes attributes) {}
185+
186+
@Override
187+
public void remove(Attributes attributes, Context context) {}
170188
}
171189

172190
private static class NoopDoubleUpDownCounter implements DoubleUpDownCounter {
@@ -178,6 +196,12 @@ public void add(double value, Attributes attributes) {}
178196

179197
@Override
180198
public void add(double value) {}
199+
200+
@Override
201+
public void remove(Attributes attributes) {}
202+
203+
@Override
204+
public void remove(Attributes attributes, Context context) {}
181205
}
182206

183207
private static class NoopLongUpDownCounterBuilder implements LongUpDownCounterBuilder {
@@ -261,6 +285,12 @@ public void record(double value, Attributes attributes) {}
261285

262286
@Override
263287
public void record(double value) {}
288+
289+
@Override
290+
public void remove(Attributes attributes) {}
291+
292+
@Override
293+
public void remove(Attributes attributes, Context context) {}
264294
}
265295

266296
private static class NoopLongHistogram implements LongHistogram {
@@ -272,6 +302,12 @@ public void record(long value, Attributes attributes) {}
272302

273303
@Override
274304
public void record(long value) {}
305+
306+
@Override
307+
public void remove(Attributes attributes) {}
308+
309+
@Override
310+
public void remove(Attributes attributes, Context context) {}
275311
}
276312

277313
private static class NoopDoubleHistogramBuilder implements DoubleHistogramBuilder {
@@ -365,6 +401,12 @@ public void set(double value, Attributes attributes) {}
365401

366402
@Override
367403
public void set(double value, Attributes attributes, Context context) {}
404+
405+
@Override
406+
public void remove(Attributes attributes) {}
407+
408+
@Override
409+
public void remove(Attributes attributes, Context context) {}
368410
}
369411

370412
private static class NoopLongGaugeBuilder implements LongGaugeBuilder {
@@ -406,6 +448,12 @@ public void set(long value, Attributes attributes) {}
406448

407449
@Override
408450
public void set(long value, Attributes attributes, Context context) {}
451+
452+
@Override
453+
public void remove(Attributes attributes) {}
454+
455+
@Override
456+
public void remove(Attributes attributes, Context context) {}
409457
}
410458

411459
private static class NoopObservableDoubleMeasurement implements ObservableDoubleMeasurement {

api/all/src/main/java/io/opentelemetry/api/metrics/DoubleCounter.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,19 @@ public interface DoubleCounter {
4545
* @param context The explicit context to associate with this measurement.
4646
*/
4747
void add(double value, Attributes attributes, Context context);
48+
49+
/**
50+
* Remove the instrument.
51+
*
52+
* @param attributes A set of attributes to identify the instrument.
53+
*/
54+
void remove(Attributes attributes);
55+
56+
/**
57+
* Remove the instrument.
58+
*
59+
* @param attributes A set of attributes to identify the instrument.
60+
* @param context The explicit context to associate with this measurement.
61+
*/
62+
void remove(Attributes attributes, Context context);
4863
}

api/all/src/main/java/io/opentelemetry/api/metrics/DoubleGauge.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,19 @@ public interface DoubleGauge {
3939
* @param context The explicit context to associate with this measurement.
4040
*/
4141
void set(double value, Attributes attributes, Context context);
42+
43+
/**
44+
* Remove the instrument.
45+
*
46+
* @param attributes A set of attributes to identify the instrument.
47+
*/
48+
void remove(Attributes attributes);
49+
50+
/**
51+
* Remove the instrument.
52+
*
53+
* @param attributes A set of attributes to identify the instrument.
54+
* @param context The explicit context to associate with this measurement.
55+
*/
56+
void remove(Attributes attributes, Context context);
4257
}

api/all/src/main/java/io/opentelemetry/api/metrics/DoubleHistogram.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,19 @@ public interface DoubleHistogram {
4646
* @param context The explicit context to associate with this measurement.
4747
*/
4848
void record(double value, Attributes attributes, Context context);
49+
50+
/**
51+
* Remove the instrument.
52+
*
53+
* @param attributes A set of attributes to identify the instrument.
54+
*/
55+
void remove(Attributes attributes);
56+
57+
/**
58+
* Remove the instrument.
59+
*
60+
* @param attributes A set of attributes to identify the instrument.
61+
* @param context The explicit context to associate with this measurement.
62+
*/
63+
void remove(Attributes attributes, Context context);
4964
}

api/all/src/main/java/io/opentelemetry/api/metrics/DoubleUpDownCounter.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,19 @@ public interface DoubleUpDownCounter {
4545
* @param context The explicit context to associate with this measurement.
4646
*/
4747
void add(double value, Attributes attributes, Context context);
48+
49+
/**
50+
* Remove the instrument.
51+
*
52+
* @param attributes A set of attributes to identify the instrument.
53+
*/
54+
void remove(Attributes attributes);
55+
56+
/**
57+
* Remove the instrument.
58+
*
59+
* @param attributes A set of attributes to identify the instrument.
60+
* @param context The explicit context to associate with this measurement.
61+
*/
62+
void remove(Attributes attributes, Context context);
4863
}

api/all/src/main/java/io/opentelemetry/api/metrics/LongCounter.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,19 @@ public interface LongCounter {
4646
* @param context The explicit context to associate with this measurement.
4747
*/
4848
void add(long value, Attributes attributes, Context context);
49+
50+
/**
51+
* Remove the instrument.
52+
*
53+
* @param attributes A set of attributes to identify the instrument.
54+
*/
55+
void remove(Attributes attributes);
56+
57+
/**
58+
* Remove the instrument.
59+
*
60+
* @param attributes A set of attributes to identify the instrument.
61+
* @param context The explicit context to associate with this measurement.
62+
*/
63+
void remove(Attributes attributes, Context context);
4964
}

api/all/src/main/java/io/opentelemetry/api/metrics/LongGauge.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,19 @@ public interface LongGauge {
3939
* @param context The explicit context to associate with this measurement.
4040
*/
4141
void set(long value, Attributes attributes, Context context);
42+
43+
/**
44+
* Remove the instrument.
45+
*
46+
* @param attributes A set of attributes to identify the instrument.
47+
*/
48+
void remove(Attributes attributes);
49+
50+
/**
51+
* Remove the instrument.
52+
*
53+
* @param attributes A set of attributes to identify the instrument.
54+
* @param context The explicit context to associate with this measurement.
55+
*/
56+
void remove(Attributes attributes, Context context);
4257
}

api/all/src/main/java/io/opentelemetry/api/metrics/LongHistogram.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,19 @@ public interface LongHistogram {
4646
* @param context The explicit context to associate with this measurement.
4747
*/
4848
void record(long value, Attributes attributes, Context context);
49+
50+
/**
51+
* Remove the instrument.
52+
*
53+
* @param attributes A set of attributes to identify the instrument.
54+
*/
55+
void remove(Attributes attributes);
56+
57+
/**
58+
* Remove the instrument.
59+
*
60+
* @param attributes A set of attributes to identify the instrument.
61+
* @param context The explicit context to associate with this measurement.
62+
*/
63+
void remove(Attributes attributes, Context context);
4964
}

api/all/src/main/java/io/opentelemetry/api/metrics/LongUpDownCounter.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,19 @@ public interface LongUpDownCounter {
4545
* @param context The explicit context to associate with this measurement.
4646
*/
4747
void add(long value, Attributes attributes, Context context);
48+
49+
/**
50+
* Remove the instrument.
51+
*
52+
* @param attributes A set of attributes to identify the instrument.
53+
*/
54+
void remove(Attributes attributes);
55+
56+
/**
57+
* Remove the instrument.
58+
*
59+
* @param attributes A set of attributes to identify the instrument.
60+
* @param context The explicit context to associate with this measurement.
61+
*/
62+
void remove(Attributes attributes, Context context);
4863
}

api/incubator/src/main/java/io/opentelemetry/api/incubator/metrics/ExtendedDefaultMeter.java

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,12 @@ public void add(long value, Attributes attributes) {}
107107

108108
@Override
109109
public void add(long value) {}
110+
111+
@Override
112+
public void remove(Attributes attributes) {}
113+
114+
@Override
115+
public void remove(Attributes attributes, Context context) {}
110116
}
111117

112118
private static class NoopDoubleCounter implements ExtendedDoubleCounter {
@@ -123,6 +129,12 @@ public void add(double value, Attributes attributes) {}
123129

124130
@Override
125131
public void add(double value) {}
132+
133+
@Override
134+
public void remove(Attributes attributes) {}
135+
136+
@Override
137+
public void remove(Attributes attributes, Context context) {}
126138
}
127139

128140
private static class NoopLongCounterBuilder implements ExtendedLongCounterBuilder {
@@ -209,6 +221,12 @@ public void add(long value, Attributes attributes) {}
209221

210222
@Override
211223
public void add(long value) {}
224+
225+
@Override
226+
public void remove(Attributes attributes) {}
227+
228+
@Override
229+
public void remove(Attributes attributes, Context context) {}
212230
}
213231

214232
private static class NoopDoubleUpDownCounter implements ExtendedDoubleUpDownCounter {
@@ -225,6 +243,12 @@ public void add(double value, Attributes attributes) {}
225243

226244
@Override
227245
public void add(double value) {}
246+
247+
@Override
248+
public void remove(Attributes attributes) {}
249+
250+
@Override
251+
public void remove(Attributes attributes, Context context) {}
228252
}
229253

230254
private static class NoopLongUpDownCounterBuilder implements ExtendedLongUpDownCounterBuilder {
@@ -314,6 +338,12 @@ public void record(double value, Attributes attributes) {}
314338

315339
@Override
316340
public void record(double value) {}
341+
342+
@Override
343+
public void remove(Attributes attributes) {}
344+
345+
@Override
346+
public void remove(Attributes attributes, Context context) {}
317347
}
318348

319349
private static class NoopLongHistogram implements ExtendedLongHistogram {
@@ -330,6 +360,12 @@ public void record(long value, Attributes attributes) {}
330360

331361
@Override
332362
public void record(long value) {}
363+
364+
@Override
365+
public void remove(Attributes attributes) {}
366+
367+
@Override
368+
public void remove(Attributes attributes, Context context) {}
333369
}
334370

335371
private static class NoopDoubleHistogramBuilder implements ExtendedDoubleHistogramBuilder {
@@ -428,6 +464,12 @@ public void set(double value, Attributes attributes) {}
428464

429465
@Override
430466
public void set(double value, Attributes attributes, Context context) {}
467+
468+
@Override
469+
public void remove(Attributes attributes) {}
470+
471+
@Override
472+
public void remove(Attributes attributes, Context context) {}
431473
}
432474

433475
private static class NoopLongGaugeBuilder implements ExtendedLongGaugeBuilder {
@@ -474,6 +516,12 @@ public void set(long value, Attributes attributes) {}
474516

475517
@Override
476518
public void set(long value, Attributes attributes, Context context) {}
519+
520+
@Override
521+
public void remove(Attributes attributes) {}
522+
523+
@Override
524+
public void remove(Attributes attributes, Context context) {}
477525
}
478526

479527
private static class NoopObservableDoubleMeasurement implements ObservableDoubleMeasurement {

0 commit comments

Comments
 (0)