consul: allow for customizing tags, add scope

Without scope we can't select which metrics we want to collect.
This is especially important for `eth2.prod` which has it's own
Prometheus instance and its metrics should not go to our main cluster.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2022-08-16 16:16:24 +02:00
parent 30e6a08e9b
commit 21770167cd
No known key found for this signature in database
GPG Key ID: 09AA5403E54D9931
2 changed files with 17 additions and 5 deletions

View File

@ -14,6 +14,18 @@ geth_expo_cont_name: '{{ geth_expo_service_name }}-exporter'
geth_expo_cont_addr: '0.0.0.0'
geth_expo_cont_port: 9200
# Consul config
geth_expo_consul_service_name: 'geth-exporter'
geth_expo_consul_scope: 'main'
geth_expo_consul_default_tags:
- 'geth'
- 'exporter'
- 'metrics'
- 'scope:{{ geth_expo_consul_scope }}'
- '{{ env }}.{{ stage }}'
geth_expo_consul_extra_tags: []
geth_expo_consul_tags: '{{ geth_expo_consul_default_tags + geth_expo_consul_extra_tags }}'
# general container management
compose_recreate: 'smart'
compose_state: 'present'

View File

@ -5,15 +5,15 @@
consul_config_name: '{{ geth_expo_cont_name }}'
consul_services:
# Prometheus config expects this service name
- name: 'geth-exporter'
id: '{{ geth_expo_cont_name }}'
- id: '{{ geth_expo_cont_name }}'
name: '{{ geth_expo_consul_service_name }}'
tags: '{{ geth_expo_consul_tags }}'
port: '{{ geth_expo_cont_port }}'
address: '{{ ansible_local.wireguard.vpn_ip }}'
tags: ['{{ geth_expo_cont_name }}', 'metrics', 'geth']
meta:
container: '{{ geth_expo_source_cont_name | mandatory }}'
checks:
- id: '{{ geth_expo_cont_name }}-health'
name: 'geth-exporter healthcheck'
type: http
name: '{{ geth_expo_consul_service_name }} healthcheck'
type: 'http'
http: 'http://localhost:{{ geth_expo_cont_port }}/health'