Skip to content
Open
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: 1 addition & 1 deletion zipkin/include/zipkin/tracer.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ typedef std::unique_ptr<Reporter> ReporterPtr;
* @return a Reporter object.
*/
ReporterPtr makeHttpReporter(
const char *collector_host, uint32_t collector_port,
const char *collector_host, uint32_t collector_port, const char* collecotor_endpoint,
std::chrono::milliseconds collector_timeout = DEFAULT_TRANSPORT_TIMEOUT,
SteadyClock::duration reporting_period = DEFAULT_REPORTING_PERIOD,
size_t max_buffered_spans = DEFAULT_SPAN_BUFFER_SIZE);
Expand Down
1 change: 0 additions & 1 deletion zipkin/src/zipkin_core_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class ZipkinCoreConstantValues {

const std::string ALWAYS_SAMPLE = "1";

const std::string DEFAULT_COLLECTOR_ENDPOINT = "/api/v1/spans";
};

typedef ConstSingleton<ZipkinCoreConstantValues> ZipkinCoreConstants;
Expand Down
12 changes: 7 additions & 5 deletions zipkin/src/zipkin_http_transporter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
#include <iostream>

namespace zipkin {
static std::string getUrl(const char *collector_host, uint32_t collector_port) {
static std::string getUrl(const char *collector_host, uint32_t collector_port, const char *collector_endpoint) {
return std::string{"http://"} + collector_host + ":" +
std::to_string(collector_port) +
ZipkinCoreConstants::get().DEFAULT_COLLECTOR_ENDPOINT;
std::to_string(collector_port) + collector_endpoint;
}

ZipkinHttpTransporter::ZipkinHttpTransporter(const char *collector_host,
uint32_t collector_port,
const char *collector_endpoint,
std::chrono::milliseconds collector_timeout) {
auto rcode = curl_easy_setopt(handle_, CURLOPT_URL,
getUrl(collector_host, collector_port).c_str());
getUrl(collector_host, collector_port, collector_endpoint).c_str());
if (rcode != CURLE_OK) {
throw CurlError{rcode};
}
Expand Down Expand Up @@ -59,11 +59,13 @@ void ZipkinHttpTransporter::transportSpans(SpanBuffer &spans) try {

ReporterPtr makeHttpReporter(const char *collector_host,
uint32_t collector_port,
const char *collector_endpoint,
std::chrono::milliseconds collector_timeout,
SteadyClock::duration reporting_period,
size_t max_buffered_spans) try {
std::unique_ptr<Transporter> transporter{
new ZipkinHttpTransporter{collector_host, collector_port, collector_timeout}};
new ZipkinHttpTransporter{collector_host, collector_port, collector_endpoint,
collector_timeout}};
std::unique_ptr<Reporter> reporter{new ReporterImpl{
std::move(transporter), reporting_period, max_buffered_spans}};
return reporter;
Expand Down
1 change: 1 addition & 0 deletions zipkin/src/zipkin_http_transporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class ZipkinHttpTransporter : public Transporter {
* Throws CurlError if the handle can't be initialized.
*/
ZipkinHttpTransporter(const char *collector_host, uint32_t collector_port,
const char *collector_endpoint,
std::chrono::milliseconds collector_timeout = DEFAULT_TRANSPORT_TIMEOUT);

/**
Expand Down
1 change: 1 addition & 0 deletions zipkin_opentracing/include/zipkin/opentracing.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ struct ZipkinOtTracerOptions {
double sample_rate = 1.0;

std::string service_name;
std::string collector_endpoint = "/api/v1/spans";
IpAddress service_address;
};

Expand Down
1 change: 1 addition & 0 deletions zipkin_opentracing/src/opentracing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ std::shared_ptr<ot::Tracer>
makeZipkinOtTracer(const ZipkinOtTracerOptions &options) {
auto reporter =
makeHttpReporter(options.collector_host.c_str(), options.collector_port,
options.collector_endpoint.c_str(),
options.collector_timeout, options.reporting_period,
options.max_buffered_spans);
return makeZipkinOtTracer(options, std::move(reporter));
Expand Down