File: vcs_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 (435 lines) | stat: -rw-r--r-- 17,942 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
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
/*
 * 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 vcs
{

/**
 * The number of changes (pull requests/merge requests/changelists) in a repository, categorized by
 * their state (e.g. open or merged) <p> updowncounter
 */
static constexpr const char *kMetricVcsChangeCount = "vcs.change.count";
static constexpr const char *descrMetricVcsChangeCount =
    "The number of changes (pull requests/merge requests/changelists) in a repository, categorized "
    "by their state (e.g. open or merged)";
static constexpr const char *unitMetricVcsChangeCount = "{change}";

static inline nostd::unique_ptr<metrics::UpDownCounter<int64_t>>
CreateSyncInt64MetricVcsChangeCount(metrics::Meter *meter)
{
  return meter->CreateInt64UpDownCounter(kMetricVcsChangeCount, descrMetricVcsChangeCount,
                                         unitMetricVcsChangeCount);
}

static inline nostd::unique_ptr<metrics::UpDownCounter<double>>
CreateSyncDoubleMetricVcsChangeCount(metrics::Meter *meter)
{
  return meter->CreateDoubleUpDownCounter(kMetricVcsChangeCount, descrMetricVcsChangeCount,
                                          unitMetricVcsChangeCount);
}

static inline nostd::shared_ptr<metrics::ObservableInstrument> CreateAsyncInt64MetricVcsChangeCount(
    metrics::Meter *meter)
{
  return meter->CreateInt64ObservableUpDownCounter(kMetricVcsChangeCount, descrMetricVcsChangeCount,
                                                   unitMetricVcsChangeCount);
}

static inline nostd::shared_ptr<metrics::ObservableInstrument>
CreateAsyncDoubleMetricVcsChangeCount(metrics::Meter *meter)
{
  return meter->CreateDoubleObservableUpDownCounter(
      kMetricVcsChangeCount, descrMetricVcsChangeCount, unitMetricVcsChangeCount);
}

/**
 * The time duration a change (pull request/merge request/changelist) has been in a given state.
 * <p>
 * gauge
 */
static constexpr const char *kMetricVcsChangeDuration = "vcs.change.duration";
static constexpr const char *descrMetricVcsChangeDuration =
    "The time duration a change (pull request/merge request/changelist) has been in a given state.";
static constexpr const char *unitMetricVcsChangeDuration = "s";

#if OPENTELEMETRY_ABI_VERSION_NO >= 2

static inline nostd::unique_ptr<metrics::Gauge<int64_t>> CreateSyncInt64MetricVcsChangeDuration(
    metrics::Meter *meter)
{
  return meter->CreateInt64Gauge(kMetricVcsChangeDuration, descrMetricVcsChangeDuration,
                                 unitMetricVcsChangeDuration);
}

static inline nostd::unique_ptr<metrics::Gauge<double>> CreateSyncDoubleMetricVcsChangeDuration(
    metrics::Meter *meter)
{
  return meter->CreateDoubleGauge(kMetricVcsChangeDuration, descrMetricVcsChangeDuration,
                                  unitMetricVcsChangeDuration);
}
#endif /* OPENTELEMETRY_ABI_VERSION_NO */

static inline nostd::shared_ptr<metrics::ObservableInstrument>
CreateAsyncInt64MetricVcsChangeDuration(metrics::Meter *meter)
{
  return meter->CreateInt64ObservableGauge(kMetricVcsChangeDuration, descrMetricVcsChangeDuration,
                                           unitMetricVcsChangeDuration);
}

static inline nostd::shared_ptr<metrics::ObservableInstrument>
CreateAsyncDoubleMetricVcsChangeDuration(metrics::Meter *meter)
{
  return meter->CreateDoubleObservableGauge(kMetricVcsChangeDuration, descrMetricVcsChangeDuration,
                                            unitMetricVcsChangeDuration);
}

/**
 * The amount of time since its creation it took a change (pull request/merge request/changelist) to
 * get the first approval. <p> gauge
 */
static constexpr const char *kMetricVcsChangeTimeToApproval = "vcs.change.time_to_approval";
static constexpr const char *descrMetricVcsChangeTimeToApproval =
    "The amount of time since its creation it took a change (pull request/merge "
    "request/changelist) to get the first approval.";
static constexpr const char *unitMetricVcsChangeTimeToApproval = "s";

#if OPENTELEMETRY_ABI_VERSION_NO >= 2

static inline nostd::unique_ptr<metrics::Gauge<int64_t>>
CreateSyncInt64MetricVcsChangeTimeToApproval(metrics::Meter *meter)
{
  return meter->CreateInt64Gauge(kMetricVcsChangeTimeToApproval, descrMetricVcsChangeTimeToApproval,
                                 unitMetricVcsChangeTimeToApproval);
}

static inline nostd::unique_ptr<metrics::Gauge<double>>
CreateSyncDoubleMetricVcsChangeTimeToApproval(metrics::Meter *meter)
{
  return meter->CreateDoubleGauge(kMetricVcsChangeTimeToApproval,
                                  descrMetricVcsChangeTimeToApproval,
                                  unitMetricVcsChangeTimeToApproval);
}
#endif /* OPENTELEMETRY_ABI_VERSION_NO */

static inline nostd::shared_ptr<metrics::ObservableInstrument>
CreateAsyncInt64MetricVcsChangeTimeToApproval(metrics::Meter *meter)
{
  return meter->CreateInt64ObservableGauge(kMetricVcsChangeTimeToApproval,
                                           descrMetricVcsChangeTimeToApproval,
                                           unitMetricVcsChangeTimeToApproval);
}

static inline nostd::shared_ptr<metrics::ObservableInstrument>
CreateAsyncDoubleMetricVcsChangeTimeToApproval(metrics::Meter *meter)
{
  return meter->CreateDoubleObservableGauge(kMetricVcsChangeTimeToApproval,
                                            descrMetricVcsChangeTimeToApproval,
                                            unitMetricVcsChangeTimeToApproval);
}

/**
 * The amount of time since its creation it took a change (pull request/merge request/changelist) to
 * get merged into the target(base) ref. <p> gauge
 */
static constexpr const char *kMetricVcsChangeTimeToMerge = "vcs.change.time_to_merge";
static constexpr const char *descrMetricVcsChangeTimeToMerge =
    "The amount of time since its creation it took a change (pull request/merge "
    "request/changelist) to get merged into the target(base) ref.";
static constexpr const char *unitMetricVcsChangeTimeToMerge = "s";

#if OPENTELEMETRY_ABI_VERSION_NO >= 2

static inline nostd::unique_ptr<metrics::Gauge<int64_t>> CreateSyncInt64MetricVcsChangeTimeToMerge(
    metrics::Meter *meter)
{
  return meter->CreateInt64Gauge(kMetricVcsChangeTimeToMerge, descrMetricVcsChangeTimeToMerge,
                                 unitMetricVcsChangeTimeToMerge);
}

static inline nostd::unique_ptr<metrics::Gauge<double>> CreateSyncDoubleMetricVcsChangeTimeToMerge(
    metrics::Meter *meter)
{
  return meter->CreateDoubleGauge(kMetricVcsChangeTimeToMerge, descrMetricVcsChangeTimeToMerge,
                                  unitMetricVcsChangeTimeToMerge);
}
#endif /* OPENTELEMETRY_ABI_VERSION_NO */

static inline nostd::shared_ptr<metrics::ObservableInstrument>
CreateAsyncInt64MetricVcsChangeTimeToMerge(metrics::Meter *meter)
{
  return meter->CreateInt64ObservableGauge(
      kMetricVcsChangeTimeToMerge, descrMetricVcsChangeTimeToMerge, unitMetricVcsChangeTimeToMerge);
}

static inline nostd::shared_ptr<metrics::ObservableInstrument>
CreateAsyncDoubleMetricVcsChangeTimeToMerge(metrics::Meter *meter)
{
  return meter->CreateDoubleObservableGauge(
      kMetricVcsChangeTimeToMerge, descrMetricVcsChangeTimeToMerge, unitMetricVcsChangeTimeToMerge);
}

