2020-08-20 20:59:40 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Interpreters/SystemLog.h>
|
2022-07-07 09:41:10 +00:00
|
|
|
#include <Common/OpenTelemetryTraceContext.h>
|
2020-08-20 20:59:40 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
struct OpenTelemetrySpanLogElement : public OpenTelemetrySpan
|
|
|
|
{
|
2020-11-09 15:07:38 +00:00
|
|
|
OpenTelemetrySpanLogElement() = default;
|
2022-07-07 09:41:10 +00:00
|
|
|
OpenTelemetrySpanLogElement(const OpenTelemetrySpan & span)
|
2020-11-09 15:07:38 +00:00
|
|
|
: 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;
|
2022-04-17 21:53:28 +00:00
|
|
|
static const char * getCustomColumnList() { return nullptr; }
|
2020-08-20 20:59:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// 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;
|
|
|
|
};
|
|
|
|
|
2022-07-07 09:41:10 +00:00
|
|
|
typedef std::shared_ptr<OpenTelemetrySpanLog> OpenTelemetrySpanLogPtr;
|
|
|
|
|
2020-11-09 15:07:38 +00:00
|
|
|
struct OpenTelemetrySpanHolder : public OpenTelemetrySpan
|
|
|
|
{
|
2022-07-07 09:41:10 +00:00
|
|
|
OpenTelemetrySpanHolder(const OpenTelemetryTraceContext& _trace_context, OpenTelemetrySpanLogPtr _span_log, const std::string & _operation_name);
|
2022-03-13 11:59:20 +00:00
|
|
|
explicit 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);
|
|
|
|
|
2022-07-07 09:41:10 +00:00
|
|
|
void finish();
|
2020-11-09 15:07:38 +00:00
|
|
|
~OpenTelemetrySpanHolder();
|
|
|
|
};
|
|
|
|
|
2020-08-20 20:59:40 +00:00
|
|
|
}
|