Skip to content

Commit

Permalink
Fix ClassCastException in inferred spans (#249)
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasKunz authored May 7, 2024
1 parent 76ccb1c commit 74c9170
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,12 @@ public static ReadableSpan getFor(ReadableSpan span) {
*/
@Nullable
public static ReadableSpan getFor(Span span) {
if (span.getSpanContext().isRemote()) {
if (span instanceof ReadableSpan) {
return getFor((ReadableSpan) span);
} else {
// This can happen when invoked for a PropagatedSpan (e.g. Span.fromContext())
return null;
}
return getFor((ReadableSpan) span);
}

/** See {@link LocalRootSpan#getFor(Span)}. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ dependencies {
tasks.withType<Test>() {
jvmArgs(
//"-Dotel.javaagent.debug=true",
"-Dotel.service.name=testing",
"-Delastic.otel.inferred.spans.enabled=true",
"-Delastic.otel.inferred.spans.duration=2000ms",
"-Delastic.otel.inferred.spans.interval=2000ms",
Expand Down

0 comments on commit 74c9170

Please sign in to comment.