Skip to content
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

TextCodec produces malformed trace identity, trace/span ids should be exactly 16 characters #129

Closed
shadz3rg opened this issue Aug 21, 2023 · 1 comment

Comments

@shadz3rg
Copy link

Hello,
Jaeger guideline states Senders SHOULD generate hex strings of exactly 16 or 32 characters in length,
but algo chosen for span id generator and hex converter produces value not consistent in length (depends on randomized id, making it so hard to debug as 9/10 span ids is correct), in that case it should be padded with leading zeros.
Most recievers will be fine with it and will auto-correct value, but integrating software with abstract request-ids can be tricky and hard to maintain consistency.

Quick gist, run N times:

<?php
$rng = random_int(0, PHP_INT_MAX);
var_dump($rng);
 
$hex = sprintf('%x', (string) $rng);
var_dump('got', $hex);

$hex = sprintf('%016x', (string) $rng);
var_dump('expected', $hex);

Will result:
image

paillechat pushed a commit to paillechat/jaeger-client-php that referenced this issue Aug 25, 2023
@sergeyklay
Copy link
Collaborator

Fixed in v1.5.0. Feel free to open a new issue if the problem appears again. Thank you for contributing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants