Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -473,10 +473,8 @@ public Iterator<Entry<K, V>> iterator() {

private @Nullable ISpan startSpanForKeys(
final @NotNull Set<?> keys, final @NotNull String operationName) {
return startSpan(
operationName,
delegate.getName(),
keys.stream().map(String::valueOf).collect(Collectors.toList()));
final List<String> keyStrings = keys.stream().map(String::valueOf).collect(Collectors.toList());
return startSpan(operationName, String.join(", ", keyStrings), keyStrings);
}

private @Nullable ISpan startSpan(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ class SentryJCacheWrapperTest {
assertEquals(1, tx.spans.size)
val span = tx.spans.first()
assertEquals("cache.getAll", span.operation)
assertEquals("testCache", span.description)
assertTrue(span.description!!.contains("k1"))
assertTrue(span.description!!.contains("k2"))
Comment on lines +99 to +100
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be replaced with assertEquals("k1, k2", span.description) if we also want to test the delimiting

assertEquals(true, span.getData(SpanDataConvention.CACHE_HIT_KEY))
val cacheKeys = span.getData(SpanDataConvention.CACHE_KEY_KEY) as List<*>
assertTrue(cacheKeys.containsAll(listOf("k1", "k2")))
Expand Down Expand Up @@ -165,7 +166,8 @@ class SentryJCacheWrapperTest {
assertEquals(1, tx.spans.size)
val span = tx.spans.first()
assertEquals("cache.putAll", span.operation)
assertEquals("testCache", span.description)
assertTrue(span.description!!.contains("k1"))
assertTrue(span.description!!.contains("k2"))
assertEquals(true, span.getData(SpanDataConvention.CACHE_WRITE))
val cacheKeys = span.getData(SpanDataConvention.CACHE_KEY_KEY) as List<*>
assertTrue(cacheKeys.containsAll(listOf("k1", "k2")))
Expand Down Expand Up @@ -318,7 +320,8 @@ class SentryJCacheWrapperTest {
assertEquals(1, tx.spans.size)
val span = tx.spans.first()
assertEquals("cache.removeAll", span.operation)
assertEquals("testCache", span.description)
assertTrue(span.description!!.contains("k1"))
assertTrue(span.description!!.contains("k2"))
assertEquals(true, span.getData(SpanDataConvention.CACHE_WRITE))
assertEquals("removeAll", span.getData(SpanDataConvention.CACHE_OPERATION_KEY))
}
Expand Down
Loading