Learn how to send trace data from your application that uses OpenTelemetry to Tanzu Observability.

OpenTracing and OpenCensus merged to form OpenTelemetry. OpenTelemetry provides a single set of APIs, libraries, agents, and collector services to capture distributed traces, metrics, and logs from your application. If your application uses OpenTelemetry, you can configure the application to send metrics to Tanzu Observability by Wavefront.

Sending Metrics Data to Wavefront

If your application uses OpenTelemetry, you can configure the application to send metrics data to Wavefront. Metrics data includes time series, counters, and histograms. You use the Wavefront Prometheus storage adapter and the Wavefront proxy. Once the data is in Wavefront, you can use charts and dashboards to visualize the data and create alerts.

Here’s how it works: images/tracing_opentelemetry_metrics_data.png

Follow these steps:

  1. Install the Wavefront Proxy.
    Make sure to open port 2878 to send spans and metrics to Wavefront. For example, on Linux, Mac, and Windows, open the wavefront.conf file, uncomment the pushListenerPorts and set it to 2878.
  2. Configure your application to send the metrics/trace data to the OpenTelemetry Collector. See the OpenTelemetry documentation for details.
  3. Export the data from the OpenTelemetry Collector to the Wavefront Prometheus Storage Adapter.


This tutorial uses the OpenTelemetry Collector demo. For steps on how to configure your application to send custom OpenTelemetry metrics to Wavefront, see the registering OpenCensus metric exporter in Java Application.

  1. If you do not have a Wavefront proxy installed on your network, install a proxy.
  2. Configure the demo application to send trace data to the OpenTelemetry Collector.

    1. Clone the OpenTelemetry collector.
       git clone https://github.com/open-telemetry/opentelemetry-collector-contrib.git
    2. Navigate to the opentelemetry-collector-contrib/examples/demo directory via the terminal.
       cd opentelemetry-collector-contrib/examples/demo/
    3. Open the prometheus.yaml file and add the following configurations.

         - url: "http://<enter your IP address>:1234/receive"

      Note: The IP address and port configured in the prometheus.yaml file needs to match configurations in the Prometheus Storage Adapter configured in Step 3 below.

      For example, this is how the prometheus.yaml file looks:

         - job_name: 'otel-collector'
         scrape_interval: 10s
           - targets: ['otel-collector:8889']
           - targets: ['otel-collector:8888']
           - url: "http://<enter your IP address>:1234/receive"
    4. Run docker-compose up -d to start the OpenTelemetry Collector and Prometheus Server. The Prometheus server is exposed on port 9090.
  3. Send the data from the OpenTelemetry Collector to the Wavefront Prometheus integration. This adapter takes the data and forwards it to a Wavefront proxy. Run the Prometheus Storage Adapter as a docker container. The metrics sent to Wavefront has the prom prefix.
     docker run -d -p 1234:1234 wavefronthq/prometheus-storage-adapter -proxy=<enter your IP address> -proxy-port=2878 -listen=1234 -prefix=prom -convert-paths=true

    Tip: Enter http://localhost:1234/health on your browser and run it. If you see {"Message":"OK"}, you have successfully configured the Prometheus Storage Adapter.

  4. Explore the data sent to Wavefront:
    • See the metrics sent in the Metrics browser:
      1. Log in to your Wavefront instance and select Browse > Metrics.
      2. Search for metrics that have a prom prefix. images/tracing_opentelemetry_metrics.png
    • You can create charts and dashboards to see the data that was sent from your application and create alerts. images/tracing_opentelemetry_collector_chart.png

Registering OpenCensus Metric Exporter

Once you have configured your OpenTelemetry Collector to send metric data to Wavefront, you can use the code snippet below to register the OpenCensus metric exporter in a Java application and send custom metrics to Wavefront. See OpenCensus documentation for details on OpenCensus API.

    import io.opencensus.common.Duration;
    import io.opencensus.exporter.metrics.ocagent.OcAgentMetricsExporter;
    import io.opencensus.exporter.metrics.ocagent.OcAgentMetricsExporterConfiguration;
    import io.opencensus.stats.*;
    import io.opencensus.stats.Measure.MeasureLong;
    import io.opencensus.stats.View.Name;
    import io.opencensus.tags.TagKey;

    // Instantiate stats recorder
    private static final StatsRecorder STATS_RECORDER = Stats.getStatsRecorder();

    // Create views
    View[] views = new View[]{...}

    // Create the view manager
    ViewManager viewManager = Stats.getViewManager();

    // Create the view manager
    ViewManager vmgr = Stats.getViewManager();
    // Then finally register the views
    for (View view : views)

    // Setup Exporter
    // Replace `open-telemetry-collector-host` with the OpenTelemetry Collector IP address.
                .setRetryInterval(Duration.create(5, 0))
                .setExportInterval(Duration.create(5, 0))

Next Steps

Next, log in to your Tanzu Observability instance and examine your data in dashboards and charts: