-
Notifications
You must be signed in to change notification settings - Fork 48
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
Is there a maximum of sub-spans? #109
Comments
Hmm, this is very interesting ... AFAIK, there is no such limitation. At least we use hundreds of spans in our projects. |
It seems to be caused by the size of the trace. This example causes the issue: <?php
// https://github.com/jonahgeorge/jaeger-client-php/issues/109
const NESTED_SPAN_COUNT = 100;
const NESTED_SPAN_TAG_VALUE_BYTE_COUNT = 400;
require_once __DIR__.'/../lib/vendor/autoload.php';
use OpenTracing\GlobalTracer;
try {
$config = new \Jaeger\Config(
[
'sampler' => [
'type' => \Jaeger\SAMPLER_TYPE_CONST,
'param' => true,
],
'logging' => true,
"tags" => [
"foo" => "bar",
],
"local_agent" => [
"reporting_host" => "jaeger",
],
'dispatch_mode' => \Jaeger\Config::JAEGER_OVER_BINARY_UDP,
],
'my-app',
); $config->initializeTracer();
} catch (Throwable $e) {
error_log("ERROR could not initialize tracer: $e");
}
$tracer = GlobalTracer::get();
$scope = $tracer->startActiveSpan('main', []);
for ($i = 0; $i < NESTED_SPAN_COUNT; $i++) {
$nestedSpanScope = $tracer->startActiveSpan("nested");
$nestedSpanScope->getSpan()
->setTag('key', bin2hex(random_bytes(NESTED_SPAN_TAG_VALUE_BYTE_COUNT)));
usleep(1000);
$nestedSpanScope->close();
}
$scope->close();
$tracer->flush();
$spanContext = $scope->getSpan()->getContext();
if (\is_a($spanContext, \Jaeger\SpanContext::class)) {
$traceId = dechex($spanContext->getTraceId());
error_log("TRACE_ID={$traceId}");
} I don't get this issue if I either set
I guess, the UDP package size may be the issue. Any idea for a workaround? |
Hi! Yes, you are right about UDP package size. To be sure about that try to use some logger here.
Then use it as 3rd parameter to Config constructor:
Then you will see a message like this: The solution can be to call
We will think about the way on how to optimise this. |
@pekhota Thanks, I do not get such a message (without the flushing in between). Is this a bug? If I add the flush as you described, it works. Do you think it is possible to automatically flush, before the maximum UDP package size is exceeded? |
It seems the key point is to call |
What should the patch contain? Do you mean a PR with the auto-flush logic? |
Shouldn't UdpSender::send already do this using UdpSender:: chunkSplit? |
Yeah, I meant exactly this. |
I'll send a patch in a few days. |
@pekhota How can I install this version in my project? |
@maiermic A fix for this issue has been merged into the master branch. Could you please check master branch, so we can release a new version? |
Does this mean, I can install this version using |
yes |
Thanks 👍 I can confirm that it works 🚀 |
Just released 1.2.5 version. |
Is there a (intended) maximum of sub-spans? I'm creating a larger trace of a request with several SQL statements (a span for each). It works up to a total of 59 spans (depth 4), where one span has 50 sub-spans (children). If I add more than 50 sub-spans, the trace is not found in Jaeger UI and the log of
jaegertracing/all-in-one:1.26
shows two errorsjonahgeorge/jaeger-client-php
version1.2.4
. My configuration:The text was updated successfully, but these errors were encountered: