mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-04 13:32:13 +00:00
Remove extra code
This commit is contained in:
parent
6ae2504e57
commit
9711559391
@ -3425,52 +3425,4 @@ WriteSettings Context::getWriteSettings() const
|
||||
return res;
|
||||
}
|
||||
|
||||
OpenTelemetryThreadTraceContextScopePtr Context::startTracing(const std::string& name)
|
||||
{
|
||||
OpenTelemetryThreadTraceContextScopePtr trace_context;
|
||||
if (this->client_info.client_trace_context.trace_id != UUID())
|
||||
{
|
||||
// Use the OpenTelemetry trace context we received from the client, and
|
||||
// initialize the tracing context for this query on current thread
|
||||
return std::make_unique<OpenTelemetryThreadTraceContextScope>(name,
|
||||
this->client_info.client_trace_context,
|
||||
this->getOpenTelemetrySpanLog());
|
||||
}
|
||||
|
||||
// start the trace ourselves, with some configurable probability.
|
||||
std::bernoulli_distribution should_start_trace{settings.opentelemetry_start_trace_probability};
|
||||
if (!should_start_trace(thread_local_rng))
|
||||
{
|
||||
return trace_context;
|
||||
}
|
||||
|
||||
/// Generate random UUID, but using lower quality RNG,
|
||||
/// because Poco::UUIDGenerator::generateRandom method is using /dev/random, that is very expensive.
|
||||
/// NOTE: Actually we don't need to use UUIDs for query identifiers.
|
||||
/// We could use any suitable string instead.
|
||||
union
|
||||
{
|
||||
char bytes[16];
|
||||
struct
|
||||
{
|
||||
UInt64 a;
|
||||
UInt64 b;
|
||||
} words;
|
||||
UUID uuid{};
|
||||
} random;
|
||||
random.words.a = thread_local_rng(); //-V656
|
||||
random.words.b = thread_local_rng(); //-V656
|
||||
|
||||
OpenTelemetryTraceContext query_trace_context;
|
||||
query_trace_context.trace_id = random.uuid;
|
||||
query_trace_context.span_id = 0;
|
||||
// Mark this trace as sampled in the flags.
|
||||
query_trace_context.trace_flags = 1;
|
||||
|
||||
return std::make_unique<OpenTelemetryThreadTraceContextScope>(name,
|
||||
query_trace_context,
|
||||
this->getOpenTelemetrySpanLog());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -550,8 +550,6 @@ public:
|
||||
const String & projection_name = {},
|
||||
const String & view_name = {});
|
||||
|
||||
OpenTelemetryThreadTraceContextScopePtr startTracing(const std::string& name);
|
||||
|
||||
/// Supported factories for records in query_log
|
||||
enum class QueryLogFactories
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user