github.com/google/cloudprober@v0.11.3/docs/content/surfacers/overview.md (about)

     1  ---
     2  menu:
     3      main:
     4          parent: "Exporting Metrics (Surfacers)"
     5          weight: 20
     6  title: "Surfacers"
     7  date: 2020-11-01T17:24:32-07:00
     8  ---
     9  One of the biggest strengths of cloudprober is that it can export data to multiple monitoring systems, even simultaneously, just based on simple configuration. Cloudprober does that using a built-in mechanism, called surfacers. Each surfacer type implements interface for a specific monitoring system, for example, [_pubsub_](https://github.com/google/cloudprober/blob/master/surfacers/prometheus/proto/config.proto) surfacer publishes data to Google Pub/Sub. You can configure multiple surfacers at the same time. If you don't specify any surfacer, [_prometheus_](https://github.com/google/cloudprober/blob/master/surfacers/prometheus/proto/config.proto) and [_file_](https://github.com/google/cloudprober/blob/master/surfacers/file/proto/config.proto) surfacers are enabled automatically.
    10  
    11  Why other monitoring systems? Cloudprober's main purpose is to run probes and build standard, usable metrics based on the results of those probes. It doesn't take any action on the generated data. Instead, it provides an easy interface to make that probe data available to systems that provide ways to consume monitoring data, for example for graphing and alerting.
    12  
    13  Cloudprober currently supports following surfacer types:
    14  
    15  * Prometheus ([config](https://github.com/google/cloudprober/blob/master/surfacers/prometheus/proto/config.proto))
    16  * [Stackdriver (Google Cloud Monitoring)](/surfacers/stackdriver)
    17  * Google Pub/Sub ([config](https://github.com/google/cloudprober/blob/master/surfacers/pubsub/proto/config.proto))
    18  * Postgres ([config](https://github.com/google/cloudprober/blob/master/surfacers/postgres/proto/config.proto))
    19  * File ([config](https://github.com/google/cloudprober/blob/master/surfacers/file/proto/config.proto))
    20  * [Cloudwatch (AWS Cloud Monitoring)](/surfacers/cloudwatch)
    21  
    22  Source: [surfacers config](https://github.com/google/cloudprober/blob/7bc30b62e42f3fe4e8a2fb8cd0e87ea18b73aeb8/surfacers/proto/config.proto#L14).
    23  
    24  It's easy to add more surfacers without having to understand the internals of cloudprober. You only need to implement the [Surfacer interface](https://github.com/google/cloudprober/blob/7bc30b62e42f3fe4e8a2fb8cd0e87ea18b73aeb8/surfacers/surfacers.go#L87).
    25  
    26  ## Configuration
    27  
    28  Adding surfacers to cloudprober is as easy as adding "surfacer" config stanzas to your config, like the following:
    29  
    30  ```shell
    31  # Enable prometheus and stackdriver surfacers.
    32  
    33  # Make probe metrics available at the URL :<cloudprober_port>/metrics, for
    34  # scraping by prometheus.
    35  surfacer {
    36    type: PROMETHEUS
    37  
    38    prometheus_surfacer {
    39      # Following option adds a prefix to exported metrics, for example,
    40      # "total" metric is exported as "cloudprober_total".
    41      metrics_prefix: "cloudprober_"
    42    }
    43  }
    44  
    45  # Stackdriver (Google Cloud Monitoring) surfacer. No other configuration
    46  # is necessary if running on GCP.
    47  surfacer {
    48    type: STACKDRIVER
    49  }
    50  ```
    51  
    52  ### Filtering Metrics
    53  
    54  It is possible to filter the metrics that the surfacers receive.
    55  
    56  #### Filtering by Label
    57  
    58  Cloudprober can filter the metrics that are published to surfacers. To filter metrics by labels, reference one of the following keys in the surfacer configuration:
    59  
    60  - `allow_metrics_with_label`
    61  - `ignore_metrics_with_label`
    62  
    63  _Note: `ignore_metrics_with_label` takes precedence over `allow_metrics_with_label`._
    64  
    65  For example, to ignore all sysvar metrics:
    66  
    67  ```
    68  surfacer {
    69    type: PROMETHEUS
    70  
    71    ignore_metrics_with_label {
    72      key: "probe",
    73      value: "sysvars",
    74    }
    75  }
    76  ```
    77  Or to only allow metrics from http probes:
    78  
    79  ```
    80  surfacer {
    81    type: PROMETHEUS
    82  
    83    allow_metrics_with_label {
    84      key: "ptype",
    85      value: "http",
    86    }
    87  }
    88  ```
    89  
    90  #### Filtering by Metric Name
    91  
    92  For certain surfacers, cloudprober can filter the metrics that are published by name. The surfacers that support this functionality are:
    93  
    94  - Cloudwatch
    95  - Prometheus
    96  - Stackdriver
    97  
    98  Within the surfacer configuration, the following options are defined:
    99  
   100  - `allow_metrics_with_name`
   101  - `ignore_metrics_with_name`
   102  
   103  _Note: `ignore_metrics_with_name` takes precedence over `allow_metrics_with_name`._
   104  
   105  To filter out all `validation_failure` metrics by name:
   106  
   107  ```
   108  surfacer {
   109    type: PROMETHEUS
   110  
   111    ignore_metrics_with_name: "validation_failure"
   112  }
   113  ```
   114  (Source: https://github.com/google/cloudprober/blob/master/surfacers/proto/config.proto)
   115