Skip to content

Commit

Permalink
Intialize default Zipkin endpoint from env var if exists (#624)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomsonTan authored Mar 24, 2021
1 parent 81d6468 commit 139e9d4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Increment the:

## [Unreleased]

* [SDK] Read Zipkin endpoint from environment variable. ([#24](https://github.com/open-telemetry/opentelemetry-cpp/pull/624))

## [0.3.0] 2021-03-19

* [EXPORTER] Added Zipkin Exporter. ([#471](https://github.com/open-telemetry/opentelemetry-cpp/pull/471))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,21 @@ namespace exporter
namespace zipkin
{

const std::string kZipkinEndpointDefault = "http://localhost:9411/api/v2/spans";
const char *kZipkinEndpointDefault = "http://localhost:9411/api/v2/spans";

static const std::string GetDefaultZipkinEndpoint()
{
auto endpoint_from_env = std::getenv("OTEL_EXPORTER_ZIPKIN_ENDPOINT");
return std::string{endpoint_from_env ? endpoint_from_env : kZipkinEndpointDefault};
}

/**
* Struct to hold Zipkin exporter options.
*/
struct ZipkinExporterOptions
{
// The endpoint to export to. By default the OpenTelemetry Collector's default endpoint.
std::string endpoint = kZipkinEndpointDefault;
std::string endpoint = GetDefaultZipkinEndpoint();
TransportFormat format = TransportFormat::kJson;
std::string service_name = "default-service";
std::string ipv4;
Expand Down

0 comments on commit 139e9d4

Please sign in to comment.