Skip to content

Commit

Permalink
[EXPORTER and SDK] Additional fixes after NOMINMAX removal on Windows (
Browse files Browse the repository at this point in the history
  • Loading branch information
meastp authored Jan 3, 2024
1 parent ddfafff commit 0134bbe
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion docs/cpp-ostream-exporter-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public:
return sdktrace::ExportResult::kSuccess;
}

bool Shutdown(std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept
bool Shutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept
{
isShutdown = true;
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,14 @@ class ElasticsearchLogRecordExporter final : public opentelemetry::sdk::logs::Lo
* @return return true when all data are exported, and false when timeout
*/
bool ForceFlush(
std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept override;
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override;

/**
* Shutdown this exporter.
* @param timeout The maximum time to wait for the shutdown method to return
*/
bool Shutdown(
std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept override;
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override;

private:
// Stores if this exporter had its Shutdown() method called
Expand Down
2 changes: 1 addition & 1 deletion exporters/elasticsearch/src/es_log_record_exporter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ bool ElasticsearchLogRecordExporter::ForceFlush(
std::chrono::duration_cast<std::chrono::steady_clock::duration>(timeout);
if (timeout_steady <= std::chrono::steady_clock::duration::zero())
{
timeout_steady = std::chrono::steady_clock::duration::max();
timeout_steady = (std::chrono::steady_clock::duration::max)();
}

std::unique_lock<std::mutex> lk_cv(synchronization_data_->force_flush_cv_m);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class OtlpGrpcExporter final : public opentelemetry::sdk::trace::SpanExporter
* @return return true when all data are exported, and false when timeout
*/
bool ForceFlush(
std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept override;
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override;

/**
* Shut down the exporter.
Expand All @@ -67,7 +67,7 @@ class OtlpGrpcExporter final : public opentelemetry::sdk::trace::SpanExporter
* @return return the status of this operation
*/
bool Shutdown(
std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept override;
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override;

private:
// The configuration options associated with this exporter.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ class OtlpGrpcLogRecordExporter : public opentelemetry::sdk::logs::LogRecordExpo
* @return return true when all data are exported, and false when timeout
*/
bool ForceFlush(
std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept override;
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override;

/**
* Shutdown this exporter.
* @param timeout The maximum time to wait for the shutdown method to return.
*/
bool Shutdown(
std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept override;
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override;

private:
// Configuration options for the exporter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class OPENTELEMETRY_EXPORT OtlpHttpExporter final : public opentelemetry::sdk::t
* @return return true when all data are exported, and false when timeout
*/
bool ForceFlush(
std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept override;
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override;

/**
* Shut down the exporter.
Expand All @@ -68,7 +68,7 @@ class OPENTELEMETRY_EXPORT OtlpHttpExporter final : public opentelemetry::sdk::t
* @return return the status of this operation
*/
bool Shutdown(
std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept override;
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override;

private:
// The configuration options associated with this exporter.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ class OtlpHttpLogRecordExporter final : public opentelemetry::sdk::logs::LogReco
* @return return true when all data are exported, and false when timeout
*/
bool ForceFlush(
std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept override;
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override;

/**
* Shutdown this exporter.
* @param timeout The maximum time to wait for the shutdown method to return
*/
bool Shutdown(
std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept override;
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override;

private:
// Configuration options for the exporter
Expand Down
2 changes: 1 addition & 1 deletion exporters/otlp/src/otlp_http_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ bool OtlpHttpClient::ForceFlush(std::chrono::microseconds timeout) noexcept
std::chrono::duration_cast<std::chrono::steady_clock::duration>(timeout);
if (timeout_steady <= std::chrono::steady_clock::duration::zero())
{
timeout_steady = std::chrono::steady_clock::duration::max();
timeout_steady = (std::chrono::steady_clock::duration::max)();
}

while (timeout_steady > std::chrono::steady_clock::duration::zero())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class BatchLogRecordProcessor : public LogRecordProcessor
* NOTE: Timeout functionality not supported yet.
*/
bool ForceFlush(
std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept override;
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override;

/**
* Shuts down the processor and does any cleanup required. Completely drains the buffer/queue of
Expand All @@ -82,7 +82,7 @@ class BatchLogRecordProcessor : public LogRecordProcessor
* NOTE: Timeout functionality not supported yet.
*/
bool Shutdown(
std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept override;
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override;

/**
* Class destructor which invokes the Shutdown() method.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class MultiLogRecordProcessor : public LogRecordProcessor
* @return a result code indicating whether it succeeded, failed or timed out
*/
bool ForceFlush(
std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept override;
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override;

/**
* Shuts down the processor and does any cleanup required.
Expand All @@ -55,7 +55,7 @@ class MultiLogRecordProcessor : public LogRecordProcessor
* @return true if the shutdown succeeded, false otherwise
*/
bool Shutdown(
std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept override;
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override;

private:
std::vector<std::unique_ptr<LogRecordProcessor>> processors_;
Expand Down
4 changes: 2 additions & 2 deletions sdk/include/opentelemetry/sdk/trace/batch_span_processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class BatchSpanProcessor : public SpanProcessor
* NOTE: Timeout functionality not supported yet.
*/
bool ForceFlush(
std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept override;
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override;

/**
* Shuts down the processor and does any cleanup required. Completely drains the buffer/queue of
Expand All @@ -79,7 +79,7 @@ class BatchSpanProcessor : public SpanProcessor
* NOTE: Timeout functionality not supported yet.
*/
bool Shutdown(
std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept override;
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override;

/**
* Class destructor which invokes the Shutdown() method. The Shutdown() method is supposed to be
Expand Down

3 comments on commit 0134bbe

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'OpenTelemetry-cpp api Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 0134bbe Previous: ddfafff Ratio
BM_SpinLockThrashing/1/process_time/real_time 0.15383430867813366 ms/iter 0.06960910947077623 ms/iter 2.21

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'OpenTelemetry-cpp exporters Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 0134bbe Previous: ddfafff Ratio
BM_OtlpExporterEmptySpans 46.84567647867973 ns/iter 23.128968479878374 ns/iter 2.03

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'OpenTelemetry-cpp sdk Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 0134bbe Previous: ddfafff Ratio
BM_LockFreeBuffer/1 1675591.4688110352 ns/iter 597045.6600189209 ns/iter 2.81

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.