Commit 472c7127 authored by David Goulet's avatar David Goulet 🐼
Browse files

Merge branch 'maint-0.4.5' into maint-0.4.6

parents 5afdc851 9efb04bb
Loading
Loading
Loading
Loading

changes/ticket40581

0 → 100644
+4 −0
Original line number Diff line number Diff line
  o Minor bugfixes (metrics port, onion service):
    - Fix the metrics with a port label to be unique. Before this, all ports of
      an onion service would be on the same line which violates the Prometheus
      rules of unique labels. Fixes bug 40581; bugfix on 0.4.5.1-alpha.
+15 −8
Original line number Diff line number Diff line
@@ -59,6 +59,10 @@ init_store(hs_service_t *service)
  store = service->metrics.store;

  for (size_t i = 0; i < base_metrics_size; ++i) {
    /* Add entries with port as label. We need one metric line per port. */
    if (base_metrics[i].port_as_label && service->config.ports) {
      SMARTLIST_FOREACH_BEGIN(service->config.ports,
                              const hs_port_config_t *, p) {
        metrics_store_entry_t *entry =
          metrics_store_add(store, base_metrics[i].type, base_metrics[i].name,
                            base_metrics[i].help);
@@ -66,12 +70,15 @@ init_store(hs_service_t *service)
        /* Add labels to the entry. */
        metrics_store_entry_add_label(entry,
                format_label("onion", service->onion_address));
    if (base_metrics[i].port_as_label && service->config.ports) {
      SMARTLIST_FOREACH_BEGIN(service->config.ports,
                              const hs_port_config_t *, p) {
        metrics_store_entry_add_label(entry,
                format_label("port", port_to_str(p->virtual_port)));
      } SMARTLIST_FOREACH_END(p);
    } else {
      metrics_store_entry_t *entry =
        metrics_store_add(store, base_metrics[i].type, base_metrics[i].name,
                          base_metrics[i].help);
      metrics_store_entry_add_label(entry,
              format_label("onion", service->onion_address));
    }
  }
}