/**
 * The number of unique contributors to a repository
 * <p>
 * gauge
 */
static constexpr const char *kMetricVcsContributorCount = "vcs.contributor.count";
static constexpr const char *descrMetricVcsContributorCount =
    "The number of unique contributors to a repository";
static constexpr const char *unitMetricVcsContributorCount = "{contributor}";

#if OPENTELEMETRY_ABI_VERSION_NO >= 2

static inline nostd::unique_ptr<metrics::Gauge<int64_t>> CreateSyncInt64MetricVcsContributorCount(
    metrics::Meter *meter)
{
  return meter->CreateInt64Gauge(kMetricVcsContributorCount, descrMetricVcsContributorCount,
                                 unitMetricVcsContributorCount);
}

static inline nostd::unique_ptr<metrics::Gauge<double>> CreateSyncDoubleMetricVcsContributorCount(
    metrics::Meter *meter)
{
  return meter->CreateDoubleGauge(kMetricVcsContributorCount, descrMetricVcsContributorCount,
                                  unitMetricVcsContributorCount);
}
#endif /* OPENTELEMETRY_ABI_VERSION_NO */

static inline nostd::shared_ptr<metrics::ObservableInstrument>
CreateAsyncInt64MetricVcsContributorCount(metrics::Meter *meter)
{
  return meter->CreateInt64ObservableGauge(
      kMetricVcsContributorCount, descrMetricVcsContributorCount, unitMetricVcsContributorCount);
}

static inline nostd::shared_ptr<metrics::ObservableInstrument>
CreateAsyncDoubleMetricVcsContributorCount(metrics::Meter *meter)
{
  return meter->CreateDoubleObservableGauge(
      kMetricVcsContributorCount, descrMetricVcsContributorCount, unitMetricVcsContributorCount);
}

/**
 * The number of refs of type branch or tag in a repository.
 * <p>
 * updowncounter
 */
static constexpr const char *kMetricVcsRefCount = "vcs.ref.count";
static constexpr const char *descrMetricVcsRefCount =
    "The number of refs of type branch or tag in a repository.";
static constexpr const char *unitMetricVcsRefCount = "{ref}";

static inline nostd::unique_ptr<metrics::UpDownCounter<int64_t>> CreateSyncInt64MetricVcsRefCount(
    metrics::Meter *meter)
{
  return meter->CreateInt64UpDownCounter(kMetricVcsRefCount, descrMetricVcsRefCount,
                                         unitMetricVcsRefCount);
}

static inline nostd::unique_ptr<metrics::UpDownCounter<double>> CreateSyncDoubleMetricVcsRefCount(
    metrics::Meter *meter)
{
  return meter->CreateDoubleUpDownCounter(kMetricVcsRefCount, descrMetricVcsRefCount,
                                          unitMetricVcsRefCount);
}

static inline nostd::shared_ptr<metrics::ObservableInstrument> CreateAsyncInt64MetricVcsRefCount(
    metrics::Meter *meter)
{
  return meter->CreateInt64ObservableUpDownCounter(kMetricVcsRefCount, descrMetricVcsRefCount,
                                                   unitMetricVcsRefCount);
}

static inline nostd::shared_ptr<metrics::ObservableInstrument> CreateAsyncDoubleMetricVcsRefCount(
    metrics::Meter *meter)
{
  return meter->CreateDoubleObservableUpDownCounter(kMetricVcsRefCount, descrMetricVcsRefCount,
                                                    unitMetricVcsRefCount);
}

/**
 * The number of lines added/removed in a ref (branch) relative to the ref from the @code
 * vcs.ref.base.name @endcode attribute. <p> This metric should be reported for each @code
 * vcs.line_change.type @endcode value. For example if a ref added 3 lines and removed 2 lines,
 * instrumentation SHOULD report two measurements: 3 and 2 (both positive numbers).
 * If number of lines added/removed should be calculated from the start of time, then @code
 * vcs.ref.base.name @endcode SHOULD be set to an empty string. <p> gauge
 */
