Revert "Revert "Ignore parse failure of opentelemetry header (#32116)" (#33594)" (#33595)

This commit is contained in:
Nikita Mikhaylov 2022-01-19 20:53:39 +03:00 committed by GitHub
parent f95d0a7c2d
commit e3de3889e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 9 deletions

View File

@ -202,7 +202,6 @@ bool OpenTelemetryTraceContext::parseTraceparentHeader(const std::string & trace
++data;
UInt128 trace_id_128 = readHex<UInt128>(data);
trace_id = trace_id_128;
data += 32;
if (*data != '-')
@ -212,7 +211,7 @@ bool OpenTelemetryTraceContext::parseTraceparentHeader(const std::string & trace
}
++data;
span_id = readHex<UInt64>(data);
UInt64 span_id_64 = readHex<UInt64>(data);
data += 16;
if (*data != '-')
@ -222,7 +221,9 @@ bool OpenTelemetryTraceContext::parseTraceparentHeader(const std::string & trace
}
++data;
trace_flags = readHex<UInt8>(data);
this->trace_flags = readHex<UInt8>(data);
this->trace_id = trace_id_128;
this->span_id = span_id_64;
return true;
}

View File

@ -96,7 +96,6 @@ namespace ErrorCodes
extern const int REQUIRED_PASSWORD;
extern const int AUTHENTICATION_FAILED;
extern const int BAD_REQUEST_PARAMETER;
extern const int INVALID_SESSION_TIMEOUT;
extern const int HTTP_LENGTH_REQUIRED;
}
@ -491,12 +490,9 @@ void HTTPHandler::processQuery(
{
std::string opentelemetry_traceparent = request.get("traceparent");
std::string error;
if (!client_info.client_trace_context.parseTraceparentHeader(
opentelemetry_traceparent, error))
if (!client_info.client_trace_context.parseTraceparentHeader(opentelemetry_traceparent, error))
{
throw Exception(ErrorCodes::BAD_REQUEST_PARAMETER,
"Failed to parse OpenTelemetry traceparent header '{}': {}",
opentelemetry_traceparent, error);
LOG_DEBUG(log, "Failed to parse OpenTelemetry traceparent header '{}': {}", opentelemetry_traceparent, error);
}
client_info.client_trace_context.tracestate = request.get("tracestate", "");
}