Skip to content

Commit 711625f

Browse files
authored
[CONFIGURATION] File configuration - metric aggregation model (#3502)
1 parent 0bbbdb1 commit 711625f

18 files changed

+451
-8
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright The OpenTelemetry Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
#pragma once
5+
6+
#include "opentelemetry/version.h"
7+
8+
OPENTELEMETRY_BEGIN_NAMESPACE
9+
namespace sdk
10+
{
11+
namespace configuration
12+
{
13+
class AggregationConfigurationVisitor;
14+
15+
// YAML-SCHEMA: schema/meter_provider.json
16+
// YAML-NODE: aggregation
17+
class AggregationConfiguration
18+
{
19+
public:
20+
AggregationConfiguration() = default;
21+
AggregationConfiguration(AggregationConfiguration &&) = default;
22+
AggregationConfiguration(const AggregationConfiguration &) = default;
23+
AggregationConfiguration &operator=(AggregationConfiguration &&) = default;
24+
AggregationConfiguration &operator=(const AggregationConfiguration &other) = default;
25+
virtual ~AggregationConfiguration() = default;
26+
27+
virtual void Accept(AggregationConfigurationVisitor *visitor) const = 0;
28+
};
29+
30+
} // namespace configuration
31+
} // namespace sdk
32+
OPENTELEMETRY_END_NAMESPACE
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Copyright The OpenTelemetry Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
#pragma once
5+
6+
#include "opentelemetry/version.h"
7+
8+
OPENTELEMETRY_BEGIN_NAMESPACE
9+
namespace sdk
10+
{
11+
namespace configuration
12+
{
13+
14+
class Base2ExponentialBucketHistogramAggregationConfiguration;
15+
class DefaultAggregationConfiguration;
16+
class DropAggregationConfiguration;
17+
class ExplicitBucketHistogramAggregationConfiguration;
18+
class LastValueAggregationConfiguration;
19+
class SumAggregationConfiguration;
20+
21+
class AggregationConfigurationVisitor
22+
{
23+
public:
24+
AggregationConfigurationVisitor() = default;
25+
AggregationConfigurationVisitor(AggregationConfigurationVisitor &&) = default;
26+
AggregationConfigurationVisitor(const AggregationConfigurationVisitor &) = default;
27+
AggregationConfigurationVisitor &operator=(AggregationConfigurationVisitor &&) = default;
28+
AggregationConfigurationVisitor &operator=(const AggregationConfigurationVisitor &other) =
29+
default;
30+
virtual ~AggregationConfigurationVisitor() = default;
31+
32+
virtual void VisitBase2ExponentialBucketHistogram(
33+
const Base2ExponentialBucketHistogramAggregationConfiguration *model) = 0;
34+
virtual void VisitDefault(const DefaultAggregationConfiguration *model) = 0;
35+
virtual void VisitDrop(const DropAggregationConfiguration *model) = 0;
36+
virtual void VisitExplicitBucketHistogram(
37+
const ExplicitBucketHistogramAggregationConfiguration *model) = 0;
38+
virtual void VisitLastValue(const LastValueAggregationConfiguration *model) = 0;
39+
virtual void VisitSum(const SumAggregationConfiguration *model) = 0;
40+
};
41+
42+
} // namespace configuration
43+
} // namespace sdk
44+
OPENTELEMETRY_END_NAMESPACE
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Copyright The OpenTelemetry Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
#pragma once
5+
6+
#include "opentelemetry/sdk/configuration/aggregation_configuration.h"
7+
#include "opentelemetry/sdk/configuration/aggregation_configuration_visitor.h"
8+
#include "opentelemetry/version.h"
9+
10+
OPENTELEMETRY_BEGIN_NAMESPACE
11+
namespace sdk
12+
{
13+
namespace configuration
14+
{
15+
16+
// YAML-SCHEMA: schema/meter_provider.json
17+
// YAML-NODE: base2_exponential_bucket_histogram
18+
class Base2ExponentialBucketHistogramAggregationConfiguration : public AggregationConfiguration
19+
{
20+
public:
21+
void Accept(AggregationConfigurationVisitor *visitor) const override
22+
{
23+
visitor->VisitBase2ExponentialBucketHistogram(this);
24+
}
25+
26+
std::size_t max_scale{0};
27+
std::size_t max_size{0};
28+
bool record_min_max{false};
29+
};
30+
31+
} // namespace configuration
32+
} // namespace sdk
33+
OPENTELEMETRY_END_NAMESPACE
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright The OpenTelemetry Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
#pragma once
5+
6+
#include "opentelemetry/sdk/configuration/aggregation_configuration.h"
7+
#include "opentelemetry/sdk/configuration/aggregation_configuration_visitor.h"
8+
#include "opentelemetry/version.h"
9+
10+
OPENTELEMETRY_BEGIN_NAMESPACE
11+
namespace sdk
12+
{
13+
namespace configuration
14+
{
15+
16+
// YAML-SCHEMA: schema/meter_provider.json
17+
// YAML-NODE: default
18+
class DefaultAggregationConfiguration : public AggregationConfiguration
19+
{
20+
public:
21+
void Accept(AggregationConfigurationVisitor *visitor) const override
22+
{
23+
visitor->VisitDefault(this);
24+
}
25+
};
26+
27+
} // namespace configuration
28+
} // namespace sdk
29+
OPENTELEMETRY_END_NAMESPACE
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright The OpenTelemetry Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
#pragma once
5+
6+
#include <cstdint>
7+
8+
#include "opentelemetry/version.h"
9+
10+
OPENTELEMETRY_BEGIN_NAMESPACE
11+
namespace sdk
12+
{
13+
namespace configuration
14+
{
15+
16+
// YAML-SCHEMA: schema/meter_provider.json
17+
// YAML-NODE: ExporterDefaultHistogramAggregation
18+
enum class DefaultHistogramAggregation : std::uint8_t
19+
{
20+
explicit_bucket_histogram,
21+
base2_exponential_bucket_histogram
22+
};
23+
24+
} // namespace configuration
25+
} // namespace sdk
26+
OPENTELEMETRY_END_NAMESPACE
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright The OpenTelemetry Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
#pragma once
5+
6+
#include "opentelemetry/sdk/configuration/aggregation_configuration.h"
7+
#include "opentelemetry/sdk/configuration/aggregation_configuration_visitor.h"
8+
#include "opentelemetry/version.h"
9+
10+
OPENTELEMETRY_BEGIN_NAMESPACE
11+
namespace sdk
12+
{
13+
namespace configuration
14+
{
15+
16+
// YAML-SCHEMA: schema/meter_provider.json
17+
// YAML-NODE: drop
18+
class DropAggregationConfiguration : public AggregationConfiguration
19+
{
20+
public:
21+
void Accept(AggregationConfigurationVisitor *visitor) const override { visitor->VisitDrop(this); }
22+
};
23+
24+
} // namespace configuration
25+
} // namespace sdk
26+
OPENTELEMETRY_END_NAMESPACE
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Copyright The OpenTelemetry Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
#pragma once
5+
6+
#include <vector>
7+
8+
#include "opentelemetry/sdk/configuration/aggregation_configuration.h"
9+
#include "opentelemetry/sdk/configuration/aggregation_configuration_visitor.h"
10+
#include "opentelemetry/version.h"
11+
12+
OPENTELEMETRY_BEGIN_NAMESPACE
13+
namespace sdk
14+
{
15+
namespace configuration
16+
{
17+
18+
// YAML-SCHEMA: schema/meter_provider.json
19+
// YAML-NODE: explicit_bucket_histogram
20+
class ExplicitBucketHistogramAggregationConfiguration : public AggregationConfiguration
21+
{
22+
public:
23+
void Accept(AggregationConfigurationVisitor *visitor) const override
24+
{
25+
visitor->VisitExplicitBucketHistogram(this);
26+
}
27+
28+
std::vector<double> boundaries;
29+
bool record_min_max{false};
30+
};
31+
32+
} // namespace configuration
33+
} // namespace sdk
34+
OPENTELEMETRY_END_NAMESPACE
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright The OpenTelemetry Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
#pragma once
5+
6+
#include <cstdint>
7+
8+
#include "opentelemetry/version.h"
9+
10+
OPENTELEMETRY_BEGIN_NAMESPACE
11+
namespace sdk
12+
{
13+
namespace configuration
14+
{
15+
16+
// YAML-SCHEMA: schema/meter_provider.json
17+
// YAML-NODE: InstrumentType
18+
enum class InstrumentType : std::uint8_t
19+
{
20+
counter,
21+
histogram,
22+
observable_counter,
23+
observable_gauge,
24+
observable_up_down_counter,
25+
up_down_counter
26+
};
27+
28+
} // namespace configuration
29+
} // namespace sdk
30+
OPENTELEMETRY_END_NAMESPACE
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright The OpenTelemetry Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
#pragma once
5+
6+
#include "opentelemetry/sdk/configuration/aggregation_configuration.h"
7+
#include "opentelemetry/sdk/configuration/aggregation_configuration_visitor.h"
8+
#include "opentelemetry/version.h"
9+
10+
OPENTELEMETRY_BEGIN_NAMESPACE
11+
namespace sdk
12+
{
13+
namespace configuration
14+
{
15+
16+
// YAML-SCHEMA: schema/meter_provider.json
17+
// YAML-NODE: last_value
18+
class LastValueAggregationConfiguration : public AggregationConfiguration
19+
{
20+
public:
21+
void Accept(AggregationConfigurationVisitor *visitor) const override
22+
{
23+
visitor->VisitLastValue(this);
24+
}
25+
};
26+
27+
} // namespace configuration
28+
} // namespace sdk
29+
OPENTELEMETRY_END_NAMESPACE
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright The OpenTelemetry Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
#pragma once
5+
6+
#include <memory>
7+
#include <vector>
8+
9+
#include "opentelemetry/sdk/configuration/metric_reader_configuration.h"
10+
#include "opentelemetry/sdk/configuration/view_configuration.h"
11+
#include "opentelemetry/version.h"
12+
13+
OPENTELEMETRY_BEGIN_NAMESPACE
14+
namespace sdk
15+
{
16+
namespace configuration
17+
{
18+
19+
// YAML-SCHEMA: schema/meter_provider.json
20+
// YAML-NODE: MeterProvider
21+
class MeterProviderConfiguration
22+
{
23+
public:
24+
std::vector<std::unique_ptr<MetricReaderConfiguration>> readers;
25+
std::vector<std::unique_ptr<ViewConfiguration>> views;
26+
// FIXME: exemplar_filter
27+
// FIXME: meter_configurator
28+
};
29+
30+
} // namespace configuration
31+
} // namespace sdk
32+
OPENTELEMETRY_END_NAMESPACE

0 commit comments

Comments
 (0)