You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.
I'm trying to write a cross-language (PHP and py for now) bridge to be able to start from, i.e., PHP and end in python or vice versa. We have an application which uses both languages. I chose to create a new propagator in PHP because the python formater for the propagator is easier to rewrite in PHP.
So far, I've got here:
<?phpnamespaceApp\Opencensus\Trace\Propagator;
useApp\Opencensus\Trace\Propagator\PythonFormater;
useOpenCensus\Trace\Propagator\PropagatorInterface;
useOpenCensus\Trace\SpanContext;
class HttpHeaderPropagator implements PropagatorInterface {
constDEFAULT_HEADER = 'HTTP_TRACEPARENT';
/** * @var FormatterInterface */private$formatter;
/** * @var string */private$header;
/** * @see BaseHttpHeaderPropagator::start() */publicfunction__construct(FormatterInterface$formatter = null, $header = null)
{
$this->formatter = $formatter ?: newPythonFormater();
$this->header = $header ?: self::DEFAULT_HEADER;
}
/** * Generate a SpanContext object from the all the HTTP headers * * @param array $headers * @return SpanContext */publicfunctionextract($headers)
{
if (array_key_exists($this->header, $headers)) {
return$this->formatter->deserialize($headers[$this->header]);
}
returnnewSpanContext();
}
/** * Persists the current SpanContext back into the results of this request * * @param SpanContext $context * @param array $container * @return array */publicfunctioninject(SpanContext$context, $container)
{
$header = $this->key();
$value = $this->formatter->serialize($context);
if (!headers_sent()) {
header("$header: $value");
}
return [
$header => $value
];
}
/** * Returns the current formatter * * @return FormatterInterface */publicfunctionformatter()
{
return$this->formatter;
}
/** * Return the key used to propagate the SpanContext * * @return string */publicfunctionkey()
{
returnstr_replace('_', '-', preg_replace('/^HTTP_/', '', $this->header));
}
}
My 1st test was to start a trace in python, from python make a HTTP call to PHP and continue the trace in PHP. However, Jaeger is logging the PHP side as <trace-without-root-span>.
Could you give me a hint on what I am doing wrong?
The text was updated successfully, but these errors were encountered:
If python is generating a trace/span ids with 64-bit values, then PHP may not be able to handle it using the Jaeger exporter. As a workaround, you can try using the ZipkinExporter and point that to your Jaeger instance's zipkin api port.
Short story long, a 16 'digit' hex chunk can exceed php's INT sise, thus hexdec fails in converting the value correctly which affects the conversion of the traceId. Please see a solution in my PR, trying to cover both BC and GPM solutions for big numbers.
Hi guys,
I'm trying to write a cross-language (PHP and py for now) bridge to be able to start from, i.e., PHP and end in python or vice versa. We have an application which uses both languages. I chose to create a new propagator in PHP because the python formater for the propagator is easier to rewrite in PHP.
So far, I've got here:
My 1st test was to start a trace in python, from python make a HTTP call to PHP and continue the trace in PHP. However, Jaeger is logging the PHP side as
<trace-without-root-span>
.Could you give me a hint on what I am doing wrong?
The text was updated successfully, but these errors were encountered: