Skip to content

Commit

Permalink
Add a simple example for the tracer workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Tax authored and ankit-bhargava committed Jun 11, 2020
1 parent 9e5924c commit ea487bf
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions examples/simple/library.cc
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.

0 comments on commit ea487bf

Please sign in to comment.