File: otel_metrics.h

package info (click to toggle)
opentelemetry-cpp 1.23.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,372 kB
  • sloc: cpp: 96,239; sh: 1,766; makefile: 36; python: 31
file content (337 lines) | stat: -rw-r--r-- 16,321 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
/*
 * Copyright The OpenTelemetry Authors
 * SPDX-License-Identifier: Apache-2.0
 */

/*
 * DO NOT EDIT, this is an Auto-generated file from:
 * buildscripts/semantic-convention/templates/registry/semantic_metrics-h.j2
 */

#pragma once

#include "opentelemetry/common/macros.h"
#include "opentelemetry/metrics/meter.h"
#include "opentelemetry/version.h"

OPENTELEMETRY_BEGIN_NAMESPACE
namespace semconv
{
namespace otel
{

/**
 * The number of spans for which the export has finished, either successful or failed
 * <p>
 * For successful exports, @code error.type @endcode MUST NOT be set. For failed exports, @code
 * error.type @endcode must contain the failure cause. For exporters with partial success semantics
 * (e.g. OTLP with @code rejected_spans @endcode), rejected spans must count as failed and only
 * non-rejected spans count as success. If no rejection reason is available, @code rejected @endcode
 * SHOULD be used as value for @code error.type @endcode. <p> counter
 */
static constexpr const char *kMetricOtelSdkExporterSpanExportedCount =
    "otel.sdk.exporter.span.exported.count";
static constexpr const char *descrMetricOtelSdkExporterSpanExportedCount =
    "The number of spans for which the export has finished, either successful or failed";
static constexpr const char *unitMetricOtelSdkExporterSpanExportedCount = "{span}";

static inline nostd::unique_ptr<metrics::Counter<uint64_t>>
CreateSyncInt64MetricOtelSdkExporterSpanExportedCount(metrics::Meter *meter)
{
  return meter->CreateUInt64Counter(kMetricOtelSdkExporterSpanExportedCount,
                                    descrMetricOtelSdkExporterSpanExportedCount,
                                    unitMetricOtelSdkExporterSpanExportedCount);
}

static inline nostd::unique_ptr<metrics::Counter<double>>
CreateSyncDoubleMetricOtelSdkExporterSpanExportedCount(metrics::Meter *meter)
{
  return meter->CreateDoubleCounter(kMetricOtelSdkExporterSpanExportedCount,
                                    descrMetricOtelSdkExporterSpanExportedCount,
                                    unitMetricOtelSdkExporterSpanExportedCount);
}

static inline nostd::shared_ptr<metrics::ObservableInstrument>
CreateAsyncInt64MetricOtelSdkExporterSpanExportedCount(metrics::Meter *meter)
{
  return meter->CreateInt64ObservableCounter(kMetricOtelSdkExporterSpanExportedCount,
                                             descrMetricOtelSdkExporterSpanExportedCount,
                                             unitMetricOtelSdkExporterSpanExportedCount);
}

static inline nostd::shared_ptr<metrics::ObservableInstrument>
CreateAsyncDoubleMetricOtelSdkExporterSpanExportedCount(metrics::Meter *meter)
{
  return meter->CreateDoubleObservableCounter(kMetricOtelSdkExporterSpanExportedCount,
                                              descrMetricOtelSdkExporterSpanExportedCount,
                                              unitMetricOtelSdkExporterSpanExportedCount);
}

/**
 * The number of spans which were passed to the exporter, but that have not been exported yet
 * (neither successful, nor failed) <p> For successful exports, @code error.type @endcode MUST NOT
 * be set. For failed exports, @code error.type @endcode must contain the failure cause. <p>
 * updowncounter
 */
static constexpr const char *kMetricOtelSdkExporterSpanInflightCount =
    "otel.sdk.exporter.span.inflight.count";
static constexpr const char *descrMetricOtelSdkExporterSpanInflightCount =
    "The number of spans which were passed to the exporter, but that have not been exported yet "
    "(neither successful, nor failed)";
static constexpr const char *unitMetricOtelSdkExporterSpanInflightCount = "{span}";

static inline nostd::unique_ptr<metrics::UpDownCounter<int64_t>>
CreateSyncInt64MetricOtelSdkExporterSpanInflightCount(metrics::Meter *meter)
{
  return meter->CreateInt64UpDownCounter(kMetricOtelSdkExporterSpanInflightCount,
                                         descrMetricOtelSdkExporterSpanInflightCount,
                                         unitMetricOtelSdkExporterSpanInflightCount);
}

static inline nostd::unique_ptr<metrics::UpDownCounter<double>>
CreateSyncDoubleMetricOtelSdkExporterSpanInflightCount(metrics::Meter *meter)
{
  return meter->CreateDoubleUpDownCounter(kMetricOtelSdkExporterSpanInflightCount,
                                          descrMetricOtelSdkExporterSpanInflightCount,
                                          unitMetricOtelSdkExporterSpanInflightCount);
}

static inline nostd::shared_ptr<metrics::ObservableInstrument>
CreateAsyncInt64MetricOtelSdkExporterSpanInflightCount(metrics::Meter *meter)
{
  return meter->CreateInt64ObservableUpDownCounter(kMetricOtelSdkExporterSpanInflightCount,
                                                   descrMetricOtelSdkExporterSpanInflightCount,
                                                   unitMetricOtelSdkExporterSpanInflightCount);
}

static inline nostd::shared_ptr<metrics::ObservableInstrument>
CreateAsyncDoubleMetricOtelSdkExporterSpanInflightCount(metrics::Meter *meter)
{
  return meter->CreateDoubleObservableUpDownCounter(kMetricOtelSdkExporterSpanInflightCount,
                                                    descrMetricOtelSdkExporterSpanInflightCount,
                                                    unitMetricOtelSdkExporterSpanInflightCount);
}

/**
 * The number of spans for which the processing has finished, either successful or failed
 * <p>
 * For successful processing, @code error.type @endcode MUST NOT be set. For failed processing,
 * @code error.type @endcode must contain the failure cause. For the SDK Simple and Batching Span
 * Processor a span is considered to be processed already when it has been submitted to the
 * exporter, not when the corresponding export call has finished. <p> counter
 */
static constexpr const char *kMetricOtelSdkProcessorSpanProcessedCount =
    "otel.sdk.processor.span.processed.count";
static constexpr const char *descrMetricOtelSdkProcessorSpanProcessedCount =
    "The number of spans for which the processing has finished, either successful or failed";
static constexpr const char *unitMetricOtelSdkProcessorSpanProcessedCount = "{span}";

static inline nostd::unique_ptr<metrics::Counter<uint64_t>>
CreateSyncInt64MetricOtelSdkProcessorSpanProcessedCount(metrics::Meter *meter)
{
  return meter->CreateUInt64Counter(kMetricOtelSdkProcessorSpanProcessedCount,
                                    descrMetricOtelSdkProcessorSpanProcessedCount,
                                    unitMetricOtelSdkProcessorSpanProcessedCount);
}

static inline nostd::unique_ptr<metrics::Counter<double>>
CreateSyncDoubleMetricOtelSdkProcessorSpanProcessedCount(metrics::Meter *meter)
{
  return meter->CreateDoubleCounter(kMetricOtelSdkProcessorSpanProcessedCount,
                                    descrMetricOtelSdkProcessorSpanProcessedCount,
                                    unitMetricOtelSdkProcessorSpanProcessedCount);
}

static inline nostd::shared_ptr<metrics::ObservableInstrument>
CreateAsyncInt64MetricOtelSdkProcessorSpanProcessedCount(metrics::Meter *meter)
{
  return meter->CreateInt64ObservableCounter(kMetricOtelSdkProcessorSpanProcessedCount,
                                             descrMetricOtelSdkProcessorSpanProcessedCount,
                                             unitMetricOtelSdkProcessorSpanProcessedCount);
}

static inline nostd::shared_ptr<metrics::ObservableInstrument>
CreateAsyncDoubleMetricOtelSdkProcessorSpanProcessedCount(metrics::Meter *meter)
{
  return meter->CreateDoubleObservableCounter(kMetricOtelSdkProcessorSpanProcessedCount,
                                              descrMetricOtelSdkProcessorSpanProcessedCount,
                                              unitMetricOtelSdkProcessorSpanProcessedCount);
}

/**
 * The maximum number of spans the queue of a given instance of an SDK span processor can hold
 * <p>
 * Only applies to span processors which use a queue, e.g. the SDK Batching Span Processor.
 * <p>
 * updowncounter
 */
static constexpr const char *kMetricOtelSdkProcessorSpanQueueCapacity =
    "otel.sdk.processor.span.queue.capacity";
static constexpr const char *descrMetricOtelSdkProcessorSpanQueueCapacity =
    "The maximum number of spans the queue of a given instance of an SDK span processor can hold";
static constexpr const char *unitMetricOtelSdkProcessorSpanQueueCapacity = "{span}";

static inline nostd::unique_ptr<metrics::UpDownCounter<int64_t>>
CreateSyncInt64MetricOtelSdkProcessorSpanQueueCapacity(metrics::Meter *meter)
{
  return meter->CreateInt64UpDownCounter(kMetricOtelSdkProcessorSpanQueueCapacity,
                                         descrMetricOtelSdkProcessorSpanQueueCapacity,
                                         unitMetricOtelSdkProcessorSpanQueueCapacity);
}

static inline nostd::unique_ptr<metrics::UpDownCounter<double>>
CreateSyncDoubleMetricOtelSdkProcessorSpanQueueCapacity(metrics::Meter *meter)
{
  return meter->CreateDoubleUpDownCounter(kMetricOtelSdkProcessorSpanQueueCapacity,
                                          descrMetricOtelSdkProcessorSpanQueueCapacity,
                                          unitMetricOtelSdkProcessorSpanQueueCapacity);
}

static inline nostd::shared_ptr<metrics::ObservableInstrument>
CreateAsyncInt64MetricOtelSdkProcessorSpanQueueCapacity(metrics::Meter *meter)
{
  return meter->CreateInt64ObservableUpDownCounter(kMetricOtelSdkProcessorSpanQueueCapacity,
                                                   descrMetricOtelSdkProcessorSpanQueueCapacity,
                                                   unitMetricOtelSdkProcessorSpanQueueCapacity);
}

static inline nostd::shared_ptr<metrics::ObservableInstrument>
CreateAsyncDoubleMetricOtelSdkProcessorSpanQueueCapacity(metrics::Meter *meter)
{
  return meter->CreateDoubleObservableUpDownCounter(kMetricOtelSdkProcessorSpanQueueCapacity,
                                                    descrMetricOtelSdkProcessorSpanQueueCapacity,
                                                    unitMetricOtelSdkProcessorSpanQueueCapacity);
}

/**
 * The number of spans in the queue of a given instance of an SDK span processor
 * <p>
 * Only applies to span processors which use a queue, e.g. the SDK Batching Span Processor.
 * <p>
 * updowncounter
 */
static constexpr const char *kMetricOtelSdkProcessorSpanQueueSize =
    "otel.sdk.processor.span.queue.size";
static constexpr const char *descrMetricOtelSdkProcessorSpanQueueSize =
    "The number of spans in the queue of a given instance of an SDK span processor";
static constexpr const char *unitMetricOtelSdkProcessorSpanQueueSize = "{span}";

static inline nostd::unique_ptr<metrics::UpDownCounter<int64_t>>
CreateSyncInt64MetricOtelSdkProcessorSpanQueueSize(metrics::Meter *meter)
{
  return meter->CreateInt64UpDownCounter(kMetricOtelSdkProcessorSpanQueueSize,
                                         descrMetricOtelSdkProcessorSpanQueueSize,
                                         unitMetricOtelSdkProcessorSpanQueueSize);
}

static inline nostd::unique_ptr<metrics::UpDownCounter<double>>
CreateSyncDoubleMetricOtelSdkProcessorSpanQueueSize(metrics::Meter *meter)
{
  return meter->CreateDoubleUpDownCounter(kMetricOtelSdkProcessorSpanQueueSize,
                                          descrMetricOtelSdkProcessorSpanQueueSize,
                                          unitMetricOtelSdkProcessorSpanQueueSize);
}

static inline nostd::shared_ptr<metrics::ObservableInstrument>
CreateAsyncInt64MetricOtelSdkProcessorSpanQueueSize(metrics::Meter *meter)
{
  return meter->CreateInt64ObservableUpDownCounter(kMetricOtelSdkProcessorSpanQueueSize,
                                                   descrMetricOtelSdkProcessorSpanQueueSize,
                                                   unitMetricOtelSdkProcessorSpanQueueSize);
}

static inline nostd::shared_ptr<metrics::ObservableInstrument>
CreateAsyncDoubleMetricOtelSdkProcessorSpanQueueSize(metrics::Meter *meter)
{
  return meter->CreateDoubleObservableUpDownCounter(kMetricOtelSdkProcessorSpanQueueSize,
                                                    descrMetricOtelSdkProcessorSpanQueueSize,
                                                    unitMetricOtelSdkProcessorSpanQueueSize);
}

/**
 * The number of created spans for which the end operation was called
 * <p>
 * For spans with @code recording=true @endcode: Implementations MUST record both @code
 * otel.sdk.span.live.count @endcode and @code otel.sdk.span.ended.count @endcode. For spans with
 * @code recording=false @endcode: If implementations decide to record this metric, they MUST also
 * record @code otel.sdk.span.live.count @endcode. <p> counter
 */
static constexpr const char *kMetricOtelSdkSpanEndedCount = "otel.sdk.span.ended.count";
static constexpr const char *descrMetricOtelSdkSpanEndedCount =
    "The number of created spans for which the end operation was called";
static constexpr const char *unitMetricOtelSdkSpanEndedCount = "{span}";

static inline nostd::unique_ptr<metrics::Counter<uint64_t>>
CreateSyncInt64MetricOtelSdkSpanEndedCount(metrics::Meter *meter)
{
  return meter->CreateUInt64Counter(kMetricOtelSdkSpanEndedCount, descrMetricOtelSdkSpanEndedCount,
                                    unitMetricOtelSdkSpanEndedCount);
}

static inline nostd::unique_ptr<metrics::Counter<double>>
CreateSyncDoubleMetricOtelSdkSpanEndedCount(metrics::Meter *meter)
{
  return meter->CreateDoubleCounter(kMetricOtelSdkSpanEndedCount, descrMetricOtelSdkSpanEndedCount,
                                    unitMetricOtelSdkSpanEndedCount);
}

static inline nostd::shared_ptr<metrics::ObservableInstrument>
CreateAsyncInt64MetricOtelSdkSpanEndedCount(metrics::Meter *meter)
{
  return meter->CreateInt64ObservableCounter(kMetricOtelSdkSpanEndedCount,
                                             descrMetricOtelSdkSpanEndedCount,
                                             unitMetricOtelSdkSpanEndedCount);
}

static inline nostd::shared_ptr<metrics::ObservableInstrument>
CreateAsyncDoubleMetricOtelSdkSpanEndedCount(metrics::Meter *meter)
{
  return meter->CreateDoubleObservableCounter(kMetricOtelSdkSpanEndedCount,
                                              descrMetricOtelSdkSpanEndedCount,
                                              unitMetricOtelSdkSpanEndedCount);
}

/**
 * The number of created spans for which the end operation has not been called yet
 * <p>
 * For spans with @code recording=true @endcode: Implementations MUST record both @code
 * otel.sdk.span.live.count @endcode and @code otel.sdk.span.ended.count @endcode. For spans with
 * @code recording=false @endcode: If implementations decide to record this metric, they MUST also
 * record @code otel.sdk.span.ended.count @endcode. <p> updowncounter
 */
static constexpr const char *kMetricOtelSdkSpanLiveCount = "otel.sdk.span.live.count";
static constexpr const char *descrMetricOtelSdkSpanLiveCount =
    "The number of created spans for which the end operation has not been called yet";
static constexpr const char *unitMetricOtelSdkSpanLiveCount = "{span}";

static inline nostd::unique_ptr<metrics::UpDownCounter<int64_t>>
CreateSyncInt64MetricOtelSdkSpanLiveCount(metrics::Meter *meter)
{
  return meter->CreateInt64UpDownCounter(
      kMetricOtelSdkSpanLiveCount, descrMetricOtelSdkSpanLiveCount, unitMetricOtelSdkSpanLiveCount);
}

static inline nostd::unique_ptr<metrics::UpDownCounter<double>>
CreateSyncDoubleMetricOtelSdkSpanLiveCount(metrics::Meter *meter)
{
  return meter->CreateDoubleUpDownCounter(
      kMetricOtelSdkSpanLiveCount, descrMetricOtelSdkSpanLiveCount, unitMetricOtelSdkSpanLiveCount);
}

static inline nostd::shared_ptr<metrics::ObservableInstrument>
CreateAsyncInt64MetricOtelSdkSpanLiveCount(metrics::Meter *meter)
{
  return meter->CreateInt64ObservableUpDownCounter(
      kMetricOtelSdkSpanLiveCount, descrMetricOtelSdkSpanLiveCount, unitMetricOtelSdkSpanLiveCount);
}

static inline nostd::shared_ptr<metrics::ObservableInstrument>
CreateAsyncDoubleMetricOtelSdkSpanLiveCount(metrics::Meter *meter)
{
  return meter->CreateDoubleObservableUpDownCounter(
      kMetricOtelSdkSpanLiveCount, descrMetricOtelSdkSpanLiveCount, unitMetricOtelSdkSpanLiveCount);
}

}  // namespace otel
}  // namespace semconv
OPENTELEMETRY_END_NAMESPACE