]> git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/opentelemetry-cpp/sdk/include/opentelemetry/sdk/logs/multi_recordable.h
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / jaegertracing / opentelemetry-cpp / sdk / include / opentelemetry / sdk / logs / multi_recordable.h
1 // Copyright The OpenTelemetry Authors
2 // SPDX-License-Identifier: Apache-2.0
3
4 #pragma once
5
6 #ifdef ENABLE_LOGS_PREVIEW
7
8 # include <cstddef>
9 # include <memory>
10 # include <unordered_map>
11
12 # include "opentelemetry/sdk/logs/processor.h"
13 # include "opentelemetry/sdk/logs/recordable.h"
14 # include "opentelemetry/sdk/resource/resource.h"
15 # include "opentelemetry/version.h"
16
17 OPENTELEMETRY_BEGIN_NAMESPACE
18 namespace sdk
19 {
20 namespace logs
21 {
22 class MultiRecordable final : public Recordable
23 {
24 public:
25 void AddRecordable(const LogProcessor &processor,
26 std::unique_ptr<Recordable> recordable) noexcept;
27
28 const std::unique_ptr<Recordable> &GetRecordable(const LogProcessor &processor) const noexcept;
29
30 std::unique_ptr<Recordable> ReleaseRecordable(const LogProcessor &processor) noexcept;
31
32 /**
33 * Set the timestamp for this log.
34 * @param timestamp the timestamp to set
35 */
36 void SetTimestamp(opentelemetry::common::SystemTimestamp timestamp) noexcept override;
37
38 /**
39 * Set the severity for this log.
40 * @param severity the severity of the event
41 */
42 void SetSeverity(opentelemetry::logs::Severity severity) noexcept override;
43
44 /**
45 * Set body field for this log.
46 * @param message the body to set
47 */
48 void SetBody(nostd::string_view message) noexcept override;
49
50 /**
51 * Set Resource of this log
52 * @param Resource the resource to set
53 */
54 void SetResource(const opentelemetry::sdk::resource::Resource &resource) noexcept override;
55
56 /**
57 * Set an attribute of a log.
58 * @param key the name of the attribute
59 * @param value the attribute value
60 */
61 void SetAttribute(nostd::string_view key,
62 const opentelemetry::common::AttributeValue &value) noexcept override;
63
64 /**
65 * Set the trace id for this log.
66 * @param trace_id the trace id to set
67 */
68 void SetTraceId(opentelemetry::trace::TraceId trace_id) noexcept override;
69
70 /**
71 * Set the span id for this log.
72 * @param span_id the span id to set
73 */
74 void SetSpanId(opentelemetry::trace::SpanId span_id) noexcept override;
75
76 /**
77 * Inject trace_flags for this log.
78 * @param trace_flags the trace flags to set
79 */
80 void SetTraceFlags(opentelemetry::trace::TraceFlags trace_flags) noexcept override;
81
82 /**
83 * Set instrumentation_library for this log.
84 * @param instrumentation_library the instrumentation library to set
85 */
86 void SetInstrumentationLibrary(
87 const opentelemetry::sdk::instrumentationlibrary::InstrumentationLibrary
88 &instrumentation_library) noexcept override;
89
90 /** Returns the associated instruementation library */
91 const opentelemetry::sdk::instrumentationlibrary::InstrumentationLibrary &
92 GetInstrumentationLibrary() const noexcept;
93
94 private:
95 std::unordered_map<std::size_t, std::unique_ptr<Recordable>> recordables_;
96 const opentelemetry::sdk::instrumentationlibrary::InstrumentationLibrary
97 *instrumentation_library_ = nullptr;
98 };
99 } // namespace logs
100 } // namespace sdk
101
102 OPENTELEMETRY_END_NAMESPACE
103
104 #endif