Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intialize default Zipkin endpoint from env var if exists #624

Merged
merged 4 commits into from
Mar 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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