-
Notifications
You must be signed in to change notification settings - Fork 83
RUM-3294 Add the Core Tracer tests #1924
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 |
|---|---|---|
|
|
@@ -3848,6 +3848,10 @@ public class com/datadog/trace/api/naming/SpanNaming { | |
| public fun version ()I | ||
| } | ||
|
|
||
| public class com/datadog/trace/api/naming/SpanNaming$Singleton { | ||
| public fun <init> ()V | ||
| } | ||
|
|
||
| public class com/datadog/trace/api/naming/v0/CacheNamingV0 : com/datadog/trace/api/naming/NamingSchema$ForCache { | ||
| public fun <init> (Z)V | ||
| public fun operation (Ljava/lang/String;)Ljava/lang/String; | ||
|
|
@@ -5659,7 +5663,9 @@ public class com/datadog/trace/common/writer/ListWriter : java/util/concurrent/C | |
| public fun close ()V | ||
| public fun firstTrace ()Ljava/util/List; | ||
| public fun flush ()Z | ||
| public fun getTraceCount ()Ljava/util/concurrent/atomic/AtomicInteger; | ||
| public fun incrementDropCounts (I)V | ||
| public fun secondTrace ()Ljava/util/List; | ||
| public fun setFilter (Lcom/datadog/trace/common/writer/ListWriter$Filter;)V | ||
| public fun start ()V | ||
| public fun toString ()Ljava/lang/String; | ||
|
|
@@ -5684,6 +5690,15 @@ public class com/datadog/trace/common/writer/LoggingWriter : com/datadog/trace/c | |
| public fun write (Ljava/util/List;)V | ||
| } | ||
|
|
||
| public class com/datadog/trace/common/writer/NoOpWriter : com/datadog/trace/common/writer/Writer { | ||
| public fun <init> ()V | ||
| public fun close ()V | ||
| public fun flush ()Z | ||
| public fun incrementDropCounts (I)V | ||
| public fun start ()V | ||
| public fun write (Ljava/util/List;)V | ||
| } | ||
|
|
||
| public abstract class com/datadog/trace/common/writer/Payload { | ||
| protected field body Ljava/nio/ByteBuffer; | ||
| public fun <init> ()V | ||
|
|
@@ -5921,6 +5936,11 @@ public abstract interface class com/datadog/trace/core/CoreSpan { | |
| } | ||
|
|
||
| public class com/datadog/trace/core/CoreTracer : com/datadog/trace/bootstrap/instrumentation/api/AgentTracer$TracerAPI { | ||
| public static final field LANG_INTERPRETER_STATSD_TAG Ljava/lang/String; | ||
| public static final field LANG_INTERPRETER_VENDOR_STATSD_TAG Ljava/lang/String; | ||
| public static final field LANG_STATSD_TAG Ljava/lang/String; | ||
| public static final field LANG_VERSION_STATSD_TAG Ljava/lang/String; | ||
| public static final field TRACER_VERSION_STATSD_TAG Ljava/lang/String; | ||
| public static final field TRACE_ID_MAX Ljava/math/BigInteger; | ||
| public fun activateNext (Lcom/datadog/trace/bootstrap/instrumentation/api/AgentSpan;)Lcom/datadog/trace/bootstrap/instrumentation/api/AgentScope; | ||
| public fun activateSpan (Lcom/datadog/trace/bootstrap/instrumentation/api/AgentSpan;)Lcom/datadog/trace/bootstrap/instrumentation/api/AgentScope; | ||
|
|
@@ -6023,7 +6043,6 @@ public class com/datadog/trace/core/CoreTracer$CoreTracerBuilder { | |
| public fun scopeManager (Lcom/datadog/trace/bootstrap/instrumentation/api/AgentScopeManager;)Lcom/datadog/trace/core/CoreTracer$CoreTracerBuilder; | ||
| public fun serviceName (Ljava/lang/String;)Lcom/datadog/trace/core/CoreTracer$CoreTracerBuilder; | ||
| public fun serviceNameMappings (Ljava/util/Map;)Lcom/datadog/trace/core/CoreTracer$CoreTracerBuilder; | ||
| public fun statsDClient (Lcom/datadog/trace/core/taginterceptor/TagInterceptor;)Lcom/datadog/trace/core/CoreTracer$CoreTracerBuilder; | ||
| public fun strictTraceWrites (Z)Lcom/datadog/trace/core/CoreTracer$CoreTracerBuilder; | ||
| public fun tagInterceptor (Lcom/datadog/trace/core/taginterceptor/TagInterceptor;)Lcom/datadog/trace/core/CoreTracer$CoreTracerBuilder; | ||
| public fun taggedHeaders (Ljava/util/Map;)Lcom/datadog/trace/core/CoreTracer$CoreTracerBuilder; | ||
|
|
@@ -6034,6 +6053,7 @@ public class com/datadog/trace/core/CoreTracer$CoreTracerBuilder { | |
|
|
||
| public class com/datadog/trace/core/DDSpan : com/datadog/trace/api/profiling/TransientProfilingContextHolder, com/datadog/trace/bootstrap/instrumentation/api/AgentSpan, com/datadog/trace/bootstrap/instrumentation/api/AttachableWrapper, com/datadog/trace/core/CoreSpan { | ||
| public static final field CHECKPOINTED_TAG Ljava/lang/String; | ||
| public fun <init> (Ljava/lang/String;JLcom/datadog/trace/core/DDSpanContext;Ljava/util/List;)V | ||
|
Member
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. minor: given that we have a method to call private constructor now, should we make this constructor public?
Member
Author
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. actually not...
Member
Author
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. I am not really sure where this is coming from as I am just exposing the class not the constructors so I will leave it as is. I need the class exposed to cast to
Member
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. It is from this change https://github.com/DataDog/dd-sdk-android/pull/1924/files#diff-1c12b21f74915bf39d879d5d17374ad221d56bb67bed99743adc8a86dfbf944cR127 where private constructor was made public. But that is ok I believe, just was wondering about the consistency in the approach (since for |
||
| public fun addLink (Lcom/datadog/trace/bootstrap/instrumentation/api/AgentSpanLink;)V | ||
| public synthetic fun addThrowable (Ljava/lang/Throwable;)Lcom/datadog/trace/bootstrap/instrumentation/api/AgentSpan; | ||
| public synthetic fun addThrowable (Ljava/lang/Throwable;)Lcom/datadog/trace/core/CoreSpan; | ||
|
|
@@ -6316,9 +6336,12 @@ public class com/datadog/trace/core/PendingTrace : com/datadog/trace/bootstrap/i | |
| public static fun getDurationNano (Lcom/datadog/trace/core/CoreSpan;)J | ||
| public fun getEndToEndStartTime ()J | ||
| public fun getLastWriteTime ()J | ||
| public fun getPendingReferenceCount ()I | ||
| public fun getRootSpan ()Lcom/datadog/trace/core/DDSpan; | ||
| public fun getRunningTraceStartTime ()J | ||
| public fun getSpans ()Ljava/util/List; | ||
| public fun getTimeSource ()Lcom/datadog/trace/api/time/TimeSource; | ||
| public fun isRootSpanWritten ()Z | ||
| public fun lastReferencedNanosAgo (J)Z | ||
| public fun oldestFinishedTime ()J | ||
| public fun registerContinuation (Lcom/datadog/trace/bootstrap/instrumentation/api/AgentScope$Continuation;)V | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,6 +37,9 @@ public boolean accept(List<DDSpan> trace) { | |
| public List<DDSpan> firstTrace() { | ||
| return get(0); | ||
| } | ||
| public List<DDSpan> secondTrace() { | ||
|
Member
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. is adding this needed for the tests?
Member
Author
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. yup, they are using groovy in their tests and they are able to access these private properties directly.
Member
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. let's maybe do the same? write reflection wrappers to access all this. Because otherwise we make quite a lot of internal things public just for the tests, not sure if it opens the door for the misuse on the client side.
Member
Author
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. it shouldn't honestly, there are plenty of places like these in their api's.
Member
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. I think it makes sense if you think about this code as an agent - it is attached to the process and is not supposed to be used as a SDK. But in our case it becomes a SDK, and we should care much more about things which should be open vs closed.
Member
Author
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. actually this class is only used for testing purposes on their end, it blocks the thread so to make sure the traces are consumed. I think this one is safe. |
||
| return get(1); | ||
| } | ||
|
|
||
| @Override | ||
| public void write(List<DDSpan> trace) { | ||
|
|
@@ -143,6 +146,10 @@ public boolean flush() { | |
| return true; | ||
| } | ||
|
|
||
| public AtomicInteger getTraceCount() { | ||
| return traceCount; | ||
| } | ||
|
|
||
| @Override | ||
| public void close() { | ||
| clear(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| /* | ||
| * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0. | ||
| * This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
| * Copyright 2016-Present Datadog, Inc. | ||
| */ | ||
|
|
||
| package com.datadog.trace.common.writer; | ||
|
|
||
| import com.datadog.trace.core.DDSpan; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public class NoOpWriter implements Writer{ | ||
|
|
||
| @Override | ||
| public void write(List<DDSpan> trace) { | ||
|
|
||
| } | ||
|
|
||
| @Override | ||
| public void start() { | ||
|
|
||
| } | ||
|
|
||
| @Override | ||
| public boolean flush() { | ||
| return true; | ||
| } | ||
|
|
||
| @Override | ||
| public void close() { | ||
|
|
||
| } | ||
|
|
||
| @Override | ||
| public void incrementDropCounts(int spanCount) { | ||
|
|
||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ | |
|
|
||
| import androidx.annotation.NonNull; | ||
| import androidx.annotation.Nullable; | ||
| import androidx.annotation.VisibleForTesting; | ||
|
|
||
| import com.datadog.trace.api.Config; | ||
| import com.datadog.trace.api.DDSpanId; | ||
|
|
@@ -122,7 +123,8 @@ static DDSpan create( | |
| * @param timestampMicro if greater than zero, use this time instead of the current time | ||
| * @param context the context used for the span | ||
| */ | ||
| private DDSpan( | ||
| @VisibleForTesting | ||
| public DDSpan( | ||
|
Member
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. is it possible to put |
||
| @NonNull String instrumentationName, | ||
| final long timestampMicro, | ||
| @NonNull DDSpanContext context, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.