Add attributes

This commit is contained in:
Alexander Gololobov 2024-01-17 17:46:15 +01:00
parent 7dda18c209
commit 0a42dbafe8
2 changed files with 10 additions and 0 deletions

View File

@ -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();

View File

@ -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<IMergingAlgorithm>
{
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;