-
Notifications
You must be signed in to change notification settings - Fork 43
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
Added Brave, OTel, Zipkin & Wavefront #1
Conversation
} | ||
|
||
@Override | ||
public boolean equals(Object o) { |
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.
EqualsGetClass: Overriding Object#equals in a non-final class by using getClass rather than instanceof breaks substitutability of subclasses.
(at-me in a reply with help
or ignore
)
} | ||
|
||
@Override | ||
public boolean equals(Object o) { |
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.
EqualsGetClass: Overriding Object#equals in a non-final class by using getClass rather than instanceof breaks substitutability of subclasses.
(at-me in a reply with help
or ignore
)
} | ||
|
||
@Override | ||
public boolean equals(Object o) { |
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.
EqualsGetClass: Overriding Object#equals in a non-final class by using getClass rather than instanceof breaks substitutability of subclasses.
(at-me in a reply with help
or ignore
)
} | ||
|
||
@Override | ||
public boolean equals(Object o) { |
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.
EqualsGetClass: Overriding Object#equals in a non-final class by using getClass rather than instanceof breaks substitutability of subclasses.
(at-me in a reply with help
or ignore
)
} | ||
|
||
@Override | ||
public boolean equals(Object o) { |
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.
EqualsGetClass: Overriding Object#equals in a non-final class by using getClass rather than instanceof breaks substitutability of subclasses.
(at-me in a reply with help
or ignore
)
new NamedThreadFactory("observability-heart-beater").setDaemon(true)); | ||
|
||
// Emit Heartbeats Metrics every 1 min. | ||
heartbeatMetricsScheduledExecutorService.scheduleAtFixedRate(() -> { |
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.
FutureReturnValueIgnored: Return value of methods returning Future must be checked. Ignoring returned Futures suppresses exceptions thrown from the code that completes the Future.
(at-me in a reply with help
or ignore
)
|
||
private final io.opentelemetry.api.trace.SpanBuilder delegate; | ||
|
||
private final List<String> annotations = new LinkedList<>(); |
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.
JdkObsolete: It is very rare for LinkedList to out-perform ArrayList or ArrayDeque. Avoid it unless you're willing to invest a lot of time into benchmarking. Caveat: LinkedList supports null elements, but ArrayDeque does not.
(at-me in a reply with help
or ignore
)
|
||
private static final Map<String, BaggageInScope> CACHE = new ConcurrentHashMap<>(); | ||
|
||
public Map<String, String> getAllBaggage() { |
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.
MissingOverride: getAllBaggage implements method in BaggageManager; expected @OverRide
(at-me in a reply with help
or ignore
)
*/ | ||
@Override | ||
Span event(String value); |
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.
MissingOverride: event implements method in SpanCustomizer; expected @OverRide
(at-me in a reply with help
or ignore
)
*/ | ||
@Override | ||
Span name(String name); |
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.
MissingOverride: name implements method in SpanCustomizer; expected @OverRide
(at-me in a reply with help
or ignore
)
*/ | ||
@Override | ||
Span tag(String key, String value); |
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.
MissingOverride: tag implements method in SpanCustomizer; expected @OverRide
(at-me in a reply with help
or ignore
)
} | ||
|
||
// https://github.com/wavefrontHQ/wavefront-proxy/blob/3dd1fa11711a04de2d9d418e2269f0f9fb464f36/proxy/src/main/java/com/wavefront/agent/listeners/tracing/ZipkinPortUnificationHandler.java#L397-L402 | ||
static List<SpanLog> convertAnnotationsToSpanLogs(FinishedSpan span) { |
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.
MixedMutabilityReturnType: This method returns both mutable and immutable collections or maps from different paths. This may be confusing for users of the method.
(at-me in a reply with help
or ignore
)
close(); | ||
Entry entry = entry(); | ||
Scope scope = Baggage.builder().put(entry.getKey(), entry.getValue(), entry.getMetadata()).build() | ||
.makeCurrent(); |
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.
MustBeClosedChecker: The result of this method must be closed.
(at-me in a reply with help
or ignore
)
baggage = Baggage.builder().put(entry().getKey(), value, entry().getMetadata()).build(); | ||
} | ||
Context withBaggage = current.with(baggage); | ||
this.scope.set(withBaggage.makeCurrent()); |
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.
MustBeClosedChecker: The result of this method must be closed.
(at-me in a reply with help
or ignore
)
(key, baggageEntry) -> baggageBuilder.put(key, baggageEntry.getValue(), baggageEntry.getMetadata())); | ||
Baggage updatedBaggage = baggageBuilder.build(); | ||
|
||
io.opentelemetry.context.Scope attach = old.with(fromContext).with(updatedBaggage).makeCurrent(); |
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.
MustBeClosedChecker: The result of this method must be closed.
(at-me in a reply with help
or ignore
)
OtelSpanInScope(OtelSpan sleuthSpan, io.opentelemetry.api.trace.Span otelSpan) { | ||
this.sleuthSpan = sleuthSpan; | ||
this.otelSpan = otelSpan; | ||
this.delegate = otelSpan.makeCurrent(); |
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.
MustBeClosedChecker: The result of this method must be closed.
(at-me in a reply with help
or ignore
)
@Override | ||
public ScopedSpan startScopedSpan(String name) { | ||
io.opentelemetry.api.trace.Span span = this.tracer.spanBuilder(name).startSpan(); | ||
return new OtelScopedSpan(span, span.makeCurrent()); |
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.
MustBeClosedChecker: The result of this method must be closed.
(at-me in a reply with help
or ignore
)
(clazz) -> new TracingContext()); | ||
} | ||
|
||
@Nullable |
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.
NullableVoid: void-returning methods should not be annotated with @nullable, since they cannot return null
(at-me in a reply with help
or ignore
)
continue; | ||
} | ||
TraceContextOrSamplingFlags extract = propagator.extractor(getter).extract(request); | ||
if (extract != TraceContextOrSamplingFlags.EMPTY) { |
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.
ReferenceEquality: Comparison using reference equality instead of value equality
(at-me in a reply with help
or ignore
)
continue; | ||
} | ||
TraceContext decorate = entry.getKey().decorate(context); | ||
if (decorate != context) { |
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.
ReferenceEquality: Comparison using reference equality instead of value equality
(at-me in a reply with help
or ignore
)
|
||
List<AbstractMap.SimpleEntry<BaggageInScope, String>> addBaggageToContext(String baggageHeader) { | ||
List<AbstractMap.SimpleEntry<BaggageInScope, String>> pairs = new ArrayList<>(); | ||
String[] entries = baggageHeader.split(","); |
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.
StringSplitter: String.split(String) has surprising behavior
(at-me in a reply with help
or ignore
)
baggageEntries.forEach(e -> setter.set(c, e.getKey(), e.getValue())); | ||
} | ||
|
||
private <C> List<Map.Entry<String, String>> applicableBaggageEntries(C c) { |
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.
UnusedVariable: The parameter 'c' is never read.
(at-me in a reply with help
or ignore
)
return new BraveHttpClientHandler(brave.http.HttpClientHandler.create(httpTracing)); | ||
} | ||
|
||
private static Consumer<BraveBuildingBlocks> closingFunction(BraveBuildingBlocks braveBuildingBlocks) { |
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.
UnusedVariable: The parameter 'braveBuildingBlocks' is never read.
(at-me in a reply with help
or ignore
)
return new OtelHttpClientHandler(openTelemetrySdk, null, null, SamplerFunction.alwaysSample(), new DefaultHttpClientAttributesExtractor()); | ||
} | ||
|
||
private static Consumer<OtelBuildingBlocks> closingFunction(OtelBuildingBlocks otelBuildingBlocks) { |
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.
UnusedVariable: The parameter 'otelBuildingBlocks' is never read.
(at-me in a reply with help
or ignore
)
@Override | ||
public void onStart(Timer.Sample sample, CTX event) { | ||
Span parentSpan = getTracingContext(event).getSpan(); | ||
CurrentTraceContext.Scope scope = null; |
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.
UnusedVariable: The local variable 'scope' is never read.
(at-me in a reply with help
or ignore
)
|
||
@Override | ||
public void onEnd(ReadableSpan span) { | ||
this.spans.add(span.toSpanData()); |
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.
INTERFACE_NOT_THREAD_SAFE: Unprotected call to method ReadableSpan.toSpanData()
of un-annotated interface io.opentelemetry.sdk.trace.ReadableSpan
. Consider annotating the interface with @ThreadSafe
or adding a lock.
Reporting because a superclass class io.opentelemetry.sdk.trace.SpanProcessor
is annotated @ThreadSafe
.
(at-me in a reply with help
or ignore
)
Baggage baggage = builder.build(); | ||
Context withBaggage = context.with(baggage); | ||
if (log.isDebugEnabled()) { | ||
log.debug("Will propagate new baggage context for entries " + baggageEntries); |
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.
INTERFACE_NOT_THREAD_SAFE: Unprotected call to method InternalLogger.debug(...)
of un-annotated interface io.micrometer.core.util.internal.logging.InternalLogger
. Consider annotating the interface with @ThreadSafe
or adding a lock.
Reporting because a superclass class io.opentelemetry.context.propagation.TextMapPropagator
is annotated @ThreadSafe
.
(at-me in a reply with help
or ignore
)
|
||
@Override | ||
public <C> void inject(Context context, C c, TextMapSetter<C> setter) { | ||
List<Map.Entry<String, String>> baggageEntries = applicableBaggageEntries(c); |
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.
INTERFACE_NOT_THREAD_SAFE: Unprotected call to method BaggageManager.getAllBaggage()
of un-annotated interface io.micrometer.tracing.BaggageManager
. Consider annotating the interface with @ThreadSafe
or adding a lock.
Reporting because a superclass class io.opentelemetry.context.propagation.TextMapPropagator
is annotated @ThreadSafe
.
(at-me in a reply with help
or ignore
)
W3CBaggagePropagator.getInstance())); | ||
this.mapping.put(PropagationType.CUSTOM, NoopTextMapPropagator.INSTANCE); | ||
if (log.isDebugEnabled()) { | ||
log.debug("Registered the following context propagation types " + this.mapping.keySet()); |
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.
INTERFACE_NOT_THREAD_SAFE: Unprotected call to method InternalLogger.debug(...)
of un-annotated interface io.micrometer.core.util.internal.logging.InternalLogger
. Consider annotating the interface with @ThreadSafe
or adding a lock.
Reporting because a superclass class io.opentelemetry.context.propagation.TextMapPropagator
is annotated @ThreadSafe
.
(at-me in a reply with help
or ignore
)
} | ||
|
||
static brave.SpanCustomizer toBrave(SpanCustomizer spanCustomizer) { | ||
return ((BraveSpanCustomizer) AssertingSpanCustomizer.unwrap(spanCustomizer)).spanCustomizer; |
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.
NULL_DEREFERENCE: object returned by unwrap(spanCustomizer)
could be null and is dereferenced at line 37.
(at-me in a reply with help
or ignore
)
} | ||
|
||
static io.opentelemetry.api.trace.Span toOtel(Span span) { | ||
return ((OtelSpan) AssertingSpan.unwrap(span)).delegate; |
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.
NULL_DEREFERENCE: object returned by unwrap(span)
could be null and is dereferenced at line 56.
(at-me in a reply with help
or ignore
)
public void onRestore(Timer.Sample sample, Timer.HandlerContext context) { | ||
// TODO: check for nulls | ||
CurrentTraceContext.Scope scope = this.tracer.currentTraceContext() | ||
.maybeScope(getTracingContext(context).getSpan().context()); |
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.
NULL_DEREFERENCE: object returned by DefaultTracingRecordingHandler.tracer.currentTraceContext()
could be null and is dereferenced at line 51.
(at-me in a reply with help
or ignore
)
return; | ||
} | ||
CurrentTraceContext.Scope scope = getTracer().currentTraceContext() | ||
.maybeScope(span.context()); |
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.
NULL_DEREFERENCE: object returned by getTracer().currentTraceContext()
could be null and is dereferenced at line 48.
(at-me in a reply with help
or ignore
)
if (baggage == null) { | ||
return; | ||
} | ||
String traceState = baggage.get(BraveTraceContext.fromBrave(context)); |
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.
RESOURCE_LEAK: resource of type io.micrometer.tracing.brave.bridge.BraveBaggageInScope
acquired by call to getBaggage(...)
at line 209 is not released after line 214.
(at-me in a reply with help
or ignore
)
No description provided.