|
|
|
|
@ -59,14 +59,17 @@ defmodule Plausible.ClickhouseRepo do
|
|
|
|
|
|
|
|
|
|
@task_timeout 60_000
|
|
|
|
|
def parallel_tasks(queries) do
|
|
|
|
|
ctx = OpenTelemetry.Ctx.get_current()
|
|
|
|
|
otel_ctx = OpenTelemetry.Ctx.get_current()
|
|
|
|
|
ch_ctx = get_context()
|
|
|
|
|
|
|
|
|
|
context_carrier = fn fun ->
|
|
|
|
|
OpenTelemetry.Ctx.attach(otel_ctx)
|
|
|
|
|
set_context(ch_ctx)
|
|
|
|
|
|
|
|
|
|
execute_with_tracing = fn fun ->
|
|
|
|
|
OpenTelemetry.Ctx.attach(ctx)
|
|
|
|
|
fun.()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
Task.async_stream(queries, execute_with_tracing, max_concurrency: 3, timeout: @task_timeout)
|
|
|
|
|
Task.async_stream(queries, context_carrier, max_concurrency: 3, timeout: @task_timeout)
|
|
|
|
|
|> Enum.to_list()
|
|
|
|
|
|> Keyword.values()
|
|
|
|
|
end
|
|
|
|
|
|