Remove gauge metric
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 25/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- aws, kubernetes, prometheus, python
調査の方向性
payload には、traceback 内の Gauge 宣言と MetricWrapperBase.remove の呼び出しが示されていますが、リポジトリのファイルやテストは示されていません。まず、label の削除に関する Gauge と MetricWrapperBase の API を確認し、示されている exporter ループを確認してください。削除されたノードのメトリクスを削除するサポートされた方法を確立するか、ライブラリの変更が必要であることを確認できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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'
- 主要言語
- Python
- スター
- 4.4k
- フォーク
- 876
- 平均マージ
- 8日 4時間
- マージ済み PR(30日)
- 1
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
prometheus/client_python のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
prometheus/client_python#1177 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
prometheus/client_python#1210 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 58/100
prometheus/client_python#1199 · リアクション 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
prometheus/client_python#1176 ·
-
難易度 1/5 1〜3時間 初心者へのやさしさ 52/100
prometheus/client_python#1126 · コメント 2 件 ·
prometheus/client_python の issue をすべて見る
似ている issue
-
essnmx good first issue
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
-
[Feature] 奇物选择添加优先级 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
syfoud/Simulated_Scepter#174 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Giskard-AI/giskard-oss#2840 · コメント 1 件 ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success オープンarea: repo bug perceived difficulty: 2
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
yeti-platform/yeti#1380 ·