SeanHood / laravel-opentelemetry

OpenTelemetry integration for Laravel applications
10 stars 8 forks source link

Warnings in traces: Invalid parent span IDs=...; skipping clock skew adjustment #1

Closed BnMcG closed 4 years ago

BnMcG commented 4 years ago

Hi,

Just playing around with this library today, and I'm finding the following warning in my traces:

    invalid parent span IDs=defaa3a119800204; skipping clock skew adjustment

The ID changes with each request. Any ideas what might be wrong? I've had a poke around but nothing promising so far. Mostly just curious if this is unique to my environment or not. I'm using this with Laravel 8 and PHP 7.4.

Cheers.

SeanHood commented 4 years ago

Hey, thanks for trying it out! I came up with a workaround to this, shortly before finding this PR: https://github.com/open-telemetry/opentelemetry-php/pull/171

I believe once this is merged, there won’t be any missing parent traces.

In my workaround I replaced startAndActivateSpanFromContext with getActiveSpan. Then updating the name on the span, but this seems to be discouraged.

BnMcG commented 4 years ago

Ah interesting! Yeah, I've been digging around the opentelemetry-php library and suspected it was something to do with that initial span that's setup. I was just looking at whether or not I could force that span to be exported somehow, but if it's being removed altogether that sounds preferable.

BnMcG commented 4 years ago

I just patched in the branch which has the global span changes into my test project and it does get rid of the invalid parent span ID errors! I've also raised #2 which has a minor fix.

SeanHood commented 4 years ago

I saw your commit on #2 to fetch the noop-span version of opentelemetry-php. I think I'd rather wait until there's a fix upstream than add any workarounds in here. By the sounds of it, it shouldn't be too long until that's resolved.

BnMcG commented 4 years ago

That doesn't actually fix the parent ID issue, as far as I can tell it's just an oversight in the examples in the opentelemetry-php library. The startAndActivateSpan method calls $tracer->setActiveSpan($span) itself, so as far as I can see there's no benefit to calling it again yourself.

BnMcG commented 4 years ago

The upstream fix has been merged now, so I think this can be closed.