-
Notifications
You must be signed in to change notification settings - Fork 417
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TEST] Expand api singleton test to cover explicit dlopen(). (#2164)
- Loading branch information
Showing
9 changed files
with
256 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#include "opentelemetry/nostd/shared_ptr.h" | ||
#include "opentelemetry/trace/provider.h" | ||
#include "opentelemetry/version.h" | ||
|
||
namespace trace = opentelemetry::trace; | ||
namespace nostd = opentelemetry::nostd; | ||
|
||
static nostd::shared_ptr<trace::Tracer> get_tracer() | ||
{ | ||
auto provider = trace::Provider::GetTracerProvider(); | ||
return provider->GetTracer("G", "70.7"); | ||
} | ||
|
||
static void f1() | ||
{ | ||
auto scoped_span = trace::Scope(get_tracer()->StartSpan("G::f1")); | ||
} | ||
|
||
static void f2() | ||
{ | ||
auto scoped_span = trace::Scope(get_tracer()->StartSpan("G::f2")); | ||
|
||
f1(); | ||
f1(); | ||
} | ||
|
||
extern "C" | ||
|
||
#if defined(_MSC_VER) | ||
// component_g is a DLL | ||
__declspec(dllexport) | ||
#endif | ||
|
||
void do_something_in_g() | ||
{ | ||
auto scoped_span = trace::Scope(get_tracer()->StartSpan("G::library")); | ||
|
||
f2(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#include "opentelemetry/nostd/shared_ptr.h" | ||
#include "opentelemetry/trace/provider.h" | ||
#include "opentelemetry/version.h" | ||
|
||
namespace trace = opentelemetry::trace; | ||
namespace nostd = opentelemetry::nostd; | ||
|
||
static nostd::shared_ptr<trace::Tracer> get_tracer() | ||
{ | ||
auto provider = trace::Provider::GetTracerProvider(); | ||
return provider->GetTracer("H", "80.8"); | ||
} | ||
|
||
static void f1() | ||
{ | ||
auto scoped_span = trace::Scope(get_tracer()->StartSpan("H::f1")); | ||
} | ||
|
||
static void f2() | ||
{ | ||
auto scoped_span = trace::Scope(get_tracer()->StartSpan("H::f2")); | ||
|
||
f1(); | ||
f1(); | ||
} | ||
|
||
extern "C" | ||
|
||
#if defined(_MSC_VER) | ||
// component_h is a DLL | ||
|
||
__declspec(dllexport) | ||
|
||
#else | ||
// component_h is a shared library (*.so) | ||
// component_h is compiled with visibility("hidden"), | ||
__attribute__((visibility("default"))) | ||
#endif | ||
|
||
void do_something_in_h() | ||
{ | ||
auto scoped_span = trace::Scope(get_tracer()->StartSpan("H::library")); | ||
|
||
f2(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters