Skip to content
Merged
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
15 changes: 15 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,21 @@ jobs:
CXX_STANDARD: '20'
run: ./ci/do_ci.ps1 cmake.maintainer.cxx20.stl.test

cmake_msvc_maintainer_abiv2_test:
name: CMake msvc (maintainer mode, abiv2)
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: setup
run: |
./ci/setup_windows_ci_environment.ps1
- name: run tests
env:
CXX_STANDARD: '20'
run: ./ci/do_ci.ps1 cmake.maintainer.abiv2.test

cmake_with_async_export_test:
name: CMake test (without otlp-exporter and with async export)
runs-on: ubuntu-latest
Expand Down
27 changes: 27 additions & 0 deletions ci/do_ci.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,33 @@ switch ($action) {
exit $exit
}
}
"cmake.maintainer.abiv2.test" {
cd "$BUILD_DIR"
cmake $SRC_DIR `
-DWITH_OTLP_GRPC=ON `
-DWITH_OTLP_HTTP=ON `
-DWITH_OTLP_RETRY_PREVIEW=ON `
-DOTELCPP_MAINTAINER_MODE=ON `
-DWITH_NO_DEPRECATED_CODE=ON `
-DWITH_ABI_VERSION_1=OFF `
-DWITH_ABI_VERSION_2=ON `
-DVCPKG_TARGET_TRIPLET=x64-windows `
"-DCMAKE_TOOLCHAIN_FILE=$VCPKG_DIR/scripts/buildsystems/vcpkg.cmake"
$exit = $LASTEXITCODE
if ($exit -ne 0) {
exit $exit
}
cmake --build . -j $nproc
$exit = $LASTEXITCODE
if ($exit -ne 0) {
exit $exit
}
ctest -C Debug
$exit = $LASTEXITCODE
if ($exit -ne 0) {
exit $exit
}
}
"cmake.with_async_export.test" {
cd "$BUILD_DIR"
cmake $SRC_DIR `
Expand Down
51 changes: 49 additions & 2 deletions exporters/etw/include/opentelemetry/exporters/etw/etw_tracer.h
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,7 @@ class Tracer : public opentelemetry::trace::Tracer,
return result;
}

#if OPENTELEMETRY_ABI_VERSION_NO == 1
/**
* @brief Force flush data to Tracer, spending up to given amount of microseconds to flush.
* NOTE: this method has no effect for the realtime streaming Tracer.
Expand All @@ -615,6 +616,7 @@ class Tracer : public opentelemetry::trace::Tracer,
etwProvider().close(provHandle);
}
}
#endif

/**
* @brief Add event data to span associated with tracer.
Expand Down Expand Up @@ -736,7 +738,18 @@ class Tracer : public opentelemetry::trace::Tracer,
/**
* @brief Tracer destructor.
*/
virtual ~Tracer() { CloseWithMicroseconds(0); }
virtual ~Tracer()
{
#if OPENTELEMETRY_ABI_VERSION_NO == 1
CloseWithMicroseconds(0);
#else
// Close once only
if (!isClosed_.exchange(true))
{
etwProvider().close(provHandle);
}
#endif
}
};

/**
Expand Down Expand Up @@ -893,6 +906,34 @@ class Span : public opentelemetry::trace::Span
owner_.AddEvent(*this, name, timestamp, attributes);
}

#if OPENTELEMETRY_ABI_VERSION_NO >= 2

/**
* Add link (ABI).
*
* See comments about sampling in @ref opentelemetry::trace::Span
*
* @since ABI_VERSION 2
*/
void AddLink(const trace::SpanContext & /*target*/,
const common::KeyValueIterable & /*attrs*/) noexcept override
{
// FIXME: What to do with links?
}

/**
* Add links (ABI).
*
* See comments about sampling in @ref opentelemetry::trace::Span
*
* @since ABI_VERSION 2
*/
void AddLinks(const trace::SpanContextKeyValueIterable & /*links*/) noexcept override
{
// FIXME: What to do with links?
}
#endif

/**
* @brief Set Span status
* @param code Span status code.
Expand Down Expand Up @@ -1116,7 +1157,13 @@ class TracerProvider : public opentelemetry::trace::TracerProvider
nostd::shared_ptr<opentelemetry::trace::Tracer> GetTracer(
nostd::string_view name,
nostd::string_view args = "",
nostd::string_view schema_url = "") noexcept override
nostd::string_view schema_url = ""
#if OPENTELEMETRY_ABI_VERSION_NO >= 2
,
// FIXME: This is a temporary workaround to avoid breaking compiling.
const common::KeyValueIterable * /*attributes*/ = nullptr
#endif
) noexcept override
{
UNREFERENCED_PARAMETER(args);
UNREFERENCED_PARAMETER(schema_url);
Expand Down
2 changes: 2 additions & 0 deletions exporters/etw/test/etw_perf_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ class ETWProviderStressTest
void Teardown()
{
span_->End();
# if OPENTELEMETRY_ABI_VERSION_NO == 1
tracer_->CloseWithMicroseconds(0);
# endif
}
};

Expand Down
11 changes: 10 additions & 1 deletion exporters/etw/test/etw_tracer_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,9 @@ TEST(ETWTracer, TracerCheck)
}
EXPECT_NO_THROW(topSpan->End());
}

# if OPENTELEMETRY_ABI_VERSION_NO == 1
EXPECT_NO_THROW(tracer->CloseWithMicroseconds(0));
# endif
}

// Lowest decoration level -> smaller ETW event size.
Expand Down Expand Up @@ -233,7 +234,9 @@ TEST(ETWTracer, TracerCheckMinDecoration)
}
EXPECT_NO_THROW(aSpan->End());
}
# if OPENTELEMETRY_ABI_VERSION_NO == 1
tracer->CloseWithMicroseconds(0);
# endif
}

// Highest decoration level -> larger ETW event size
Expand Down Expand Up @@ -284,7 +287,9 @@ TEST(ETWTracer, TracerCheckMaxDecoration)
}
EXPECT_NO_THROW(aSpan->End());
}
# if OPENTELEMETRY_ABI_VERSION_NO == 1
tracer->CloseWithMicroseconds(0);
# endif
}

TEST(ETWTracer, TracerCheckMsgPack)
Expand Down Expand Up @@ -322,7 +327,9 @@ TEST(ETWTracer, TracerCheckMsgPack)
}
EXPECT_NO_THROW(aSpan->End());
}
# if OPENTELEMETRY_ABI_VERSION_NO == 1
tracer->CloseWithMicroseconds(0);
# endif
}

/**
Expand Down Expand Up @@ -451,8 +458,10 @@ TEST(ETWTracer, GlobalSingletonTracer)
EXPECT_NE(traceId1, traceId2);
EXPECT_EQ(traceId1, traceId3);

# if OPENTELEMETRY_ABI_VERSION_NO == 1
localTracer->CloseWithMicroseconds(0);
globalTracer.CloseWithMicroseconds(0);
# endif
}

TEST(ETWTracer, AlwayOffSampler)
Expand Down
Loading