Skip to content

Commit 3c220c9

Browse files
authored
Merge branch 'main' into fix_error_uint8_t_not_declared
2 parents 62bd89c + abad83d commit 3c220c9

File tree

20 files changed

+35
-42
lines changed

20 files changed

+35
-42
lines changed

api/CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ if(WITH_NO_GETENV)
104104
endif()
105105

106106
if(WIN32)
107-
target_compile_definitions(opentelemetry_api INTERFACE NOMINMAX)
108107
if(WITH_ETW)
109108
target_compile_definitions(opentelemetry_api INTERFACE HAVE_MSGPACK)
110109
endif()

api/include/opentelemetry/common/spin_lock_mutex.h

-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
#include "opentelemetry/version.h"
1111

1212
#if defined(_MSC_VER)
13-
# ifndef NOMINMAX
14-
# define NOMINMAX
15-
# endif
1613
# define _WINSOCKAPI_ // stops including winsock.h
1714
# include <windows.h>
1815
#elif defined(__i386__) || defined(__x86_64__)

api/include/opentelemetry/common/timestamp.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -178,21 +178,21 @@ class DurationUtil
178178
std::chrono::duration<Rep, Period> indefinite_value) noexcept
179179
{
180180
// Do not call now() when this duration is max value, now() may have a expensive cost.
181-
if (timeout == std::chrono::duration<Rep, Period>::max())
181+
if (timeout == (std::chrono::duration<Rep, Period>::max)())
182182
{
183183
return indefinite_value;
184184
}
185185

186186
// std::future<T>::wait_for, std::this_thread::sleep_for, and std::condition_variable::wait_for
187187
// may use steady_clock or system_clock.We need make sure now() + timeout do not overflow.
188188
auto max_timeout = std::chrono::duration_cast<std::chrono::duration<Rep, Period>>(
189-
std::chrono::steady_clock::time_point::max() - std::chrono::steady_clock::now());
189+
(std::chrono::steady_clock::time_point::max)() - std::chrono::steady_clock::now());
190190
if (timeout >= max_timeout)
191191
{
192192
return indefinite_value;
193193
}
194194
max_timeout = std::chrono::duration_cast<std::chrono::duration<Rep, Period>>(
195-
std::chrono::system_clock::time_point::max() - std::chrono::system_clock::now());
195+
(std::chrono::system_clock::time_point::max)() - std::chrono::system_clock::now());
196196
if (timeout >= max_timeout)
197197
{
198198
return indefinite_value;

api/include/opentelemetry/plugin/detail/dynamic_load_windows.h

-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
#include "opentelemetry/plugin/hook.h"
1313
#include "opentelemetry/version.h"
1414

15-
#ifndef NOMINMAX
16-
# define NOMINMAX
17-
#endif
1815
#include <Windows.h>
1916

2017
#include <WinBase.h>

exporters/ostream/include/opentelemetry/exporters/ostream/log_record_exporter.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ class OStreamLogRecordExporter final : public opentelemetry::sdk::logs::LogRecor
4747
* @return return true when all data are exported, and false when timeout
4848
*/
4949
bool ForceFlush(
50-
std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept override;
50+
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override;
5151

5252
/**
5353
* Marks the OStream Log Exporter as shut down.
5454
*/
5555
bool Shutdown(
56-
std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept override;
56+
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override;
5757

5858
private:
5959
// The OStream to send the logs to

exporters/ostream/include/opentelemetry/exporters/ostream/span_exporter.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ class OStreamSpanExporter final : public opentelemetry::sdk::trace::SpanExporter
4444
* @return return true when all data are exported, and false when timeout
4545
*/
4646
bool ForceFlush(
47-
std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept override;
47+
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override;
4848

4949
bool Shutdown(
50-
std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept override;
50+
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override;
5151

5252
private:
5353
std::ostream &sout_;

exporters/zipkin/include/opentelemetry/exporters/zipkin/zipkin_exporter.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ class ZipkinExporter final : public opentelemetry::sdk::trace::SpanExporter
5555
* @return return true when all data are exported, and false when timeout
5656
*/
5757
bool ForceFlush(
58-
std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept override;
58+
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override;
5959

6060
/**
6161
* Shut down the exporter.
6262
* @param timeout an optional timeout, default to max.
6363
*/
6464
bool Shutdown(
65-
std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept override;
65+
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override;
6666

6767
private:
6868
void InitializeLocalEndpoint();

sdk/include/opentelemetry/sdk/logs/exporter.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class OPENTELEMETRY_EXPORT LogRecordExporter
6262
* @return true if the exporter shutdown succeeded, false otherwise
6363
*/
6464
virtual bool Shutdown(
65-
std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept = 0;
65+
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept = 0;
6666
};
6767
} // namespace logs
6868
} // namespace sdk

sdk/include/opentelemetry/sdk/logs/logger_context.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class LoggerContext
7070
/**
7171
* Shutdown the log processor associated with this tracer provider.
7272
*/
73-
bool Shutdown(std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept;
73+
bool Shutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept;
7474

7575
private:
7676
// order of declaration is important here - resource object should be destroyed after processor.

sdk/include/opentelemetry/sdk/logs/processor.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class LogRecordProcessor
4646
* @return a result code indicating whether it succeeded, failed or timed out
4747
*/
4848
virtual bool ForceFlush(
49-
std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept = 0;
49+
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept = 0;
5050

5151
/**
5252
* Shuts down the processor and does any cleanup required.
@@ -56,7 +56,7 @@ class LogRecordProcessor
5656
* @return true if the shutdown succeeded, false otherwise
5757
*/
5858
virtual bool Shutdown(
59-
std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept = 0;
59+
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept = 0;
6060
};
6161
} // namespace logs
6262
} // namespace sdk

sdk/include/opentelemetry/sdk/logs/simple_log_record_processor.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ class SimpleLogRecordProcessor : public LogRecordProcessor
3939
void OnEmit(std::unique_ptr<Recordable> &&record) noexcept override;
4040

4141
bool ForceFlush(
42-
std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept override;
42+
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override;
4343

4444
bool Shutdown(
45-
std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept override;
45+
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override;
4646

4747
bool IsShutdown() const noexcept;
4848

sdk/include/opentelemetry/sdk/metrics/aggregation/histogram_aggregation.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ void HistogramMerge(HistogramPointData &current,
9393
merge.record_min_max_ = current.record_min_max_ && delta.record_min_max_;
9494
if (merge.record_min_max_)
9595
{
96-
merge.min_ = std::min(nostd::get<T>(current.min_), nostd::get<T>(delta.min_));
97-
merge.max_ = std::max(nostd::get<T>(current.max_), nostd::get<T>(delta.max_));
96+
merge.min_ = (std::min)(nostd::get<T>(current.min_), nostd::get<T>(delta.min_));
97+
merge.max_ = (std::max)(nostd::get<T>(current.max_), nostd::get<T>(delta.max_));
9898
}
9999
}
100100

sdk/include/opentelemetry/sdk/metrics/metric_reader.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ class MetricReader
4848
/**
4949
* Shutdown the metric reader.
5050
*/
51-
bool Shutdown(std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept;
51+
bool Shutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept;
5252

5353
/**
5454
* Force flush the metric read by the reader.
5555
*/
56-
bool ForceFlush(std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept;
56+
bool ForceFlush(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept;
5757

5858
/**
5959
* Return the status of Metric reader.

sdk/include/opentelemetry/sdk/metrics/state/metric_collector.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ class MetricCollector : public MetricProducer, public CollectorHandle
5353
*/
5454
bool Collect(nostd::function_ref<bool(ResourceMetrics &metric_data)> callback) noexcept override;
5555

56-
bool ForceFlush(std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept;
56+
bool ForceFlush(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept;
5757

58-
bool Shutdown(std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept;
58+
bool Shutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept;
5959

6060
private:
6161
MeterContext *meter_context_;

sdk/include/opentelemetry/sdk/trace/exporter.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class OPENTELEMETRY_EXPORT SpanExporter
6161
* @return return the status of the operation.
6262
*/
6363
virtual bool Shutdown(
64-
std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept = 0;
64+
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept = 0;
6565
};
6666
} // namespace trace
6767
} // namespace sdk

sdk/src/logs/batch_log_record_processor.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ bool BatchLogRecordProcessor::ForceFlush(std::chrono::microseconds timeout) noex
104104
std::chrono::duration_cast<std::chrono::steady_clock::duration>(timeout);
105105
if (timeout_steady <= std::chrono::steady_clock::duration::zero())
106106
{
107-
timeout_steady = std::chrono::steady_clock::duration::max();
107+
timeout_steady = (std::chrono::steady_clock::duration::max)();
108108
}
109109

110110
bool result = false;

sdk/src/metrics/aggregation/histogram_aggregation.cc

+8-8
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ LongHistogramAggregation::LongHistogramAggregation(const AggregationConfig *aggr
3838
point_data_.sum_ = (int64_t)0;
3939
point_data_.count_ = 0;
4040
point_data_.record_min_max_ = record_min_max_;
41-
point_data_.min_ = std::numeric_limits<int64_t>::max();
42-
point_data_.max_ = std::numeric_limits<int64_t>::min();
41+
point_data_.min_ = (std::numeric_limits<int64_t>::max)();
42+
point_data_.max_ = (std::numeric_limits<int64_t>::min)();
4343
}
4444

4545
LongHistogramAggregation::LongHistogramAggregation(HistogramPointData &&data)
@@ -58,8 +58,8 @@ void LongHistogramAggregation::Aggregate(int64_t value,
5858
point_data_.sum_ = nostd::get<int64_t>(point_data_.sum_) + value;
5959
if (record_min_max_)
6060
{
61-
point_data_.min_ = std::min(nostd::get<int64_t>(point_data_.min_), value);
62-
point_data_.max_ = std::max(nostd::get<int64_t>(point_data_.max_), value);
61+
point_data_.min_ = (std::min)(nostd::get<int64_t>(point_data_.min_), value);
62+
point_data_.max_ = (std::max)(nostd::get<int64_t>(point_data_.max_), value);
6363
}
6464
size_t index = BucketBinarySearch(value, point_data_.boundaries_);
6565
point_data_.counts_[index] += 1;
@@ -118,8 +118,8 @@ DoubleHistogramAggregation::DoubleHistogramAggregation(const AggregationConfig *
118118
point_data_.sum_ = 0.0;
119119
point_data_.count_ = 0;
120120
point_data_.record_min_max_ = record_min_max_;
121-
point_data_.min_ = std::numeric_limits<double>::max();
122-
point_data_.max_ = std::numeric_limits<double>::min();
121+
point_data_.min_ = (std::numeric_limits<double>::max)();
122+
point_data_.max_ = (std::numeric_limits<double>::min)();
123123
}
124124

125125
DoubleHistogramAggregation::DoubleHistogramAggregation(HistogramPointData &&data)
@@ -138,8 +138,8 @@ void DoubleHistogramAggregation::Aggregate(double value,
138138
point_data_.sum_ = nostd::get<double>(point_data_.sum_) + value;
139139
if (record_min_max_)
140140
{
141-
point_data_.min_ = std::min(nostd::get<double>(point_data_.min_), value);
142-
point_data_.max_ = std::max(nostd::get<double>(point_data_.max_), value);
141+
point_data_.min_ = (std::min)(nostd::get<double>(point_data_.min_), value);
142+
point_data_.max_ = (std::max)(nostd::get<double>(point_data_.max_), value);
143143
}
144144
size_t index = BucketBinarySearch(value, point_data_.boundaries_);
145145
point_data_.counts_[index] += 1;

sdk/src/metrics/export/periodic_exporting_metric_reader.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ bool PeriodicExportingMetricReader::OnForceFlush(std::chrono::microseconds timeo
133133
std::chrono::duration_cast<std::chrono::steady_clock::duration>(wait_timeout);
134134
if (timeout_steady <= std::chrono::steady_clock::duration::zero())
135135
{
136-
timeout_steady = std::chrono::steady_clock::duration::max();
136+
timeout_steady = (std::chrono::steady_clock::duration::max)();
137137
}
138138

139139
bool result = false;

sdk/src/metrics/meter_context.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,15 @@ bool MeterContext::ForceFlush(std::chrono::microseconds timeout) noexcept
136136
// Simultaneous flush not allowed.
137137
const std::lock_guard<opentelemetry::common::SpinLockMutex> locked(forceflush_lock_);
138138
// Convert to nanos to prevent overflow
139-
auto timeout_ns = std::chrono::nanoseconds::max();
139+
auto timeout_ns = (std::chrono::nanoseconds::max)();
140140
if (std::chrono::duration_cast<std::chrono::microseconds>(timeout_ns) > timeout)
141141
{
142142
timeout_ns = std::chrono::duration_cast<std::chrono::nanoseconds>(timeout);
143143
}
144144

145145
auto current_time = std::chrono::system_clock::now();
146146
std::chrono::system_clock::time_point expire_time;
147-
auto overflow_checker = std::chrono::system_clock::time_point::max();
147+
auto overflow_checker = (std::chrono::system_clock::time_point::max)();
148148

149149
// check if the expected expire time doesn't overflow.
150150
if (overflow_checker - current_time > timeout_ns)

sdk/src/trace/batch_span_processor.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ bool BatchSpanProcessor::ForceFlush(std::chrono::microseconds timeout) noexcept
102102
std::chrono::duration_cast<std::chrono::steady_clock::duration>(timeout);
103103
if (timeout_steady <= std::chrono::steady_clock::duration::zero())
104104
{
105-
timeout_steady = std::chrono::steady_clock::duration::max();
105+
timeout_steady = (std::chrono::steady_clock::duration::max)();
106106
}
107107

108108
bool result = false;

0 commit comments

Comments
 (0)