Skip to content

Commit 161af14

Browse files
committed
implement default behavior to avoid breaking change
1 parent d3f4d8c commit 161af14

File tree

19 files changed

+88
-134
lines changed

19 files changed

+88
-134
lines changed

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

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,6 @@ public void add(long value, Attributes attributes) {}
7676
@Override
7777
public void add(long value) {}
7878

79-
@Override
80-
public void remove(Attributes attributes) {}
81-
8279
@Override
8380
public void remove(Attributes attributes, Context context) {}
8481
}
@@ -93,9 +90,6 @@ public void add(double value, Attributes attributes) {}
9390
@Override
9491
public void add(double value) {}
9592

96-
@Override
97-
public void remove(Attributes attributes) {}
98-
9993
@Override
10094
public void remove(Attributes attributes, Context context) {}
10195
}
@@ -180,9 +174,6 @@ public void add(long value, Attributes attributes) {}
180174
@Override
181175
public void add(long value) {}
182176

183-
@Override
184-
public void remove(Attributes attributes) {}
185-
186177
@Override
187178
public void remove(Attributes attributes, Context context) {}
188179
}
@@ -197,9 +188,6 @@ public void add(double value, Attributes attributes) {}
197188
@Override
198189
public void add(double value) {}
199190

200-
@Override
201-
public void remove(Attributes attributes) {}
202-
203191
@Override
204192
public void remove(Attributes attributes, Context context) {}
205193
}
@@ -286,9 +274,6 @@ public void record(double value, Attributes attributes) {}
286274
@Override
287275
public void record(double value) {}
288276

289-
@Override
290-
public void remove(Attributes attributes) {}
291-
292277
@Override
293278
public void remove(Attributes attributes, Context context) {}
294279
}
@@ -303,9 +288,6 @@ public void record(long value, Attributes attributes) {}
303288
@Override
304289
public void record(long value) {}
305290

306-
@Override
307-
public void remove(Attributes attributes) {}
308-
309291
@Override
310292
public void remove(Attributes attributes, Context context) {}
311293
}
@@ -402,9 +384,6 @@ public void set(double value, Attributes attributes) {}
402384
@Override
403385
public void set(double value, Attributes attributes, Context context) {}
404386

405-
@Override
406-
public void remove(Attributes attributes) {}
407-
408387
@Override
409388
public void remove(Attributes attributes, Context context) {}
410389
}
@@ -449,9 +428,6 @@ public void set(long value, Attributes attributes) {}
449428
@Override
450429
public void set(long value, Attributes attributes, Context context) {}
451430

452-
@Override
453-
public void remove(Attributes attributes) {}
454-
455431
@Override
456432
public void remove(Attributes attributes, Context context) {}
457433
}

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,19 @@ public interface DoubleCounter {
5050
* Remove the instrument.
5151
*
5252
* @param attributes A set of attributes to identify the instrument.
53+
*
54+
* @since 1.56.0
5355
*/
54-
void remove(Attributes attributes);
55-
56+
default void remove(Attributes attributes) {
57+
remove(attributes, Context.current());
58+
}
5659
/**
5760
* Remove the instrument.
5861
*
5962
* @param attributes A set of attributes to identify the instrument.
6063
* @param context The explicit context to associate with this measurement.
64+
*
65+
* @since 1.56.0
6166
*/
62-
void remove(Attributes attributes, Context context);
67+
default void remove(Attributes attributes, Context context) {}
6368
}

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,20 @@ public interface DoubleGauge {
4444
* Remove the instrument.
4545
*
4646
* @param attributes A set of attributes to identify the instrument.
47+
*
48+
* @since 1.56.0
4749
*/
48-
void remove(Attributes attributes);
50+
default void remove(Attributes attributes) {
51+
remove(attributes, Context.current());
52+
}
4953

5054
/**
5155
* Remove the instrument.
5256
*
5357
* @param attributes A set of attributes to identify the instrument.
5458
* @param context The explicit context to associate with this measurement.
59+
*
60+
* @since 1.56.0
5561
*/
56-
void remove(Attributes attributes, Context context);
62+
default void remove(Attributes attributes, Context context) {}
5763
}

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,19 @@ public interface DoubleHistogram {
5151
* Remove the instrument.
5252
*
5353
* @param attributes A set of attributes to identify the instrument.
54+
*
55+
* @since 1.56.0
5456
*/
55-
void remove(Attributes attributes);
56-
57+
default void remove(Attributes attributes) {
58+
remove(attributes, Context.current());
59+
}
5760
/**
5861
* Remove the instrument.
5962
*
6063
* @param attributes A set of attributes to identify the instrument.
6164
* @param context The explicit context to associate with this measurement.
65+
*
66+
* @since 1.56.0
6267
*/
63-
void remove(Attributes attributes, Context context);
68+
default void remove(Attributes attributes, Context context) {}
6469
}

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,19 @@ public interface DoubleUpDownCounter {
5050
* Remove the instrument.
5151
*
5252
* @param attributes A set of attributes to identify the instrument.
53+
*
54+
* @since 1.56.0
5355
*/
54-
void remove(Attributes attributes);
55-
56+
default void remove(Attributes attributes) {
57+
remove(attributes, Context.current());
58+
}
5659
/**
5760
* Remove the instrument.
5861
*
5962
* @param attributes A set of attributes to identify the instrument.
6063
* @param context The explicit context to associate with this measurement.
64+
*
65+
* @since 1.56.0
6166
*/
62-
void remove(Attributes attributes, Context context);
67+
default void remove(Attributes attributes, Context context) {}
6368
}

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,19 @@ public interface LongCounter {
5151
* Remove the instrument.
5252
*
5353
* @param attributes A set of attributes to identify the instrument.
54+
*
55+
* @since 1.56.0
5456
*/
55-
void remove(Attributes attributes);
56-
57+
default void remove(Attributes attributes) {
58+
remove(attributes, Context.current());
59+
}
5760
/**
5861
* Remove the instrument.
5962
*
6063
* @param attributes A set of attributes to identify the instrument.
6164
* @param context The explicit context to associate with this measurement.
65+
*
66+
* @since 1.56.0
6267
*/
63-
void remove(Attributes attributes, Context context);
68+
default void remove(Attributes attributes, Context context) {}
6469
}

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,19 @@ public interface LongGauge {
4444
* Remove the instrument.
4545
*
4646
* @param attributes A set of attributes to identify the instrument.
47+
*
48+
* @since 1.56.0
4749
*/
48-
void remove(Attributes attributes);
49-
50+
default void remove(Attributes attributes) {
51+
remove(attributes, Context.current());
52+
}
5053
/**
5154
* Remove the instrument.
5255
*
5356
* @param attributes A set of attributes to identify the instrument.
5457
* @param context The explicit context to associate with this measurement.
58+
*
59+
* @since 1.56.0
5560
*/
56-
void remove(Attributes attributes, Context context);
61+
default void remove(Attributes attributes, Context context) {}
5762
}

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,19 @@ public interface LongHistogram {
5151
* Remove the instrument.
5252
*
5353
* @param attributes A set of attributes to identify the instrument.
54+
*
55+
* @since 1.56.0
5456
*/
55-
void remove(Attributes attributes);
56-
57+
default void remove(Attributes attributes) {
58+
remove(attributes, Context.current());
59+
}
5760
/**
5861
* Remove the instrument.
5962
*
6063
* @param attributes A set of attributes to identify the instrument.
6164
* @param context The explicit context to associate with this measurement.
65+
*
66+
* @since 1.56.0
6267
*/
63-
void remove(Attributes attributes, Context context);
68+
default void remove(Attributes attributes, Context context) {}
6469
}

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,20 @@ public interface LongUpDownCounter {
5050
* Remove the instrument.
5151
*
5252
* @param attributes A set of attributes to identify the instrument.
53+
*
54+
* @since 1.56.0
5355
*/
54-
void remove(Attributes attributes);
56+
default void remove(Attributes attributes) {
57+
remove(attributes, Context.current());
58+
}
5559

5660
/**
5761
* Remove the instrument.
5862
*
5963
* @param attributes A set of attributes to identify the instrument.
6064
* @param context The explicit context to associate with this measurement.
65+
*
66+
* @since 1.56.0
6167
*/
62-
void remove(Attributes attributes, Context context);
68+
default void remove(Attributes attributes, Context context) {}
6369
}

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

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,6 @@ public void add(long value, Attributes attributes) {}
108108
@Override
109109
public void add(long value) {}
110110

111-
@Override
112-
public void remove(Attributes attributes) {}
113-
114111
@Override
115112
public void remove(Attributes attributes, Context context) {}
116113
}
@@ -130,9 +127,6 @@ public void add(double value, Attributes attributes) {}
130127
@Override
131128
public void add(double value) {}
132129

133-
@Override
134-
public void remove(Attributes attributes) {}
135-
136130
@Override
137131
public void remove(Attributes attributes, Context context) {}
138132
}
@@ -222,9 +216,6 @@ public void add(long value, Attributes attributes) {}
222216
@Override
223217
public void add(long value) {}
224218

225-
@Override
226-
public void remove(Attributes attributes) {}
227-
228219
@Override
229220
public void remove(Attributes attributes, Context context) {}
230221
}
@@ -244,9 +235,6 @@ public void add(double value, Attributes attributes) {}
244235
@Override
245236
public void add(double value) {}
246237

247-
@Override
248-
public void remove(Attributes attributes) {}
249-
250238
@Override
251239
public void remove(Attributes attributes, Context context) {}
252240
}
@@ -339,9 +327,6 @@ public void record(double value, Attributes attributes) {}
339327
@Override
340328
public void record(double value) {}
341329

342-
@Override
343-
public void remove(Attributes attributes) {}
344-
345330
@Override
346331
public void remove(Attributes attributes, Context context) {}
347332
}
@@ -361,9 +346,6 @@ public void record(long value, Attributes attributes) {}
361346
@Override
362347
public void record(long value) {}
363348

364-
@Override
365-
public void remove(Attributes attributes) {}
366-
367349
@Override
368350
public void remove(Attributes attributes, Context context) {}
369351
}
@@ -465,9 +447,6 @@ public void set(double value, Attributes attributes) {}
465447
@Override
466448
public void set(double value, Attributes attributes, Context context) {}
467449

468-
@Override
469-
public void remove(Attributes attributes) {}
470-
471450
@Override
472451
public void remove(Attributes attributes, Context context) {}
473452
}
@@ -517,9 +496,6 @@ public void set(long value, Attributes attributes) {}
517496
@Override
518497
public void set(long value, Attributes attributes, Context context) {}
519498

520-
@Override
521-
public void remove(Attributes attributes) {}
522-
523499
@Override
524500
public void remove(Attributes attributes, Context context) {}
525501
}

0 commit comments

Comments
 (0)