-
Notifications
You must be signed in to change notification settings - Fork 410
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a simple example for the tracer workflow
- Loading branch information
1 parent
9e5924c
commit ea487bf
Showing
2 changed files
with
30 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include "opentelemetry/trace/provider.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(""); | ||
} | ||
|
||
static void f1() | ||
{ | ||
auto span = get_tracer()->StartSpan("f1"); | ||
} | ||
|
||
static void f2() | ||
{ | ||
auto span = get_tracer()->StartSpan("f2"); | ||
|
||
f1(); | ||
f1(); | ||
} | ||
|
||
void library() | ||
{ | ||
auto span = get_tracer()->StartSpan("library"); | ||
|
||
f2(); | ||
} |
Binary file not shown.