prometheusopencensus

How does opencensus create metrics?


E.g., if I use prometheus I explicitly create histograms, but I can't see such an option for opencensus


Solution

  • OpenCensus provides equivalent functionality.

    NB OpenCensus and OpenTracing are merging into OpenTelemetry. It remains unclear to me what the evolution will be from OpenCensus to OpenTelemetry.

    In Prometheus the service that exports metrics provides an endpoint that can be scraped (pull metrics). In other monitoring solutions, metrics are pushed to the service. When you configure code to export to Prometheus, an endpoint must also be created to expose these metrics. See:

    https://opencensus.io/exporters/supported-exporters/go/prometheus/

    NB I'm citing Golang examples because you did not include a preference. OpenCensus supports multiple languages but not all languages support all exporters.

    Your code will create >=1 measures that become measurements.

    The only measurements that are persisted are those that are aggregated by a view. And views are where you aggregate measurements into e.g. histograms aka distributions.

    NB I recommend that, if you use OpenCensus, that you use the OpenCensus Agent. The Agent permits you to write general-purpose OpenCensus code (to export to the agent) and then you may configure the Agent to export to e.g. Prometheus. With the Agent, if you decide you want to export to e.g. Stackdriver, you need only reconfigure the Agent rather than augment your code.