-
Notifications
You must be signed in to change notification settings - Fork 309
Incorporating TagMap into the tracer #8589
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,7 +46,6 @@ | |
import datadog.trace.civisibility.test.ExecutionResults; | ||
import java.lang.reflect.Method; | ||
import java.util.Collection; | ||
import java.util.Collections; | ||
import java.util.concurrent.TimeUnit; | ||
import java.util.function.Consumer; | ||
import javax.annotation.Nonnull; | ||
|
@@ -105,8 +104,7 @@ public TestImpl( | |
|
||
this.context = new TestContextImpl(coverageStore); | ||
|
||
AgentSpanContext traceContext = | ||
new TagContext(CIConstants.CIAPP_TEST_ORIGIN, Collections.emptyMap()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same mutable empty Map issue |
||
AgentSpanContext traceContext = new TagContext(CIConstants.CIAPP_TEST_ORIGIN, null); | ||
AgentTracer.SpanBuilder spanBuilder = | ||
AgentTracer.get() | ||
.buildSpan(CI_VISIBILITY_INSTRUMENTATION_NAME, testDecorator.component() + ".test") | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ | |
import com.datadog.debugger.util.ExceptionHelper; | ||
import com.datadog.debugger.util.TestSnapshotListener; | ||
import datadog.trace.api.Config; | ||
import datadog.trace.api.TagMap; | ||
import datadog.trace.bootstrap.debugger.CapturedContext; | ||
import datadog.trace.bootstrap.debugger.CapturedStackFrame; | ||
import datadog.trace.bootstrap.debugger.MethodLocation; | ||
|
@@ -41,7 +42,6 @@ | |
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.Deque; | ||
import java.util.HashMap; | ||
import java.util.HashSet; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
@@ -57,7 +57,7 @@ public class DefaultExceptionDebuggerTest { | |
private ConfigurationUpdater configurationUpdater; | ||
private DefaultExceptionDebugger exceptionDebugger; | ||
private TestSnapshotListener listener; | ||
private Map<String, Object> spanTags = new HashMap<>(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the primary type of change that I've made throughout -- replacing HashMaps with TagMap-s. |
||
private TagMap spanTags = TagMap.create(); | ||
|
||
@BeforeEach | ||
public void setUp() { | ||
|
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have mixed feelings about this particular change. In effect, the constructor previously required the user to pass a mutable map. However if the provided Map was empty, the class would lazily construction a mutable Map to take place of the empty Map.
Because TagMap does not have an O(1) isEmpty, I didn't want to stick with this pattern.
What could be done instead is to pass TagMap.EMPTY and then check via a reference equality check. If others prefer that, I can adjust accordingly.