File tree Expand file tree Collapse file tree 3 files changed +87
-2
lines changed
include/opentelemetry/exporters/zipkin Expand file tree Collapse file tree 3 files changed +87
-2
lines changed Original file line number Diff line number Diff line change
1
+ // Copyright The OpenTelemetry Authors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ #pragma once
5
+
6
+ #include < memory>
7
+
8
+ #include " opentelemetry/sdk/configuration/registry.h"
9
+ #include " opentelemetry/sdk/configuration/zipkin_span_exporter_builder.h"
10
+ #include " opentelemetry/sdk/configuration/zipkin_span_exporter_configuration.h"
11
+ #include " opentelemetry/sdk/trace/exporter.h"
12
+ #include " opentelemetry/version.h"
13
+
14
+ OPENTELEMETRY_BEGIN_NAMESPACE
15
+ namespace exporter
16
+ {
17
+ namespace zipkin
18
+ {
19
+
20
+ class OPENTELEMETRY_EXPORT ZipkinBuilder
21
+ : public opentelemetry::sdk::configuration::ZipkinSpanExporterBuilder
22
+ {
23
+ public:
24
+ static void Register (opentelemetry::sdk::configuration::Registry *registry);
25
+
26
+ ZipkinBuilder () = default ;
27
+ ~ZipkinBuilder () override = default ;
28
+
29
+ std::unique_ptr<opentelemetry::sdk::trace::SpanExporter> Build (
30
+ const opentelemetry::sdk::configuration::ZipkinSpanExporterConfiguration *model)
31
+ const override ;
32
+ };
33
+
34
+ } // namespace zipkin
35
+ } // namespace exporter
36
+ OPENTELEMETRY_END_NAMESPACE
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ namespace exporter
13
13
namespace zipkin
14
14
{
15
15
16
+ // The endpoint to export to. By default the OpenTelemetry Collector's default endpoint.
16
17
inline const std::string GetDefaultZipkinEndpoint ()
17
18
{
18
19
const char *otel_exporter_zipkin_endpoint_env = " OTEL_EXPORTER_ZIPKIN_ENDPOINT" ;
@@ -36,8 +37,13 @@ enum class TransportFormat
36
37
*/
37
38
struct ZipkinExporterOptions
38
39
{
39
- // The endpoint to export to. By default the OpenTelemetry Collector's default endpoint.
40
- std::string endpoint = GetDefaultZipkinEndpoint();
40
+ // Lookup environment variables
41
+ ZipkinExporterOptions () : endpoint(GetDefaultZipkinEndpoint()) {}
42
+
43
+ // No defaults
44
+ ZipkinExporterOptions (void *) : endpoint(" " ) {}
45
+
46
+ std::string endpoint;
41
47
TransportFormat format = TransportFormat::kJson ;
42
48
std::string service_name = " default-service" ;
43
49
std::string ipv4;
Original file line number Diff line number Diff line change
1
+ // Copyright The OpenTelemetry Authors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ #include < memory>
5
+ #include < string>
6
+ #include < utility>
7
+
8
+ #include " opentelemetry/exporters/zipkin/zipkin_builder.h"
9
+ #include " opentelemetry/exporters/zipkin/zipkin_exporter_factory.h"
10
+ #include " opentelemetry/exporters/zipkin/zipkin_exporter_options.h"
11
+ #include " opentelemetry/sdk/configuration/registry.h"
12
+ #include " opentelemetry/sdk/configuration/zipkin_span_exporter_builder.h"
13
+ #include " opentelemetry/sdk/configuration/zipkin_span_exporter_configuration.h"
14
+ #include " opentelemetry/sdk/trace/exporter.h"
15
+ #include " opentelemetry/version.h"
16
+
17
+ OPENTELEMETRY_BEGIN_NAMESPACE
18
+ namespace exporter
19
+ {
20
+ namespace zipkin
21
+ {
22
+
23
+ static ZipkinBuilder singleton;
24
+
25
+ void ZipkinBuilder::Register (opentelemetry::sdk::configuration::Registry *registry)
26
+ {
27
+ auto builder = std::make_unique<ZipkinBuilder>();
28
+ registry->SetZipkinSpanBuilder (std::move (builder));
29
+ }
30
+
31
+ std::unique_ptr<opentelemetry::sdk::trace::SpanExporter> ZipkinBuilder::Build (
32
+ const opentelemetry::sdk::configuration::ZipkinSpanExporterConfiguration *model) const
33
+ {
34
+ ZipkinExporterOptions options (nullptr );
35
+
36
+ options.endpoint = model->endpoint ;
37
+
38
+ return ZipkinExporterFactory::Create (options);
39
+ }
40
+
41
+ } // namespace zipkin
42
+ } // namespace exporter
43
+ OPENTELEMETRY_END_NAMESPACE
You can’t perform that action at this time.
0 commit comments