ClickHouse/src/Interpreters/OpenTelemetrySpanLog.h

46 lines
1.5 KiB
C++
Raw Normal View History

2020-08-20 20:59:40 +00:00
#pragma once
#include <Interpreters/SystemLog.h>
#include <Common/OpenTelemetryTraceContext.h>
2020-08-20 20:59:40 +00:00
namespace DB
{
struct OpenTelemetrySpanLogElement : public OpenTelemetrySpan
{
OpenTelemetrySpanLogElement() = default;
OpenTelemetrySpanLogElement(const OpenTelemetrySpan & span)
: OpenTelemetrySpan(span) {}
2020-08-20 20:59:40 +00:00
static std::string name() { return "OpenTelemetrySpanLog"; }
static NamesAndTypesList getNamesAndTypes();
static NamesAndAliases getNamesAndAliases();
2020-08-20 20:59:40 +00:00
void appendToBlock(MutableColumns & columns) const;
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;
};
typedef std::shared_ptr<OpenTelemetrySpanLog> OpenTelemetrySpanLogPtr;
struct OpenTelemetrySpanHolder : public OpenTelemetrySpan
{
OpenTelemetrySpanHolder(const OpenTelemetryTraceContext& _trace_context, OpenTelemetrySpanLogPtr _span_log, const std::string & _operation_name);
explicit OpenTelemetrySpanHolder(const std::string & _operation_name);
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);
void finish();
~OpenTelemetrySpanHolder();
};
2020-08-20 20:59:40 +00:00
}