Skip to content

Commit

Permalink
Optimize OtlpHttpExporter to support timeout and cancle (#853)
Browse files Browse the repository at this point in the history
  • Loading branch information
owent authored Jun 14, 2021
1 parent 521ebd8 commit fa2caa8
Show file tree
Hide file tree
Showing 3 changed files with 272 additions and 91 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
// We need include exporter.h first, which will include Windows.h with NOMINMAX on Windows
#include "opentelemetry/sdk/trace/exporter.h"

#include "opentelemetry/ext/http/client/http_client.h"

#include <chrono>
#include <memory>
#include <mutex>
#include <string>
Expand Down Expand Up @@ -65,6 +68,7 @@ struct OtlpHttpExporterOptions

// TODO: Enable/disable to verify SSL certificate
// TODO: Reuqest timeout
std::chrono::milliseconds timeout = std::chrono::milliseconds(30000);
};

/**
Expand Down Expand Up @@ -113,6 +117,11 @@ class OtlpHttpExporter final : public opentelemetry::sdk::trace::SpanExporter

// The configuration options associated with this exporter.
const OtlpHttpExporterOptions options_;

// Object that stores the HTTP sessions that have been created
std::shared_ptr<ext::http::client::HttpClient> http_client_;
// Cached parsed URI
std::string http_uri_;
};
} // namespace otlp
} // namespace exporter
Expand Down
Loading

0 comments on commit fa2caa8

Please sign in to comment.