Skip to content

Commit 60c1806

Browse files
committed
Fix "call once" logic of set_build_info
1 parent 8431a94 commit 60c1806

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/autometrics/tracker/opentelemetry.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ def __histogram(
128128
def set_build_info(self, commit: str, version: str):
129129
"""Observe the build info."""
130130
if not self._has_set_build_info:
131+
self._has_set_build_info = True
131132
self.__up_down_counter_instance.add(
132133
1.0,
133134
attributes={

src/autometrics/tracker/prometheus.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ def _histogram(
106106
def set_build_info(self, commit: str, version: str):
107107
"""Observe the build info. Should only be called once per tracker instance"""
108108
if not self._has_set_build_info:
109+
self._has_set_build_info = True
109110
self.prom_gauge.labels(commit, version).set(1)
110111

111112
# def start(self, function: str = None, module: str = None):

0 commit comments

Comments
 (0)