2020-08-20 20:59:40 +00:00
|
|
|
#include "OpenTelemetryLog.h"
|
|
|
|
|
|
|
|
#include <DataTypes/DataTypeArray.h>
|
|
|
|
#include <DataTypes/DataTypeDate.h>
|
|
|
|
#include <DataTypes/DataTypeDateTime.h>
|
2020-09-30 16:16:33 +00:00
|
|
|
#include <DataTypes/DataTypeDateTime64.h>
|
2020-08-20 20:59:40 +00:00
|
|
|
#include <DataTypes/DataTypesNumber.h>
|
|
|
|
#include <DataTypes/DataTypeString.h>
|
|
|
|
#include <DataTypes/DataTypeUUID.h>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
Block OpenTelemetrySpanLogElement::createBlock()
|
|
|
|
{
|
|
|
|
return {
|
|
|
|
{std::make_shared<DataTypeUUID>(), "trace_id"},
|
|
|
|
{std::make_shared<DataTypeUInt64>(), "span_id"},
|
|
|
|
{std::make_shared<DataTypeUInt64>(), "parent_span_id"},
|
|
|
|
{std::make_shared<DataTypeString>(), "operation_name"},
|
2020-09-30 16:16:33 +00:00
|
|
|
{std::make_shared<DataTypeDateTime64>(6), "start_time_us"},
|
|
|
|
{std::make_shared<DataTypeDateTime64>(6), "finish_time_us"},
|
2020-09-08 13:19:27 +00:00
|
|
|
{std::make_shared<DataTypeDate>(), "finish_date"},
|
2020-08-20 20:59:40 +00:00
|
|
|
{std::make_shared<DataTypeArray>(std::make_shared<DataTypeString>()),
|
|
|
|
"attribute.names"},
|
|
|
|
{std::make_shared<DataTypeArray>(std::make_shared<DataTypeString>()),
|
|
|
|
"attribute.values"}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
void OpenTelemetrySpanLogElement::appendToBlock(MutableColumns & columns) const
|
|
|
|
{
|
|
|
|
size_t i = 0;
|
|
|
|
|
2020-08-27 18:44:20 +00:00
|
|
|
columns[i++]->insert(UInt128(Int128(trace_id)));
|
2020-08-20 20:59:40 +00:00
|
|
|
columns[i++]->insert(span_id);
|
|
|
|
columns[i++]->insert(parent_span_id);
|
|
|
|
columns[i++]->insert(operation_name);
|
2020-09-30 16:16:33 +00:00
|
|
|
columns[i++]->insert(start_time_us);
|
|
|
|
columns[i++]->insert(finish_time_us);
|
|
|
|
columns[i++]->insert(DateLUT::instance().toDayNum(finish_time_us / 1000000));
|
2020-08-20 20:59:40 +00:00
|
|
|
columns[i++]->insert(attribute_names);
|
|
|
|
columns[i++]->insert(attribute_values);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|