diff --git a/README.md b/README.md index 13db49c..dff0a65 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,23 @@ This tool provides an API that can be used to get the usage for each metrics col } ``` +## How to use it + +### Central Usage + +Metrics Usage can be used as a central way. That means you have a stateful instance that will pull the data from every source. + +![Architecture overview](docs/architecture/central_architecture_usage.svg) + +### Using sidecar container for the rules + +Pulling the various rules through a central Thanos can ended up to fail because there are too many. +And listing every Thanos Ruler or every Prometheus is horrible to maintain, +that's why we are offering a way to use metrics_usage as a sidecar container. +Like that, you can configure it to push the data to a central instance. + +![Architecture overview](docs/architecture/sidecar_rules_usage.svg) + ## Available Collectors There is a various way to collect the metric usage, here the complete list of the available collectors: @@ -125,7 +142,7 @@ Example: ```yaml perses_collector: enable: true - http_client: + perses_client: url: "https://demo.perses.dev" ``` @@ -142,7 +159,7 @@ Example: ```yaml grafana_collector: enable: true - http_client: + grafana_client: url: "https//demo.grafana.dev" ``` diff --git a/docs/architecture/central_architecture_usage.svg b/docs/architecture/central_architecture_usage.svg new file mode 100644 index 0000000..02de8d0 --- /dev/null +++ b/docs/architecture/central_architecture_usage.svg @@ -0,0 +1,4 @@ + + + +
metrics_usage
Grafana
Perses
Prometheus
collect metrics
collect rules
collect dashboards
metric_collector:
  enable: true
  prometheus_client:
    url: "https://prometheus.foo"
Thanos Ruler
Thanos-logo_full
Thanos Ruler
Thanos-logo_full
rules_collectors:
  - enable: true
    prometheus_client:
      url: "https://prometheus.foo"
  - enable: true
    prometheus_client:
      url: "https://thanos-ruler1.foo
  - enable: true
    prometheus_client:
      url: "https://thanos-ruler2.foo


perses_collector:
  enable: true
  perses_client:
    url: "https://demo.perses.dev"
grafana_collector:
  enable: true
  grafana_client:
    url: "https://demo.grafana.dev"
\ No newline at end of file diff --git a/docs/architecture/central_architecture_usage.xml b/docs/architecture/central_architecture_usage.xml new file mode 100644 index 0000000..458ef43 --- /dev/null +++ b/docs/architecture/central_architecture_usage.xml @@ -0,0 +1,2 @@ + +7VvZkqM2FP0aV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yc7QjqFV+YQPfVNZ8fxfE/veVi+ncvP+3xTOCXAIp/hWKeaiPGLmfPhjnxCQ0jnQbUyL8pNhP4wn7ftP45156lYPeu51L4v9Ol9IY35kmjz3r15LoP1qzB4GvfI+8nxsxi/q0y5Yp0/iRHW96pa6+1PAF+War07GOw7SkytWhu9ZHunYrdl66FTg+b2svLTdOt9Kbn44voi6BRdXQaZJRyrLhk0n/pAbPh1wRnwJ7jS8x/+Bzd1DJGGRMzjv8Ga/HWN2/vs1x4Avj0A/GlxvxL/0HMJ2Oz6uiByRJ/vD/rahaA/4uvX6d9UdhVd56rI52r57t+aK82m+edw48N/ \ No newline at end of file diff --git a/docs/architecture/diagram_note.md b/docs/architecture/diagram_note.md new file mode 100644 index 0000000..82c38f1 --- /dev/null +++ b/docs/architecture/diagram_note.md @@ -0,0 +1,7 @@ +The architecture image was drawn on https://app.diagrams.net/. The native draw.io +source file is called `central_architecture_usage.xml`, while `central_architecture_usage.svg` is its SVG +export. Same apply for `sidecar_rules_usage.xml` + +To change the usages diagram, go to https://app.diagrams.net/ and import the +XML source file. After making changes to the diagram, export the result as SVG. +Update both the source file and the SVG export in this directory. diff --git a/docs/architecture/sidecar_rules_usage.svg b/docs/architecture/sidecar_rules_usage.svg new file mode 100644 index 0000000..d0269b6 --- /dev/null +++ b/docs/architecture/sidecar_rules_usage.svg @@ -0,0 +1,4 @@ + + + +
central metrics_usage
Grafana
Perses
Prometheus
collect metrics
collect dashboards
metric_collector:
  enable: true
  prometheus_client:
    url: "https://thanos-querier.foo"
Thanos Ruler
Thanos-logo_full
Thanos Ruler
Thanos-logo_full
rules_collectors:
  - enable: true
    metrics_usage_client:
      url: "https://central_metrics_usage.foo"
    prometheus_client:
      url: "https://thanos-ruler1.foo


perses_collector:
  enable: true
  perses_client:
    url: "https://demo.perses.dev"
grafana_collector:
  enable: true
  grafana_client:
    url: "https://demo.grafana.dev"
Prometheus
Thanos Querier
Thanos-logo_full
sidecar metric_usage
sidecar metric_usage
rules_collectors:
  - enable: true
    metrics_usage_client:
      url: "https://central_metrics_usage.foo"
    prometheus_client:
      url: "https://thanos-ruler2.foo


push metrics usage
get rules
sidecar metric_usage
sidecar metric_usage
get rules
get rules
get rules
rules_collectors:
  - enable: true
    metrics_usage_client:
      url: "https://central_metrics_usage.foo"
    prometheus_client:
      url: "https://prometheus1.foo


rules_collectors:
  - enable: true
    metrics_usage_client:
      url: "https://central_metrics_usage.foo"
    prometheus_client:
      url: "https://prometheus2.foo


\ No newline at end of file diff --git a/docs/architecture/sidecar_rules_usage.xml b/docs/architecture/sidecar_rules_usage.xml new file mode 100644 index 0000000..f88ad80 --- /dev/null +++ b/docs/architecture/sidecar_rules_usage.xml @@ -0,0 +1,2 @@ + +7V1bk6M2Fv41rtp9MAWI62N3T3r3IcnO7iSVmX3pEiDbZLBFAPdlfn0kbgZJYGyDwd30S4MQQjrnO9K5SV6Ah+3rvyIYbn7BHgoWquy9LsCnhaoqGpDJP1rylpWYJsgK1pHv5ZUOBV/8HygvzN9b730PxbWKCcZB4of1QhfvdshNamUwivBLvdoKB/WvhnCNuIIvLgz40j98L9lkpZZqHsr/jfz1pviyYtjZky0sKucjiTfQwy+VIvDTAjxEGCfZ1fb1AQWUeAVdsvceG56WHYvQLunywn34/28avPv6zYudIPkjWP76w1nmrTzDYJ8P2CXNRZC+uEVJ5Lvx0z6mNMrGkLwVhIlf/G0Ad+Tu/mXjJ+hLCF366IXggJRtkm1A7hRymX8CRQl6bey7UlKEQAlh+u03UiV/wcppmINIKWj6cmCJUiBmU2NHXghzGKzLpg+UIhc5sU4gHOAIx1NoA0N66W9TjN1TCvgEWT9DBwWfcewnPt6R5w5OErwlFQL64B6639cR3u+8BxzgiDz30Arug6TSwl3gr+mbCaakhnGYIX/lvyLS5/v0g3dFqVyUkOtNklC5uaNjVx8j+CKt/WSzd/YxiogEJYQdkkv6oj6GKIqJ3FUuLNcDFnRkpLsIwJWnm7YFNdPSVo6t6ipCCtQN19BIVQ+79I30q4c2ngK8xk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