Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
This commit is contained in:
		
							parent
							
								
									d34b66b5cb
								
							
						
					
					
						commit
						ff5529a422
					
				|  | @ -8,10 +8,8 @@ package io.opentelemetry.exporter.otlp.trace; | |||
| import io.opentelemetry.api.common.AttributeKey; | ||||
| import io.opentelemetry.api.common.Attributes; | ||||
| import io.opentelemetry.api.trace.SpanContext; | ||||
| import io.opentelemetry.api.trace.SpanId; | ||||
| import io.opentelemetry.api.trace.SpanKind; | ||||
| import io.opentelemetry.api.trace.TraceFlags; | ||||
| import io.opentelemetry.api.trace.TraceId; | ||||
| import io.opentelemetry.api.trace.TraceState; | ||||
| import io.opentelemetry.sdk.common.InstrumentationLibraryInfo; | ||||
| import io.opentelemetry.sdk.resources.Resource; | ||||
|  | @ -47,12 +45,8 @@ public class RequestMarshalState { | |||
| 
 | ||||
|   private static final InstrumentationLibraryInfo INSTRUMENTATION_LIBRARY_INFO = | ||||
|       InstrumentationLibraryInfo.create("name", null); | ||||
|   private static final byte[] TRACE_ID_BYTES = | ||||
|       new byte[] {123, 46, 23, 78, 12, 5, (byte) 180, (byte) 223, 45, 89, 71, 61, 62, 29, 34, 54}; | ||||
|   private static final String TRACE_ID = TraceId.fromBytes(TRACE_ID_BYTES); | ||||
|   private static final byte[] SPAN_ID_BYTES = | ||||
|       new byte[] {(byte) 198, (byte) 245, (byte) 213, (byte) 156, 46, 31, 29, 101}; | ||||
|   private static final String SPAN_ID = SpanId.fromBytes(SPAN_ID_BYTES); | ||||
|   private static final String TRACE_ID = "7b2e170db4df2d593ddb4ddf2ddf2d59"; | ||||
|   private static final String SPAN_ID = "170d3ddb4d23e81f"; | ||||
|   private static final SpanContext SPAN_CONTEXT = | ||||
|       SpanContext.create(TRACE_ID, SPAN_ID, TraceFlags.getSampled(), TraceState.getDefault()); | ||||
| 
 | ||||
|  |  | |||
|  | @ -11,10 +11,8 @@ import com.google.protobuf.CodedOutputStream; | |||
| import io.opentelemetry.api.common.AttributeKey; | ||||
| import io.opentelemetry.api.common.Attributes; | ||||
| import io.opentelemetry.api.trace.SpanContext; | ||||
| import io.opentelemetry.api.trace.SpanId; | ||||
| import io.opentelemetry.api.trace.SpanKind; | ||||
| import io.opentelemetry.api.trace.TraceFlags; | ||||
| import io.opentelemetry.api.trace.TraceId; | ||||
| import io.opentelemetry.api.trace.TraceState; | ||||
| import io.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest; | ||||
| import io.opentelemetry.sdk.common.InstrumentationLibraryInfo; | ||||
|  | @ -52,11 +50,8 @@ class TraceMarshalerTest { | |||
| 
 | ||||
|   private static final InstrumentationLibraryInfo INSTRUMENTATION_LIBRARY_INFO = | ||||
|       InstrumentationLibraryInfo.create("name", null); | ||||
|   private static final byte[] TRACE_ID_BYTES = | ||||
|       new byte[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4}; | ||||
|   private static final String TRACE_ID = TraceId.fromBytes(TRACE_ID_BYTES); | ||||
|   private static final byte[] SPAN_ID_BYTES = new byte[] {0, 0, 0, 0, 4, 3, 2, 1}; | ||||
|   private static final String SPAN_ID = SpanId.fromBytes(SPAN_ID_BYTES); | ||||
|   private static final String TRACE_ID = "00000000000000000000000001020304"; | ||||
|   private static final String SPAN_ID = "0000000004030201"; | ||||
| 
 | ||||
|   private static final SpanContext SPAN_CONTEXT = | ||||
|       SpanContext.create( | ||||
|  |  | |||
|  | @ -13,7 +13,6 @@ import io.opentelemetry.api.trace.Span; | |||
| import io.opentelemetry.api.trace.SpanContext; | ||||
| import io.opentelemetry.api.trace.SpanKind; | ||||
| import io.opentelemetry.api.trace.TraceFlags; | ||||
| import io.opentelemetry.api.trace.TraceId; | ||||
| import io.opentelemetry.api.trace.TraceState; | ||||
| import io.opentelemetry.context.Context; | ||||
| import io.opentelemetry.sdk.trace.IdGenerator; | ||||
|  | @ -148,26 +147,7 @@ class TraceIdRatioBasedSamplerTest { | |||
|     final Sampler defaultProbability = Sampler.traceIdRatioBased(0.0001); | ||||
|     // This traceId will not be sampled by the Probability Sampler because the last 8 bytes as long | ||||
|     // is not less than probability * Long.MAX_VALUE; | ||||
|     String notSampledTraceId = | ||||
|         TraceId.fromBytes( | ||||
|             new byte[] { | ||||
|               0, | ||||
|               0, | ||||
|               0, | ||||
|               0, | ||||
|               0, | ||||
|               0, | ||||
|               0, | ||||
|               0, | ||||
|               (byte) 0x8F, | ||||
|               (byte) 0xFF, | ||||
|               (byte) 0xFF, | ||||
|               (byte) 0xFF, | ||||
|               (byte) 0xFF, | ||||
|               (byte) 0xFF, | ||||
|               (byte) 0xFF, | ||||
|               (byte) 0xFF | ||||
|             }); | ||||
|     String notSampledTraceId = "00000000000000008fffffffffffffff"; | ||||
|     SamplingResult samplingResult1 = | ||||
|         defaultProbability.shouldSample( | ||||
|             invalidParentContext, | ||||
|  | @ -179,26 +159,7 @@ class TraceIdRatioBasedSamplerTest { | |||
|     assertThat(samplingResult1.getDecision()).isEqualTo(SamplingDecision.DROP); | ||||
|     // This traceId will be sampled by the Probability Sampler because the last 8 bytes as long | ||||
|     // is less than probability * Long.MAX_VALUE; | ||||
|     String sampledTraceId = | ||||
|         TraceId.fromBytes( | ||||
|             new byte[] { | ||||
|               (byte) 0x00, | ||||
|               (byte) 0x00, | ||||
|               (byte) 0xFF, | ||||
|               (byte) 0xFF, | ||||
|               (byte) 0xFF, | ||||
|               (byte) 0xFF, | ||||
|               (byte) 0xFF, | ||||
|               (byte) 0xFF, | ||||
|               0, | ||||
|               0, | ||||
|               0, | ||||
|               0, | ||||
|               0, | ||||
|               0, | ||||
|               0, | ||||
|               0 | ||||
|             }); | ||||
|     String sampledTraceId = "0000ffffffffffff0000000000000000"; | ||||
|     SamplingResult samplingResult2 = | ||||
|         defaultProbability.shouldSample( | ||||
|             invalidParentContext, | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue