NVIDIA DeepStream SDK API Reference

9.2 Release
includes/opentelemetry/exporters/otlp/otlp_log_recordable.h
Go to the documentation of this file.
1 // Copyright The OpenTelemetry Authors
2 // SPDX-License-Identifier: Apache-2.0
3 
4 #pragma once
5 
6 #include <stdint.h>
7 
8 #include "opentelemetry/common/attribute_value.h"
9 #include "opentelemetry/common/timestamp.h"
10 #include "opentelemetry/logs/severity.h"
11 #include "opentelemetry/nostd/string_view.h"
12 #include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h"
13 #include "opentelemetry/sdk/logs/recordable.h"
14 #include "opentelemetry/sdk/resource/resource.h"
15 #include "opentelemetry/trace/span_id.h"
16 #include "opentelemetry/trace/trace_flags.h"
17 #include "opentelemetry/trace/trace_id.h"
18 #include "opentelemetry/version.h"
19 
20 // clang-format off
21 #include "opentelemetry/exporters/otlp/protobuf_include_prefix.h" // IWYU pragma: keep
22 #include "opentelemetry/proto/logs/v1/logs.pb.h"
23 #include "opentelemetry/exporters/otlp/protobuf_include_suffix.h" // IWYU pragma: keep
24 // clang-format on
25 
27 namespace exporter
28 {
29 namespace otlp
30 {
31 
35 class OtlpLogRecordable final : public opentelemetry::sdk::logs::Recordable
36 {
37 public:
38  ~OtlpLogRecordable() override = default;
39 
40  proto::logs::v1::LogRecord &log_record() noexcept { return proto_record_; }
41  const proto::logs::v1::LogRecord &log_record() const noexcept { return proto_record_; }
42 
44  const opentelemetry::sdk::resource::Resource &GetResource() const noexcept;
45 
47  const opentelemetry::sdk::instrumentationscope::InstrumentationScope &GetInstrumentationScope()
48  const noexcept;
49 
54  void SetTimestamp(opentelemetry::common::SystemTimestamp timestamp) noexcept override;
55 
60  void SetObservedTimestamp(opentelemetry::common::SystemTimestamp timestamp) noexcept override;
61 
66  void SetSeverity(opentelemetry::logs::Severity severity) noexcept override;
67 
72  void SetBody(const opentelemetry::common::AttributeValue &message) noexcept override;
73 
79  void SetEventId(int64_t /* id */, nostd::string_view event_name) noexcept override;
80 
85  void SetTraceId(const opentelemetry::trace::TraceId &trace_id) noexcept override;
86 
91  void SetSpanId(const opentelemetry::trace::SpanId &span_id) noexcept override;
92 
97  void SetTraceFlags(const opentelemetry::trace::TraceFlags &trace_flags) noexcept override;
98 
104  void SetAttribute(nostd::string_view key,
105  const opentelemetry::common::AttributeValue &value) noexcept override;
106 
111  void SetResource(const opentelemetry::sdk::resource::Resource &resource) noexcept override;
112 
117  void SetInstrumentationScope(const opentelemetry::sdk::instrumentationscope::InstrumentationScope
118  &instrumentation_scope) noexcept override;
119 
120 private:
121  proto::logs::v1::LogRecord proto_record_;
122  const opentelemetry::sdk::resource::Resource *resource_ = nullptr;
123  const opentelemetry::sdk::instrumentationscope::InstrumentationScope *instrumentation_scope_ =
124  nullptr;
125 };
126 
127 } // namespace otlp
128 } // namespace exporter
trace
Definition: includes/opentelemetry/context/context_value.h:18
nostd
Definition: includes/opentelemetry/nostd/function_ref.h:14
exporter::otlp::OtlpLogRecordable::SetAttribute
void SetAttribute(nostd::string_view key, const opentelemetry::common::AttributeValue &value) noexcept override
Set an attribute of a log.
exporter::otlp::OtlpLogRecordable::SetTraceFlags
void SetTraceFlags(const opentelemetry::trace::TraceFlags &trace_flags) noexcept override
Inject trace_flags for this log.
logs
Definition: includes/opentelemetry/logs/event_id.h:13
exporter
Definition: includes/opentelemetry/exporters/memory/in_memory_data.h:11
OPENTELEMETRY_BEGIN_NAMESPACE
#define OPENTELEMETRY_BEGIN_NAMESPACE
Definition: includes/opentelemetry/version.h:21
exporter::otlp::OtlpLogRecordable::SetInstrumentationScope
void SetInstrumentationScope(const opentelemetry::sdk::instrumentationscope::InstrumentationScope &instrumentation_scope) noexcept override
Set instrumentation_scope for this log.
common::AttributeValue
nostd::variant< bool, int32_t, int64_t, uint32_t, double, const char *, nostd::string_view, nostd::span< const bool >, nostd::span< const int32_t >, nostd::span< const int64_t >, nostd::span< const uint32_t >, nostd::span< const double >, nostd::span< const nostd::string_view >, uint64_t, nostd::span< const uint64_t >, nostd::span< const uint8_t > > AttributeValue
OpenTelemetry signals can be enriched by adding attributes.
Definition: includes/opentelemetry/common/attribute_value.h:58
exporter::otlp::OtlpLogRecordable::SetTraceId
void SetTraceId(const opentelemetry::trace::TraceId &trace_id) noexcept override
Set the trace id for this log.
OPENTELEMETRY_END_NAMESPACE
#define OPENTELEMETRY_END_NAMESPACE
Definition: includes/opentelemetry/version.h:24
exporter::otlp::OtlpLogRecordable::GetInstrumentationScope
const opentelemetry::sdk::instrumentationscope::InstrumentationScope & GetInstrumentationScope() const noexcept
Returns the associated instruementation scope.
exporter::otlp::OtlpLogRecordable::SetEventId
void SetEventId(int64_t, nostd::string_view event_name) noexcept override
Set the Event Id for this log.
exporter::otlp::OtlpLogRecordable::~OtlpLogRecordable
~OtlpLogRecordable() override=default
exporter::otlp::OtlpLogRecordable
An OTLP Recordable implemenation for Logs.
Definition: includes/opentelemetry/exporters/otlp/otlp_log_recordable.h:35
exporter::otlp::OtlpLogRecordable::SetSpanId
void SetSpanId(const opentelemetry::trace::SpanId &span_id) noexcept override
Set the span id for this log.
exporter::otlp::OtlpLogRecordable::SetTimestamp
void SetTimestamp(opentelemetry::common::SystemTimestamp timestamp) noexcept override
Set the timestamp for this log.
exporter::otlp::OtlpLogRecordable::SetObservedTimestamp
void SetObservedTimestamp(opentelemetry::common::SystemTimestamp timestamp) noexcept override
Set the observed timestamp for this log.
exporter::otlp::OtlpLogRecordable::GetResource
const opentelemetry::sdk::resource::Resource & GetResource() const noexcept
Returns the associated resource.
exporter::otlp::OtlpLogRecordable::log_record
const proto::logs::v1::LogRecord & log_record() const noexcept
Definition: includes/opentelemetry/exporters/otlp/otlp_log_recordable.h:41
logs::Severity
Severity
Severity Levels assigned to log events, based on Log Data Model, with the addition of kInvalid (mappe...
Definition: includes/opentelemetry/logs/severity.h:22
exporter::otlp::OtlpLogRecordable::SetResource
void SetResource(const opentelemetry::sdk::resource::Resource &resource) noexcept override
Set Resource of this log.
exporter::otlp::OtlpLogRecordable::SetBody
void SetBody(const opentelemetry::common::AttributeValue &message) noexcept override
Set body field for this log.
sdk
Definition: includes/opentelemetry/sdk/common/atomic_shared_ptr.h:13
exporter::otlp::OtlpLogRecordable::SetSeverity
void SetSeverity(opentelemetry::logs::Severity severity) noexcept override
Set the severity for this log.
exporter::otlp::OtlpLogRecordable::log_record
proto::logs::v1::LogRecord & log_record() noexcept
Definition: includes/opentelemetry/exporters/otlp/otlp_log_recordable.h:40
opentelemetry
Definition: includes/opentelemetry/exporters/otlp/otlp_grpc_client.h:38
nostd::string_view
std::string_view string_view
Definition: includes/opentelemetry/std/string_view.h:18
common
Definition: includes/opentelemetry/common/attribute_value.h:14