static constexpr const char *kMetricVcsRefLinesDelta = "vcs.ref.lines_delta";
static constexpr const char *descrMetricVcsRefLinesDelta =
    "The number of lines added/removed in a ref (branch) relative to the ref from the "
    "`vcs.ref.base.name` attribute.";
static constexpr const char *unitMetricVcsRefLinesDelta = "{line}";

#if OPENTELEMETRY_ABI_VERSION_NO >= 2

static inline nostd::unique_ptr<metrics::Gauge<int64_t>> CreateSyncInt64MetricVcsRefLinesDelta(
    metrics::Meter *meter)
{
  return meter->CreateInt64Gauge(kMetricVcsRefLinesDelta, descrMetricVcsRefLinesDelta,
                                 unitMetricVcsRefLinesDelta);
}

static inline nostd::unique_ptr<metrics::Gauge<double>> CreateSyncDoubleMetricVcsRefLinesDelta(
    metrics::Meter *meter)
{
  return meter->CreateDoubleGauge(kMetricVcsRefLinesDelta, descrMetricVcsRefLinesDelta,
                                  unitMetricVcsRefLinesDelta);
}
#endif /* OPENTELEMETRY_ABI_VERSION_NO */

static inline nostd::shared_ptr<metrics::ObservableInstrument>
CreateAsyncInt64MetricVcsRefLinesDelta(metrics::Meter *meter)
{
  return meter->CreateInt64ObservableGauge(kMetricVcsRefLinesDelta, descrMetricVcsRefLinesDelta,
                                           unitMetricVcsRefLinesDelta);
}

static inline nostd::shared_ptr<metrics::ObservableInstrument>
CreateAsyncDoubleMetricVcsRefLinesDelta(metrics::Meter *meter)
{
  return meter->CreateDoubleObservableGauge(kMetricVcsRefLinesDelta, descrMetricVcsRefLinesDelta,
                                            unitMetricVcsRefLinesDelta);
}

/**
 * The number of revisions (commits) a ref (branch) is ahead/behind the branch from the @code
 * vcs.ref.base.name @endcode attribute <p> This metric should be reported for each @code
 * vcs.revision_delta.direction @endcode value. For example if branch @code a @endcode is 3 commits
 * behind and 2 commits ahead of @code trunk @endcode, instrumentation SHOULD report two
 * measurements: 3 and 2 (both positive numbers) and @code vcs.ref.base.name @endcode is set to
 * @code trunk @endcode. <p> gauge
 */
static constexpr const char *kMetricVcsRefRevisionsDelta = "vcs.ref.revisions_delta";
static constexpr const char *descrMetricVcsRefRevisionsDelta =
    "The number of revisions (commits) a ref (branch) is ahead/behind the branch from the "
    "`vcs.ref.base.name` attribute";
static constexpr const char *unitMetricVcsRefRevisionsDelta = "{revision}";

#if OPENTELEMETRY_ABI_VERSION_NO >= 2

static inline nostd::unique_ptr<metrics::Gauge<int64_t>> CreateSyncInt64MetricVcsRefRevisionsDelta(
    metrics::Meter *meter)
{
  return meter->CreateInt64Gauge(kMetricVcsRefRevisionsDelta, descrMetricVcsRefRevisionsDelta,
                                 unitMetricVcsRefRevisionsDelta);
}

static inline nostd::unique_ptr<metrics::Gauge<double>> CreateSyncDoubleMetricVcsRefRevisionsDelta(
    metrics::Meter *meter)
{
  return meter->CreateDoubleGauge(kMetricVcsRefRevisionsDelta, descrMetricVcsRefRevisionsDelta,
                                  unitMetricVcsRefRevisionsDelta);
}
#endif /* OPENTELEMETRY_ABI_VERSION_NO */

static inline nostd::shared_ptr<metrics::ObservableInstrument>
CreateAsyncInt64MetricVcsRefRevisionsDelta(metrics::Meter *meter)
{
  return meter->CreateInt64ObservableGauge(
      kMetricVcsRefRevisionsDelta, descrMetricVcsRefRevisionsDelta, unitMetricVcsRefRevisionsDelta);
}

