Fix #53 — Ability to show replica name in tooltip

pull/128/head
Valerian Saliou 4 months ago
parent c80186db48
commit bc07acfb74
No known key found for this signature in database
GPG Key ID: C648A8138046772A

@ -302,6 +302,7 @@ Use the sample [config.cfg](https://github.com/valeriansaliou/vigil/blob/master/
* `http_method` (type _string_, allowed: `GET`, `HEAD`, `POST`, `PUT`, `PATCH`, no default) — HTTP method to use when polling the endpoint (omitting this will default to using `HEAD` or `GET` depending on the `http_body_healthy_match` configuration value)
* `http_body` (type _string_, allowed: any string, no default) — Body to send in the HTTP request when polling an endpoint (this only works if `http_method` is set to `POST`, `PUT` or `PATCH`)
* `http_body_healthy_match` (type: _string_, allowed: regular expressions, no default) — HTTP response body for which to report node replica as `healthy` (if the body does not match, the replica will be reported as `dead`, even if the status code check passes; the check uses a `GET` rather than the usual `HEAD` if this option is set)
* `reveal_replica_name` (type: _boolean_, allowed: `true`, `false`, default: `false`) — Whether to reveal replica name on public status page or not (this can be a security risk if a replica URL is to be kept secret)
* `rabbitmq_queue` (type: _string_, allowed: RabbitMQ queue names, no default) — RabbitMQ queue associated to node, which to check against for pending payloads via RabbitMQ API (this helps monitor unacked payloads accumulating in the queue)
* `rabbitmq_queue_nack_healthy_below` (type: _integer_, allowed: any number, no default) — Maximum number of payloads in RabbitMQ queue associated to node, with status `nack` to consider node `healthy` (this overrides the global `plugins.rabbitmq.queue_nack_healthy_below`)
* `rabbitmq_queue_nack_dead_above` (type: _integer_, allowed: any number, no default) — Threshold on the number of payloads in RabbitMQ queue associated to node, with status `nack` above which node should be considered `dead` (stalled queue, this overrides the global `plugins.rabbitmq.queue_nack_dead_above`)

@ -212,6 +212,7 @@ label = "Relay nodes"
id = "socket-client"
label = "Visitor realtime sockets"
mode = "push"
reveal_replica_name = true
rabbitmq_queue = "client"
rabbitmq_queue_nack_healthy_below = 100
rabbitmq_queue_nack_dead_above = 1000

@ -149,7 +149,7 @@
<label class="font-sans-semibold status-{{ node.status | escape }}-background-subtle status-{{ node.status | escape }}-border-subtle">{{ node.label | escape }}</label>
<div class="node">
{% for _, replica in node.replicas %}
{% for replica_id, replica in node.replicas %}
<span class="replica status-{{ replica.status | escape }}-background has-tooltip font-sans-semibold">
{{ loop.index }}
@ -179,6 +179,10 @@
</span>
</span>
{% if node.reveal_replica_name %}
<span class="tooltip-value-details font-sans-light">{{ replica_id }}</span>
{% endif %}
{% if replica.metrics.system or replica.metrics.latency or replica.metrics.latency == 0 or replica.metrics.rabbitmq %}
<span class="tooltip-value-details">
{% if replica.metrics.system %}

@ -81,7 +81,7 @@ pub struct ConfigMetrics {
#[serde(default = "defaults::metrics_poll_delay_sick")]
pub poll_delay_sick: u64,
#[serde(default = "defaults::poll_parallelism")]
#[serde(default = "defaults::metrics_poll_parallelism")]
pub poll_parallelism: u16,
#[serde(default = "defaults::metrics_push_delay_dead")]
@ -297,12 +297,18 @@ pub struct ConfigProbeServiceNode {
pub mode: Mode,
pub replicas: Option<Vec<String>>,
pub scripts: Option<Vec<String>>,
#[serde(default)]
#[serde(with = "http_serde::header_map")]
pub http_headers: http::HeaderMap,
pub http_method: Option<ConfigProbeServiceNodeHTTPMethod>,
pub http_body: Option<String>,
pub http_body_healthy_match: Option<Regex>,
#[serde(default = "defaults::probe_service_node_reveal_replica_name")]
pub reveal_replica_name: bool,
pub rabbitmq_queue: Option<String>,
pub rabbitmq_queue_nack_healthy_below: Option<u32>,
pub rabbitmq_queue_nack_dead_above: Option<u32>,

@ -53,7 +53,7 @@ pub fn metrics_poll_delay_sick() -> u64 {
5
}
pub fn poll_parallelism() -> u16 {
pub fn metrics_poll_parallelism() -> u16 {
4
}
@ -112,3 +112,7 @@ pub fn notify_slack_mention_channel() -> bool {
pub fn notify_generic_reminders_only() -> bool {
false
}
pub fn probe_service_node_reveal_replica_name() -> bool {
false
}

@ -873,6 +873,7 @@ pub fn initialize_store() {
http_method: node.http_method.to_owned(),
http_body: node.http_body.to_owned(),
http_body_healthy_match: node.http_body_healthy_match.to_owned(),
reveal_replica_name: node.reveal_replica_name,
rabbitmq: node.rabbitmq_queue.as_ref().map(|queue| {
ServiceStatesProbeNodeRabbitMQ {
queue: queue.to_owned(),

@ -41,6 +41,7 @@ pub struct ServiceStatesProbeNode {
pub http_method: Option<ConfigProbeServiceNodeHTTPMethod>,
pub http_body: Option<String>,
pub http_body_healthy_match: Option<Regex>,
pub reveal_replica_name: bool,
pub rabbitmq: Option<ServiceStatesProbeNodeRabbitMQ>,
}

Loading…
Cancel
Save