2020-08-20 20:59:40 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Interpreters/SystemLog.h>
|
2022-01-10 19:01:41 +00:00
|
|
|
#include <Core/NamesAndTypes.h>
|
|
|
|
#include <Core/NamesAndAliases.h>
|
2020-08-20 20:59:40 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
struct OpenTelemetrySpan
|
|
|
|
{
|
2021-05-04 22:42:14 +00:00
|
|
|
UUID trace_id;
|
2020-08-20 20:59:40 +00:00
|
|
|
UInt64 span_id;
|
|
|
|
UInt64 parent_span_id;
|
|
|
|
std::string operation_name;
|
2020-11-19 16:55:56 +00:00
|
|
|
UInt64 start_time_us;
|
|
|
|
UInt64 finish_time_us;
|
2020-08-20 20:59:40 +00:00
|
|
|
Array attribute_names;
|
|
|
|
Array attribute_values;
|
|
|
|
// I don't understand how Links work, namely, which direction should they
|
|
|
|
// point to, and how they are related with parent_span_id, so no Links for
|
|
|
|
// now.
|
|
|
|
};
|
|
|
|
|
|
|
|
struct OpenTelemetrySpanLogElement : public OpenTelemetrySpan
|
|
|
|
{
|
2020-11-09 15:07:38 +00:00
|
|
|
OpenTelemetrySpanLogElement() = default;
|
|
|
|
OpenTelemetrySpanLogElement(const OpenTelemetrySpan & span)
|
|
|
|
: OpenTelemetrySpan(span) {}
|
|
|
|
|
2020-08-20 20:59:40 +00:00
|
|
|
static std::string name() { return "OpenTelemetrySpanLog"; }
|
2021-06-28 11:42:21 +00:00
|
|
|
static NamesAndTypesList getNamesAndTypes();
|
|
|
|
static NamesAndAliases getNamesAndAliases();
|
2020-08-20 20:59:40 +00:00
|
|
|
void appendToBlock(MutableColumns & columns) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
// OpenTelemetry standartizes some Log data as well, so it's not just
|
|
|
|
// OpenTelemetryLog to avoid confusion.
|
|
|
|
class OpenTelemetrySpanLog : public SystemLog<OpenTelemetrySpanLogElement>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
using SystemLog<OpenTelemetrySpanLogElement>::SystemLog;
|
|
|
|
};
|
|
|
|
|
2020-11-09 15:07:38 +00:00
|
|
|
struct OpenTelemetrySpanHolder : public OpenTelemetrySpan
|
|
|
|
{
|
|
|
|
OpenTelemetrySpanHolder(const std::string & _operation_name);
|
2022-03-03 11:53:29 +00:00
|
|
|
void addAttribute(const std::string& name, UInt64 value);
|
|
|
|
void addAttribute(const std::string& name, const std::string& value);
|
|
|
|
void addAttribute(const Exception & e);
|
|
|
|
void addAttribute(std::exception_ptr e);
|
|
|
|
|
2020-11-09 15:07:38 +00:00
|
|
|
~OpenTelemetrySpanHolder();
|
|
|
|
};
|
|
|
|
|
2020-08-20 20:59:40 +00:00
|
|
|
}
|