summaryrefslogtreecommitdiffstats
path: root/src/jaegertracing/opentelemetry-cpp/sdk/include/opentelemetry/sdk/metrics/exemplar/filter.h
blob: 4b512e13171531f4d75a126b6e2570e8957eca45 (plain)
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
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

#pragma once
#ifndef ENABLE_METRICS_PREVIEW
#  include "opentelemetry/context/context.h"
#  include "opentelemetry/sdk/common/attribute_utils.h"

OPENTELEMETRY_BEGIN_NAMESPACE
namespace sdk
{
namespace metrics
{
using MetricAttributes = opentelemetry::sdk::common::OrderedAttributeMap;

/**
 * Exemplar filters are used to pre-filter measurements before attempting to store them in a
 * reservoir.
 */
class ExemplarFilter
{
public:
  // Returns whether or not a reservoir should attempt to filter a measurement.
  virtual bool ShouldSampleMeasurement(long value,
                                       const MetricAttributes &attributes,
                                       const opentelemetry::context::Context &context) noexcept = 0;

  // Returns whether or not a reservoir should attempt to filter a measurement.
  virtual bool ShouldSampleMeasurement(double value,
                                       const MetricAttributes &attributes,
                                       const opentelemetry::context::Context &context) noexcept = 0;

  virtual ~ExemplarFilter() = default;
};

}  // namespace metrics
}  // namespace sdk
OPENTELEMETRY_END_NAMESPACE
#endif