Skip to main content
One initialisation function sends logs, metrics, and traces from your C++ application to Bronto. All three providers share a single Resource, so telemetry from the process carries one identity. The application exports to an OpenTelemetry Collector, which forwards to Bronto. If you don’t run a Collector, export directly to Bronto instead — only the URL and an API key header change.
C++ has no automatic bridge from a popular logging library (spdlog, glog) in the official SDK, and auto-instrumentation coverage is thinner than in other languages. Log records are emitted through the OTel logs API directly, as shown below. Check the OpenTelemetry C++ registry for community bridges and instrumentation.

Prerequisites

  • C++14 or later, CMake 3.12 or later
  • vcpkg or Conan, or a manual build of opentelemetry-cpp
  • An OTel Collector reachable from your application, with logs, metrics, and traces pipelines forwarding to Bronto — see Connect OpenTelemetry Collector to Bronto

Install dependencies

Link the components for all three signals in your CMakeLists.txt:
CMakeLists.txt

Initialise the SDK

Call InitOtel() once at startup, before any span or log emission:
otel.cpp
The metrics factory signatures vary across opentelemetry-cpp releases more than the logs and traces ones. If the block above doesn’t compile against your build, check the metrics example for your version in the opentelemetry-cpp repository.
Two resource attributes determine how Bronto organises your data:
http://localhost:4318 is the standard OTLP/HTTP address for a Collector on the same host. Use the address reachable from your application if the Collector runs in another container, pod, or host. No authentication is needed between the application and the Collector — the Collector holds the Bronto API key.

Instrument your application

main.cpp
A log record emitted inside an active span picks up that span’s trace_id and span_id from the current context, so you can jump from a log line to its trace in Bronto.

Verify

Run your application, then check each signal in Bronto, filtering by the service.name you set:
  • Logs — the Search page, in the dataset named after your service
  • Metrics — the Metric Explorer
  • Traces — the Explore Traces page
If nothing arrives:
  • Confirm the Collector is running and reachable at the configured URL, and that its pipelines include an otlp receiver and the Bronto exporters.
  • Confirm InitOtel() runs before the first log or span.
  • The batch processors export on a background thread — call ForceFlush() before exit so short-lived programs flush.
For signal-specific reference material, see Send Metrics to Bronto and Send Traces to Bronto.

Direct export to Bronto

Without a Collector, the application exports straight to Bronto over OTLP/HTTP. Point the endpoint at your Bronto region and add your API key to each exporter’s options:
Apply the same http_headers insert to metric_opts and trace_opts. See API Keys for how to create a key with ingestion permissions.
Prefer the Collector for multi-service environments — it batches, filters, and enriches telemetry, and keeps the API key out of every application. Direct export suits single services and simple architectures.

GenAI semantic conventions

If your application calls an LLM, OpenTelemetry’s GenAI semantic conventions define gen_ai.* span attributes for model, token usage, and prompt and response content.

Manual spans

There is no first-party GenAI instrumentation for C++, so set the attributes yourself around each model call:
Message content (gen_ai.input.messages / gen_ai.output.messages) is opt-in by convention and off by default in the languages that have auto-instrumentation. Since you are setting attributes by hand, apply the same discipline — gate prompt and response content behind your own config flag rather than always sending it. See the GenAI span conventions for the full attribute list. For the recommended attribute set and Bronto search queries, see LLM Observability.