From 0a42dbafe847732f32553d51287e8edc94d9ad01 Mon Sep 17 00:00:00 2001 From: Alexander Gololobov Date: Wed, 17 Jan 2024 17:46:15 +0100 Subject: [PATCH] Add attributes --- src/IO/WriteBufferFromS3.cpp | 5 +++++ src/Storages/MergeTree/MergeTreeDataWriter.cpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/IO/WriteBufferFromS3.cpp b/src/IO/WriteBufferFromS3.cpp index c928c43f8ee..a7b674b7a75 100644 --- a/src/IO/WriteBufferFromS3.cpp +++ b/src/IO/WriteBufferFromS3.cpp @@ -179,6 +179,9 @@ void WriteBufferFromS3::preFinalize() void WriteBufferFromS3::finalizeImpl() { OpenTelemetry::SpanHolder span("WriteBufferFromS3::finalizeImpl"); + span.addAttribute("clickhouse.s3_bucket", bucket); + span.addAttribute("clickhouse.s3_key", key); + span.addAttribute("clickhouse.total_size", total_size); LOG_TRACE(limitedLog, "finalizeImpl WriteBufferFromS3. {}.", getShortLogDetails()); @@ -190,6 +193,8 @@ void WriteBufferFromS3::finalizeImpl() task_tracker->waitAll(); + span.addAttributeIfNotZero("clickhouse.multipart_upload_parts", multipart_tags.size()); + if (!multipart_upload_id.empty()) { completeMultipartUpload(); diff --git a/src/Storages/MergeTree/MergeTreeDataWriter.cpp b/src/Storages/MergeTree/MergeTreeDataWriter.cpp index 2a6eb1ae4f7..3c0b2d2b42e 100644 --- a/src/Storages/MergeTree/MergeTreeDataWriter.cpp +++ b/src/Storages/MergeTree/MergeTreeDataWriter.cpp @@ -319,6 +319,9 @@ Block MergeTreeDataWriter::mergeBlock( size_t block_size = block.rows(); + span.addAttribute("clickhouse.rows", block_size); + span.addAttribute("clickhouse.columns", block.columns()); + auto get_merging_algorithm = [&]() -> std::shared_ptr { switch (merging_params.mode) @@ -354,6 +357,8 @@ Block MergeTreeDataWriter::mergeBlock( if (!merging_algorithm) return block; + span.addAttribute("clickhouse.merging_algorithm", merging_algorithm->getName()); + Chunk chunk(block.getColumns(), block_size); IMergingAlgorithm::Input input;