30 lines
846 B
C++
30 lines
846 B
C++
#include <Void/Observability/Observability.hpp>
|
|
|
|
#include <memory>
|
|
|
|
int main()
|
|
{
|
|
auto reg = Void::Observability::MetricRegistry::create();
|
|
if (!reg) {
|
|
return 1;
|
|
}
|
|
auto ctr = reg->register_instrument(Void::Observability::InstrumentSpec{
|
|
.name = "consumer_ops",
|
|
.unit = "1",
|
|
.kind = Void::Observability::MetricKind::counter});
|
|
if (!ctr || !reg->add_counter(*ctr, 1)) {
|
|
return 2;
|
|
}
|
|
auto exp = std::make_shared<Void::Observability::TextSnapshotExporter>();
|
|
auto tr = Void::Observability::Tracer::create({}, exp);
|
|
if (!tr) {
|
|
return 3;
|
|
}
|
|
auto sp = tr->start_span(
|
|
Void::Observability::ContextSnapshot{},
|
|
Void::Observability::SpanSpec{.name = "root"});
|
|
sp.end();
|
|
const auto rep = tr->close();
|
|
return rep.failed_spans == 0 ? 0 : 4;
|
|
}
|