Skip to content

Commit

Permalink
Merge branch 'main' into fix_semconv_2419
Browse files Browse the repository at this point in the history
  • Loading branch information
marcalff authored Dec 4, 2023
2 parents f8be23e + abad83d commit e652132
Show file tree
Hide file tree
Showing 24 changed files with 43 additions and 50 deletions.
1 change: 0 additions & 1 deletion api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ if(WITH_NO_GETENV)
endif()

if(WIN32)
target_compile_definitions(opentelemetry_api INTERFACE NOMINMAX)
if(WITH_ETW)
target_compile_definitions(opentelemetry_api INTERFACE HAVE_MSGPACK)
endif()
Expand Down
3 changes: 0 additions & 3 deletions api/include/opentelemetry/common/spin_lock_mutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
#include "opentelemetry/version.h"

#if defined(_MSC_VER)
# ifndef NOMINMAX
# define NOMINMAX
# endif
# define _WINSOCKAPI_ // stops including winsock.h
# include <windows.h>
#elif defined(__i386__) || defined(__x86_64__)
Expand Down
6 changes: 3 additions & 3 deletions api/include/opentelemetry/common/timestamp.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,21 +178,21 @@ class DurationUtil
std::chrono::duration<Rep, Period> indefinite_value) noexcept
{
// Do not call now() when this duration is max value, now() may have a expensive cost.
if (timeout == std::chrono::duration<Rep, Period>::max())
if (timeout == (std::chrono::duration<Rep, Period>::max)())
{
return indefinite_value;
}

// std::future<T>::wait_for, std::this_thread::sleep_for, and std::condition_variable::wait_for
// may use steady_clock or system_clock.We need make sure now() + timeout do not overflow.
auto max_timeout = std::chrono::duration_cast<std::chrono::duration<Rep, Period>>(
std::chrono::steady_clock::time_point::max() - std::chrono::steady_clock::now());
(std::chrono::steady_clock::time_point::max)() - std::chrono::steady_clock::now());
if (timeout >= max_timeout)
{
return indefinite_value;
}
max_timeout = std::chrono::duration_cast<std::chrono::duration<Rep, Period>>(
std::chrono::system_clock::time_point::max() - std::chrono::system_clock::now());
(std::chrono::system_clock::time_point::max)() - std::chrono::system_clock::now());
if (timeout >= max_timeout)
{
return indefinite_value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
#include "opentelemetry/plugin/hook.h"
#include "opentelemetry/version.h"

#ifndef NOMINMAX
# define NOMINMAX
#endif
#include <Windows.h>

#include <WinBase.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ class OStreamLogRecordExporter final : public opentelemetry::sdk::logs::LogRecor
* @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;

/**
* Marks the OStream Log Exporter as shut down.
*/
bool Shutdown(
std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept override;
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override;

private:
// The OStream to send the logs to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ class OStreamSpanExporter 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;

bool Shutdown(
std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept override;
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override;

private:
std::ostream &sout_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ class ZipkinExporter 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.
* @param timeout an optional timeout, default to max.
*/
bool Shutdown(
std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept override;
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override;

private:
void InitializeLocalEndpoint();
Expand Down
2 changes: 1 addition & 1 deletion sdk/include/opentelemetry/sdk/logs/exporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class OPENTELEMETRY_EXPORT LogRecordExporter
* @return true if the exporter shutdown succeeded, false otherwise
*/
virtual bool Shutdown(
std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept = 0;
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept = 0;
};
} // namespace logs
} // namespace sdk
Expand Down
2 changes: 1 addition & 1 deletion sdk/include/opentelemetry/sdk/logs/logger_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class LoggerContext
/**
* Shutdown the log processor associated with this tracer provider.
*/
bool Shutdown(std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept;
bool Shutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept;

private:
// order of declaration is important here - resource object should be destroyed after processor.
Expand Down
4 changes: 2 additions & 2 deletions sdk/include/opentelemetry/sdk/logs/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class LogRecordProcessor
* @return a result code indicating whether it succeeded, failed or timed out
*/
virtual bool ForceFlush(
std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept = 0;
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept = 0;

/**
* Shuts down the processor and does any cleanup required.
Expand All @@ -56,7 +56,7 @@ class LogRecordProcessor
* @return true if the shutdown succeeded, false otherwise
*/
virtual bool Shutdown(
std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept = 0;
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept = 0;
};
} // namespace logs
} // namespace sdk
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ class SimpleLogRecordProcessor : public LogRecordProcessor
void OnEmit(std::unique_ptr<Recordable> &&record) noexcept override;

bool ForceFlush(
std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept override;
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override;

bool Shutdown(
std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept override;
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept override;

bool IsShutdown() const noexcept;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ void HistogramMerge(HistogramPointData &current,
merge.record_min_max_ = current.record_min_max_ && delta.record_min_max_;
if (merge.record_min_max_)
{
merge.min_ = std::min(nostd::get<T>(current.min_), nostd::get<T>(delta.min_));
merge.max_ = std::max(nostd::get<T>(current.max_), nostd::get<T>(delta.max_));
merge.min_ = (std::min)(nostd::get<T>(current.min_), nostd::get<T>(delta.min_));
merge.max_ = (std::max)(nostd::get<T>(current.max_), nostd::get<T>(delta.max_));
}
}

Expand Down
8 changes: 4 additions & 4 deletions sdk/include/opentelemetry/sdk/metrics/data/exemplar_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ using MetricAttributes = opentelemetry::sdk::common::OrderedAttributeMap;
class ExemplarData
{
public:
static ExemplarData Create(std::shared_ptr<trace::SpanContext> context,
static ExemplarData Create(std::shared_ptr<opentelemetry::trace::SpanContext> context,
const opentelemetry::common::SystemTimestamp &timestamp,
const PointDataAttributes &point_data_attr)
{
Expand All @@ -47,7 +47,7 @@ class ExemplarData
* Returns the SpanContext associated with this exemplar. If the exemplar was not recorded
* inside a sampled trace, the Context will be invalid.
*/
const trace::SpanContext &GetSpanContext() const noexcept { return context_; }
const opentelemetry::trace::SpanContext &GetSpanContext() const noexcept { return context_; }

static PointType CreateSumPointData(ValueType value)
{
Expand All @@ -68,13 +68,13 @@ class ExemplarData
static PointType CreateDropPointData() { return DropPointData{}; }

private:
ExemplarData(std::shared_ptr<trace::SpanContext> context,
ExemplarData(std::shared_ptr<opentelemetry::trace::SpanContext> context,
opentelemetry::common::SystemTimestamp timestamp,
const PointDataAttributes &point_data_attr)
: context_(*context.get()), timestamp_(timestamp), point_data_attr_(point_data_attr)
{}

trace::SpanContext context_;
opentelemetry::trace::SpanContext context_;
opentelemetry::common::SystemTimestamp timestamp_;
PointDataAttributes point_data_attr_;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,13 @@ class ReservoirCell
auto current_ctx = span->GetContext();
if (current_ctx.IsValid())
{
context_.reset(new trace::SpanContext{current_ctx});
context_.reset(new opentelemetry::trace::SpanContext{current_ctx});
}
}
}

// Cell stores either long or double values, but must not store both
std::shared_ptr<trace::SpanContext> context_;
std::shared_ptr<opentelemetry::trace::SpanContext> context_;
nostd::variant<int64_t, double> value_;
opentelemetry::common::SystemTimestamp record_time_;
MetricAttributes attributes_;
Expand Down
4 changes: 2 additions & 2 deletions sdk/include/opentelemetry/sdk/metrics/metric_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ class MetricReader
/**
* Shutdown the metric reader.
*/
bool Shutdown(std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept;
bool Shutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept;

/**
* Force flush the metric read by the reader.
*/
bool ForceFlush(std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept;
bool ForceFlush(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept;

/**
* Return the status of Metric reader.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ class MetricCollector : public MetricProducer, public CollectorHandle
*/
bool Collect(nostd::function_ref<bool(ResourceMetrics &metric_data)> callback) noexcept override;

bool ForceFlush(std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept;
bool ForceFlush(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept;

bool Shutdown(std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept;
bool Shutdown(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept;

private:
MeterContext *meter_context_;
Expand Down
2 changes: 1 addition & 1 deletion sdk/include/opentelemetry/sdk/trace/exporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class OPENTELEMETRY_EXPORT SpanExporter
* @return return the status of the operation.
*/
virtual bool Shutdown(
std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept = 0;
std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept = 0;
};
} // namespace trace
} // namespace sdk
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/logs/batch_log_record_processor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ bool BatchLogRecordProcessor::ForceFlush(std::chrono::microseconds timeout) noex
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)();
}

bool result = false;
Expand Down
16 changes: 8 additions & 8 deletions sdk/src/metrics/aggregation/histogram_aggregation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ LongHistogramAggregation::LongHistogramAggregation(const AggregationConfig *aggr
point_data_.sum_ = (int64_t)0;
point_data_.count_ = 0;
point_data_.record_min_max_ = record_min_max_;
point_data_.min_ = std::numeric_limits<int64_t>::max();
point_data_.max_ = std::numeric_limits<int64_t>::min();
point_data_.min_ = (std::numeric_limits<int64_t>::max)();
point_data_.max_ = (std::numeric_limits<int64_t>::min)();
}

LongHistogramAggregation::LongHistogramAggregation(HistogramPointData &&data)
Expand All @@ -58,8 +58,8 @@ void LongHistogramAggregation::Aggregate(int64_t value,
point_data_.sum_ = nostd::get<int64_t>(point_data_.sum_) + value;
if (record_min_max_)
{
point_data_.min_ = std::min(nostd::get<int64_t>(point_data_.min_), value);
point_data_.max_ = std::max(nostd::get<int64_t>(point_data_.max_), value);
point_data_.min_ = (std::min)(nostd::get<int64_t>(point_data_.min_), value);
point_data_.max_ = (std::max)(nostd::get<int64_t>(point_data_.max_), value);
}
size_t index = BucketBinarySearch(value, point_data_.boundaries_);
point_data_.counts_[index] += 1;
Expand Down Expand Up @@ -118,8 +118,8 @@ DoubleHistogramAggregation::DoubleHistogramAggregation(const AggregationConfig *
point_data_.sum_ = 0.0;
point_data_.count_ = 0;
point_data_.record_min_max_ = record_min_max_;
point_data_.min_ = std::numeric_limits<double>::max();
point_data_.max_ = std::numeric_limits<double>::min();
point_data_.min_ = (std::numeric_limits<double>::max)();
point_data_.max_ = (std::numeric_limits<double>::min)();
}

DoubleHistogramAggregation::DoubleHistogramAggregation(HistogramPointData &&data)
Expand All @@ -138,8 +138,8 @@ void DoubleHistogramAggregation::Aggregate(double value,
point_data_.sum_ = nostd::get<double>(point_data_.sum_) + value;
if (record_min_max_)
{
point_data_.min_ = std::min(nostd::get<double>(point_data_.min_), value);
point_data_.max_ = std::max(nostd::get<double>(point_data_.max_), value);
point_data_.min_ = (std::min)(nostd::get<double>(point_data_.min_), value);
point_data_.max_ = (std::max)(nostd::get<double>(point_data_.max_), value);
}
size_t index = BucketBinarySearch(value, point_data_.boundaries_);
point_data_.counts_[index] += 1;
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/metrics/export/periodic_exporting_metric_reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ bool PeriodicExportingMetricReader::OnForceFlush(std::chrono::microseconds timeo
std::chrono::duration_cast<std::chrono::steady_clock::duration>(wait_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)();
}

bool result = false;
Expand Down
4 changes: 2 additions & 2 deletions sdk/src/metrics/meter_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,15 @@ bool MeterContext::ForceFlush(std::chrono::microseconds timeout) noexcept
// Simultaneous flush not allowed.
const std::lock_guard<opentelemetry::common::SpinLockMutex> locked(forceflush_lock_);
// Convert to nanos to prevent overflow
auto timeout_ns = std::chrono::nanoseconds::max();
auto timeout_ns = (std::chrono::nanoseconds::max)();
if (std::chrono::duration_cast<std::chrono::microseconds>(timeout_ns) > timeout)
{
timeout_ns = std::chrono::duration_cast<std::chrono::nanoseconds>(timeout);
}

auto current_time = std::chrono::system_clock::now();
std::chrono::system_clock::time_point expire_time;
auto overflow_checker = std::chrono::system_clock::time_point::max();
auto overflow_checker = (std::chrono::system_clock::time_point::max)();

// check if the expected expire time doesn't overflow.
if (overflow_checker - current_time > timeout_ns)
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/trace/batch_span_processor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ bool BatchSpanProcessor::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)();
}

bool result = false;
Expand Down
2 changes: 1 addition & 1 deletion third_party/googletest
Submodule googletest updated 77 files
+0 −43 .github/ISSUE_TEMPLATE/00-bug_report.md
+53 −0 .github/ISSUE_TEMPLATE/00-bug_report.yml
+0 −24 .github/ISSUE_TEMPLATE/10-feature_request.md
+33 −0 .github/ISSUE_TEMPLATE/10-feature_request.yml
+4 −0 .github/ISSUE_TEMPLATE/config.yml
+10 −7 .github/workflows/gtest-ci.yml
+6 −1 CMakeLists.txt
+2 −2 CONTRIBUTING.md
+12 −36 README.md
+20 −19 WORKSPACE
+6 −2 ci/linux-presubmit.sh
+4 −2 ci/macos-presubmit.sh
+56 −0 ci/windows-presubmit.bat
+1 −1 docs/_layouts/default.html
+17 −8 docs/advanced.md
+1 −1 docs/faq.md
+1 −1 docs/gmock_cheat_sheet.md
+15 −14 docs/gmock_cook_book.md
+1 −0 docs/primer.md
+8 −9 docs/quickstart-bazel.md
+6 −6 docs/quickstart-cmake.md
+1 −1 docs/reference/testing.md
+1 −1 docs/samples.md
+9 −5 googlemock/include/gmock/gmock-actions.h
+8 −5 googlemock/include/gmock/gmock-function-mocker.h
+34 −24 googlemock/include/gmock/gmock-matchers.h
+38 −7 googlemock/include/gmock/gmock-more-matchers.h
+31 −3 googlemock/include/gmock/gmock-spec-builders.h
+25 −11 googlemock/include/gmock/internal/gmock-internal-utils.h
+5 −4 googlemock/src/gmock-internal-utils.cc
+17 −0 googlemock/src/gmock-matchers.cc
+18 −4 googlemock/src/gmock-spec-builders.cc
+4 −4 googlemock/test/gmock-actions_test.cc
+15 −0 googlemock/test/gmock-function-mocker_test.cc
+41 −0 googlemock/test/gmock-matchers-comparisons_test.cc
+2 −2 googlemock/test/gmock-matchers-containers_test.cc
+15 −1 googlemock/test/gmock-matchers-misc_test.cc
+12 −9 googlemock/test/gmock-spec-builders_test.cc
+3 −0 googlemock/test/gmock_output_test.py
+4 −4 googlemock/test/gmock_output_test_golden.txt
+16 −0 googletest/CMakeLists.txt
+7 −7 googletest/README.md
+19 −5 googletest/cmake/internal_utils.cmake
+1 −1 googletest/include/gtest/gtest-matchers.h
+2 −0 googletest/include/gtest/gtest-message.h
+41 −6 googletest/include/gtest/gtest-param-test.h
+85 −2 googletest/include/gtest/gtest-printers.h
+2 −0 googletest/include/gtest/gtest-spi.h
+2 −0 googletest/include/gtest/gtest-test-part.h
+31 −10 googletest/include/gtest/gtest.h
+2 −1 googletest/include/gtest/internal/gtest-death-test-internal.h
+17 −0 googletest/include/gtest/internal/gtest-filepath.h
+5 −4 googletest/include/gtest/internal/gtest-internal.h
+75 −0 googletest/include/gtest/internal/gtest-param-util.h
+2 −0 googletest/include/gtest/internal/gtest-port-arch.h
+146 −99 googletest/include/gtest/internal/gtest-port.h
+1 −0 googletest/include/gtest/internal/gtest-string.h
+4 −0 googletest/include/gtest/internal/gtest-type-util.h
+2 −2 googletest/src/gtest-death-test.cc
+63 −20 googletest/src/gtest-filepath.cc
+9 −4 googletest/src/gtest-internal-inl.h
+1 −1 googletest/src/gtest-printers.cc
+121 −72 googletest/src/gtest.cc
+12 −0 googletest/src/gtest_main.cc
+1 −0 googletest/test/googletest-color-test.py
+20 −0 googletest/test/googletest-filepath-test.cc
+3 −0 googletest/test/googletest-message-test.cc
+2 −0 googletest/test/googletest-options-test.cc
+71 −11 googletest/test/googletest-param-test-test.cc
+1 −0 googletest/test/googletest-port-test.cc
+32 −1 googletest/test/googletest-printers-test.cc
+1 −0 googletest/test/gtest-typed-test_test.cc
+2 −2 googletest/test/gtest-unittest-api_test.cc
+97 −0 googletest/test/gtest_dirs_test.cc
+1 −0 googletest/test/gtest_pred_impl_unittest.cc
+7 −3 googletest/test/gtest_unittest.cc
+3 −1 googletest/test/gtest_xml_outfile2_test_.cc
2 changes: 1 addition & 1 deletion third_party_release
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
gRPC=v1.49.2
abseil=20220623.1
benchmark=v1.7.1
googletest=release-1.13.0
googletest=1.13.0
ms-gsl=v3.1.0-67-g6f45293
nlohmann-json=v3.11.2
opentelemetry-proto=v1.0.0
Expand Down

0 comments on commit e652132

Please sign in to comment.