OpenCensus is being archived! Read the blog post to learn more

Prometheus

Introduction

The OpenCensus Service can scrape your applications for stats, just like Prometheus traditionally does.

This makes the OpenCensus Service a drop-in replacement for Prometheus’ scrapers but with the added advantage that now your stats from all sorts of applications can be converted into OpenCensus Metrics and exported to diverse exporters.

Configuration

Following Prometheus’ configuration file guide at Prometheus Configuration

Instead of starting Prometheus with a configuration file, copy the contents of that configuration file.

Format

Paste and indent them under sub-section

receivers:
  prometheus:
    config:
      <the_configuration_in_your_prometheus_config_file.yaml_goes_here>

Example

So for an example YAML file comparing “After” and “Before”:

receivers:
  prometheus:
    config:
      global:
        scrape_interval: 15s
        scrape_timeout: 8s
        external_labels:
          deployment: ml
          api: v2

      scrape_configs:
        - job_name: 'jdbc_pool'
          scrape_interval: 5s
          static_configs:
            - targets: ['localhost:8889']

        - job_name: 'memcached'
          scrape_interval: 8s
          static_configs:
            - targets: ['localhost:9977']
global:
  scrape_interval: 15s
  scrape_timeout: 8s
  external_labels:
    deployment: ml
    api: v2

scrape_configs:
  - job_name: 'jdbc_pool'
    scrape_interval: 5s
    static_configs:
      - targets: ['localhost:8889']

  - job_name: 'memcached'
    scrape_interval: 8s
    static_configs:
      - targets: ['localhost:9977']

And then run the OpenCensus Service normally like you would

References

Resource URL
Prometheus project home https://prometheus.io/
Prometheus Configuration Configuration docs