Skip to content

Commit 25fc0d6

Browse files
Deprecate methods to complete spans with metadata (#347)
* Deprecate methods to complete spans with metadata * Add generated changelog entries * Comments Co-authored-by: Carter Kozak <[email protected]> Co-authored-by: Carter Kozak <[email protected]>
1 parent 964c71c commit 25fc0d6

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
type: improvement
2+
improvement:
3+
description: Methods to complete spans with metadata are now deprecated.
4+
links:
5+
- https://github.com/palantir/tracing-java/pull/347

tracing/src/main/java/com/palantir/tracing/Tracer.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,12 @@ public static void fastCompleteSpan() {
455455
fastCompleteSpan(Collections.emptyMap());
456456
}
457457

458-
/** Like {@link #fastCompleteSpan()}, but adds {@code metadata} to the current span being completed. */
458+
/**
459+
* Like {@link #fastCompleteSpan()}, but adds {@code metadata} to the current span being completed.
460+
*
461+
* @deprecated Use {@link #fastCompleteSpan()}
462+
*/
463+
@Deprecated
459464
public static void fastCompleteSpan(Map<String, String> metadata) {
460465
Trace trace = currentTrace.get();
461466
if (trace != null) {
@@ -483,10 +488,13 @@ public static Optional<Span> completeSpan() {
483488
}
484489

485490
/**
486-
* Like {@link #completeSpan()}, but adds {@code metadata} to the current span being completed. If the return value
487-
* is not used, prefer {@link Tracer#fastCompleteSpan(Map)}.
491+
* Like {@link #completeSpan()}, but adds {@code metadata} to the current span being completed.
492+
* If the return value is not used, prefer {@link Tracer#fastCompleteSpan(Map)}.
493+
*
494+
* @deprecated Use {@link #fastCompleteSpan()}
488495
*/
489496
@CheckReturnValue
497+
@Deprecated
490498
public static Optional<Span> completeSpan(Map<String, String> metadata) {
491499
Trace trace = currentTrace.get();
492500
if (trace == null) {

tracing/src/test/java/com/palantir/tracing/TracerTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ public void testCompletedSpanHasCorrectSpanType() throws Exception {
249249
}
250250

251251
@Test
252+
@SuppressWarnings("deprecation")
252253
public void testCompleteSpanWithMetadataIncludesMetadata() {
253254
Map<String, String> metadata = ImmutableMap.of(
254255
"key1", "value1",
@@ -275,6 +276,7 @@ public void testFastCompleteSpan() {
275276
}
276277

277278
@Test
279+
@SuppressWarnings("deprecation")
278280
public void testFastCompleteSpanWithMetadata() {
279281
Tracer.subscribe("1", observer1);
280282
Map<String, String> metadata = ImmutableMap.of("key", "value");

0 commit comments

Comments
 (0)