Skip to content

Commit 854dbf0

Browse files
committed
[CONFIGURATION] File configuration - trace model
1 parent 545f9f4 commit 854dbf0

14 files changed

+521
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Copyright The OpenTelemetry Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
#pragma once
5+
6+
#include "opentelemetry/sdk/configuration/span_exporter_configuration.h"
7+
#include "opentelemetry/sdk/configuration/span_processor_configuration.h"
8+
#include "opentelemetry/sdk/configuration/span_processor_configuration_visitor.h"
9+
#include "opentelemetry/version.h"
10+
11+
OPENTELEMETRY_BEGIN_NAMESPACE
12+
namespace sdk
13+
{
14+
namespace configuration
15+
{
16+
17+
// YAML-SCHEMA: schema/tracer_provider.json
18+
// YAML-NODE: BatchSpanProcessor
19+
class BatchSpanProcessorConfiguration : public SpanProcessorConfiguration
20+
{
21+
public:
22+
BatchSpanProcessorConfiguration() = default;
23+
~BatchSpanProcessorConfiguration() override = default;
24+
25+
void Accept(SpanProcessorConfigurationVisitor *visitor) const override
26+
{
27+
visitor->VisitBatch(this);
28+
}
29+
30+
size_t schedule_delay{0};
31+
size_t export_timeout{0};
32+
size_t max_queue_size{0};
33+
size_t max_export_batch_size{0};
34+
std::unique_ptr<SpanExporterConfiguration> exporter;
35+
};
36+
37+
} // namespace configuration
38+
} // namespace sdk
39+
OPENTELEMETRY_END_NAMESPACE
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
// Copyright The OpenTelemetry Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
#pragma once
5+
6+
#include <string>
7+
8+
#include "opentelemetry/sdk/configuration/attribute_limits_configuration.h"
9+
#include "opentelemetry/sdk/configuration/document.h"
10+
#include "opentelemetry/sdk/configuration/logger_provider_configuration.h"
11+
#include "opentelemetry/sdk/configuration/meter_provider_configuration.h"
12+
#include "opentelemetry/sdk/configuration/propagator_configuration.h"
13+
#include "opentelemetry/sdk/configuration/resource_configuration.h"
14+
#include "opentelemetry/sdk/configuration/tracer_provider_configuration.h"
15+
#include "opentelemetry/version.h"
16+
17+
/*
18+
* General notes about configuration classes.
19+
*
20+
* Each Yaml node that exists in the yaml schema,
21+
* as defined by https://github.com/open-telemetry/opentelemetry-configuration
22+
* is represented by a C++ class.
23+
* Special comments are used to relate the C++ class to
24+
* the Yaml node it represents.
25+
*
26+
* YAML-SCHEMA: points to the relevant file within the
27+
* opentelemetry-configuration repository
28+
* YAML-NODE: points to the relevant node within the file.
29+
*
30+
* For example,
31+
* C++ class opentelemetry::sdk::configuration::Configuration
32+
* corresponds to
33+
* Yaml node OpenTelemetryConfiguration,
34+
* in file
35+
* https://github.com/open-telemetry/opentelemetry-configuration/blob/main/schema/opentelemetry_configuration.json
36+
*/
37+
38+
OPENTELEMETRY_BEGIN_NAMESPACE
39+
namespace sdk
40+
{
41+
namespace configuration
42+
{
43+
44+
// YAML-SCHEMA: schema/opentelemetry_configuration.json
45+
// YAML-NODE: OpenTelemetryConfiguration
46+
class Configuration
47+
{
48+
public:
49+
Configuration(std::unique_ptr<Document> doc) : m_doc(std::move(doc)) {}
50+
~Configuration() = default;
51+
52+
std::string file_format;
53+
bool disabled{false};
54+
std::string log_level;
55+
56+
std::unique_ptr<AttributeLimitsConfiguration> attribute_limits;
57+
std::unique_ptr<LoggerProviderConfiguration> logger_provider;
58+
std::unique_ptr<MeterProviderConfiguration> meter_provider;
59+
std::unique_ptr<PropagatorConfiguration> propagator;
60+
std::unique_ptr<TracerProviderConfiguration> tracer_provider;
61+
std::unique_ptr<ResourceConfiguration> resource;
62+
// Ignored: instrumentation
63+
64+
private:
65+
std::unique_ptr<Document> m_doc;
66+
};
67+
68+
} // namespace configuration
69+
} // namespace sdk
70+
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 "opentelemetry/sdk/configuration/span_exporter_configuration.h"
7+
#include "opentelemetry/sdk/configuration/span_exporter_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/common.json
17+
// YAML-NODE: Console
18+
class ConsoleSpanExporterConfiguration : public SpanExporterConfiguration
19+
{
20+
public:
21+
ConsoleSpanExporterConfiguration() = default;
22+
~ConsoleSpanExporterConfiguration() override = default;
23+
24+
void Accept(SpanExporterConfigurationVisitor *visitor) const override
25+
{
26+
visitor->VisitConsole(this);
27+
}
28+
};
29+
30+
} // namespace configuration
31+
} // namespace sdk
32+
OPENTELEMETRY_END_NAMESPACE
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright The OpenTelemetry Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
#pragma once
5+
6+
#include "opentelemetry/sdk/configuration/span_exporter_configuration.h"
7+
#include "opentelemetry/sdk/configuration/span_exporter_configuration_visitor.h"
8+
#include "opentelemetry/version.h"
9+
10+
#include <string>
11+
12+
OPENTELEMETRY_BEGIN_NAMESPACE
13+
namespace sdk
14+
{
15+
namespace configuration
16+
{
17+
18+
// YAML-SCHEMA: schema/common.json
19+
// YAML-NODE: ExperimentalOtlpFileExporter
20+
class OtlpFileSpanExporterConfiguration : public SpanExporterConfiguration
21+
{
22+
public:
23+
OtlpFileSpanExporterConfiguration() = default;
24+
~OtlpFileSpanExporterConfiguration() override = default;
25+
26+
void Accept(SpanExporterConfigurationVisitor *visitor) const override
27+
{
28+
visitor->VisitOtlpFile(this);
29+
}
30+
31+
std::string output_stream;
32+
};
33+
34+
} // namespace configuration
35+
} // namespace sdk
36+
OPENTELEMETRY_END_NAMESPACE
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Copyright The OpenTelemetry Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
#pragma once
5+
6+
#include "opentelemetry/sdk/configuration/headers_configuration.h"
7+
#include "opentelemetry/sdk/configuration/span_exporter_configuration.h"
8+
#include "opentelemetry/sdk/configuration/span_exporter_configuration_visitor.h"
9+
#include "opentelemetry/version.h"
10+
11+
OPENTELEMETRY_BEGIN_NAMESPACE
12+
namespace sdk
13+
{
14+
namespace configuration
15+
{
16+
17+
// YAML-SCHEMA: schema/common.json
18+
// YAML-NODE: OtlpGrpcExporter
19+
class OtlpGrpcSpanExporterConfiguration : public SpanExporterConfiguration
20+
{
21+
public:
22+
OtlpGrpcSpanExporterConfiguration() = default;
23+
~OtlpGrpcSpanExporterConfiguration() override = default;
24+
25+
void Accept(SpanExporterConfigurationVisitor *visitor) const override
26+
{
27+
visitor->VisitOtlpGrpc(this);
28+
}
29+
30+
std::string endpoint;
31+
std::string certificate_file;
32+
std::string client_key_file;
33+
std::string client_certificate_file;
34+
std::unique_ptr<HeadersConfiguration> headers;
35+
std::string headers_list;
36+
std::string compression;
37+
size_t timeout{0};
38+
bool insecure{false};
39+
};
40+
41+
} // namespace configuration
42+
} // namespace sdk
43+
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/sdk/configuration/headers_configuration.h"
7+
#include "opentelemetry/sdk/configuration/otlp_http_encoding.h"
8+
#include "opentelemetry/sdk/configuration/span_exporter_configuration.h"
9+
#include "opentelemetry/sdk/configuration/span_exporter_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/common.json
19+
// YAML-NODE: OtlpHttpExporter
20+
class OtlpHttpSpanExporterConfiguration : public SpanExporterConfiguration
21+
{
22+
public:
23+
OtlpHttpSpanExporterConfiguration() = default;
24+
~OtlpHttpSpanExporterConfiguration() override = default;
25+
26+
void Accept(SpanExporterConfigurationVisitor *visitor) const override
27+
{
28+
visitor->VisitOtlpHttp(this);
29+
}
30+
31+
std::string endpoint;
32+
std::string certificate_file;
33+
std::string client_key_file;
34+
std::string client_certificate_file;
35+
std::unique_ptr<HeadersConfiguration> headers;
36+
std::string headers_list;
37+
std::string compression;
38+
size_t timeout{0};
39+
enum_otlp_http_encoding encoding{protobuf};
40+
};
41+
42+
} // namespace configuration
43+
} // namespace sdk
44+
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 "opentelemetry/sdk/configuration/span_processor_configuration.h"
7+
#include "opentelemetry/sdk/configuration/span_processor_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/tracer_provider.json
17+
// YAML-NODE: SimpleSpanProcessor
18+
class SimpleSpanProcessorConfiguration : public SpanProcessorConfiguration
19+
{
20+
public:
21+
SimpleSpanProcessorConfiguration() = default;
22+
~SimpleSpanProcessorConfiguration() override = default;
23+
24+
void Accept(SpanProcessorConfigurationVisitor *visitor) const override
25+
{
26+
visitor->VisitSimple(this);
27+
}
28+
29+
std::unique_ptr<SpanExporterConfiguration> exporter;
30+
};
31+
32+
} // namespace configuration
33+
} // namespace sdk
34+
OPENTELEMETRY_END_NAMESPACE
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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 SpanExporterConfigurationVisitor;
14+
15+
// YAML-SCHEMA: schema/tracer_provider.json
16+
// YAML-NODE: SpanExporter
17+
class SpanExporterConfiguration
18+
{
19+
public:
20+
SpanExporterConfiguration() = default;
21+
virtual ~SpanExporterConfiguration() = default;
22+
23+
virtual void Accept(SpanExporterConfigurationVisitor *visitor) const = 0;
24+
};
25+
26+
} // namespace configuration
27+
} // namespace sdk
28+
OPENTELEMETRY_END_NAMESPACE
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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 OtlpHttpSpanExporterConfiguration;
15+
class OtlpGrpcSpanExporterConfiguration;
16+
class OtlpFileSpanExporterConfiguration;
17+
class ConsoleSpanExporterConfiguration;
18+
class ZipkinSpanExporterConfiguration;
19+
class ExtensionSpanExporterConfiguration;
20+
21+
class SpanExporterConfigurationVisitor
22+
{
23+
public:
24+
SpanExporterConfigurationVisitor() = default;
25+
virtual ~SpanExporterConfigurationVisitor() = default;
26+
27+
virtual void VisitOtlpHttp(const OtlpHttpSpanExporterConfiguration *model) = 0;
28+
virtual void VisitOtlpGrpc(const OtlpGrpcSpanExporterConfiguration *model) = 0;
29+
virtual void VisitOtlpFile(const OtlpFileSpanExporterConfiguration *model) = 0;
30+
virtual void VisitConsole(const ConsoleSpanExporterConfiguration *model) = 0;
31+
virtual void VisitZipkin(const ZipkinSpanExporterConfiguration *model) = 0;
32+
virtual void VisitExtension(const ExtensionSpanExporterConfiguration *model) = 0;
33+
};
34+
35+
} // namespace configuration
36+
} // namespace sdk
37+
OPENTELEMETRY_END_NAMESPACE

0 commit comments

Comments
 (0)