static inline nostd::shared_ptr<metrics::ObservableInstrument>
CreateAsyncDoubleMetricVcsRefRevisionsDelta(metrics::Meter *meter)
{
  return meter->CreateDoubleObservableGauge(
      kMetricVcsRefRevisionsDelta, descrMetricVcsRefRevisionsDelta, unitMetricVcsRefRevisionsDelta);
}

/**
 * Time a ref (branch) created from the default branch (trunk) has existed. The @code ref.type
 * @endcode attribute will always be @code branch @endcode <p> gauge
 */
static constexpr const char *kMetricVcsRefTime = "vcs.ref.time";
static constexpr const char *descrMetricVcsRefTime =
    "Time a ref (branch) created from the default branch (trunk) has existed. The `ref.type` "
    "attribute will always be `branch`";
static constexpr const char *unitMetricVcsRefTime = "s";

#if OPENTELEMETRY_ABI_VERSION_NO >= 2

static inline nostd::unique_ptr<metrics::Gauge<int64_t>> CreateSyncInt64MetricVcsRefTime(
    metrics::Meter *meter)
{
  return meter->CreateInt64Gauge(kMetricVcsRefTime, descrMetricVcsRefTime, unitMetricVcsRefTime);
}

static inline nostd::unique_ptr<metrics::Gauge<double>> CreateSyncDoubleMetricVcsRefTime(
    metrics::Meter *meter)
{
  return meter->CreateDoubleGauge(kMetricVcsRefTime, descrMetricVcsRefTime, unitMetricVcsRefTime);
}
#endif /* OPENTELEMETRY_ABI_VERSION_NO */

static inline nostd::shared_ptr<metrics::ObservableInstrument> CreateAsyncInt64MetricVcsRefTime(
    metrics::Meter *meter)
{
  return meter->CreateInt64ObservableGauge(kMetricVcsRefTime, descrMetricVcsRefTime,
                                           unitMetricVcsRefTime);
}

static inline nostd::shared_ptr<metrics::ObservableInstrument> CreateAsyncDoubleMetricVcsRefTime(
    metrics::Meter *meter)
{
  return meter->CreateDoubleObservableGauge(kMetricVcsRefTime, descrMetricVcsRefTime,
                                            unitMetricVcsRefTime);
}

/**
 * The number of repositories in an organization.
 * <p>
 * updowncounter
 */
static constexpr const char *kMetricVcsRepositoryCount = "vcs.repository.count";
static constexpr const char *descrMetricVcsRepositoryCount =
    "The number of repositories in an organization.";
static constexpr const char *unitMetricVcsRepositoryCount = "{repository}";

static inline nostd::unique_ptr<metrics::UpDownCounter<int64_t>>
CreateSyncInt64MetricVcsRepositoryCount(metrics::Meter *meter)
{
  return meter->CreateInt64UpDownCounter(kMetricVcsRepositoryCount, descrMetricVcsRepositoryCount,
                                         unitMetricVcsRepositoryCount);
}

static inline nostd::unique_ptr<metrics::UpDownCounter<double>>
CreateSyncDoubleMetricVcsRepositoryCount(metrics::Meter *meter)
{
  return meter->CreateDoubleUpDownCounter(kMetricVcsRepositoryCount, descrMetricVcsRepositoryCount,
                                          unitMetricVcsRepositoryCount);
}

static inline nostd::shared_ptr<metrics::ObservableInstrument>
CreateAsyncInt64MetricVcsRepositoryCount(metrics::Meter *meter)
{
  return meter->CreateInt64ObservableUpDownCounter(
      kMetricVcsRepositoryCount, descrMetricVcsRepositoryCount, unitMetricVcsRepositoryCount);
}

static inline nostd::shared_ptr<metrics::ObservableInstrument>
CreateAsyncDoubleMetricVcsRepositoryCount(metrics::Meter *meter)
{
  return meter->CreateDoubleObservableUpDownCounter(
      kMetricVcsRepositoryCount, descrMetricVcsRepositoryCount, unitMetricVcsRepositoryCount);
}

}  // namespace vcs
}  // namespace semconv
OPENTELEMETRY_END_NAMESPACE