Remove gauge metric
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 25/100
- Issue-Typ
- Bug
- Klarheit
- Muss geklärt werden
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- aws, kubernetes, prometheus, python
- Bereich
- cloud, infrastructure, observability
Rechercherichtung
Die Payload nennt die Gauge-Deklaration und den Aufruf von MetricWrapperBase.remove im Traceback, aber keine Repository-Datei und keinen Test. Beginne damit, die APIs von Gauge und MetricWrapperBase auf das Entfernen von Labels zu prüfen und die gezeigte Exporter-Schleife zu überprüfen. Erledigt ist die Aufgabe, wenn der unterstützte Weg zum Entfernen der Metrik des gelöschten Knotens festgestellt oder bestätigt wurde, dass eine Änderung an der Bibliothek erforderlich ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Hi all,
I have written a custom exporter for calculating the cost of using a node in AWS.
Here is how it works:
Lets assume I have 3 nodes, each costs 5$/ 1h, when I plot using grafana the sum(cost_metric{}) i get 15$ (3x5$). Lets say after 2 hours one of the nodes get deleted (autoscaling). In that case the total cost should drop to 10$.
The problem is that in my case the metric is preserved and even though the node has been deleted the cost is kept and thus it displays 15$ instead of dropping to 10$
How would I go about saving that problem?
cost_metric = Gauge(
"cost_metric ",
"Cost of running an instance for 1 hour",
["node_name", "instance_type"],
)
...
node_names = get_nodes()
for node_name in node_names:
node_info = get_node_info(node_name)
if node_info is None:
continue
logging.info(f"Updating metrics for node: {node_name}")
# labels section
labels = node_info["metadata"]["labels"]
instance_type = labels.get("beta.kubernetes.io/instance-type", "unknown")
cost = get_cost_of_instance(instance_type)
if cost is not None:
cost_metric.labels(node_name=node_name, instance_type=instance_type).set(cost)
I tried
I collected previous and current nodes in form of dict and then wanted to removed the ones that arent existing, the issue is that :
cost_metric.remove(node_name=node_name, instance_type=instance_type)
Traceback (most recent call last):
File "/home/XXXX/projects/main.py", line 154, in <module>
previous_nodes = update_metrics(previous_nodes)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/eksohio/projects/main.py", line 131, in update_metrics
cost.remove(node_name=node_name, instance_type=instance_type)
TypeError: MetricWrapperBase.remove() got an unexpected keyword argument 'node_name'
- Vorherrschende Sprache
- Python
- Sterne
- 4.4k
- Forks
- 876
- Ø Merge
- 8 T. 4 Std.
- Gemergte PRs (30 T.)
- 1
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus prometheus/client_python
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
prometheus/client_python#1177 · 1 Kommentar ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 45/100
prometheus/client_python#1210 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 58/100
prometheus/client_python#1199 · 1 Reaktion ·
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
prometheus/client_python#1176 ·
-
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 52/100
prometheus/client_python#1126 · 2 Kommentare ·
Alle Issues in prometheus/client_python
Ähnliche Issues
-
essnmx good first issue
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 95/100
-
[Feature] 奇物选择添加优先级 Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
syfoud/Simulated_Scepter#174 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
Giskard-AI/giskard-oss#2840 · 1 Kommentar ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success Offenarea: repo bug perceived difficulty: 2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
yeti-platform/yeti#1380 ·