Skip to content

Commit

Permalink
chore: metric for batch insight caching state updates (#22776)
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra authored Jun 7, 2024
1 parent c79241d commit a618c6b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions posthog/caching/insight_caching_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
labelnames=["target_cache_age"],
)

INSIGHT_CACHING_STATES_UPSERTED_COUNT = Counter(
"insight_cache_state_upserted_count",
"Count of insight caching states upserted, this is the success signal",
)


# :TODO: Make these configurable
class TargetCacheAge(Enum):
Expand Down Expand Up @@ -278,3 +283,4 @@ def _execute_insert(states: list[Optional[InsightCachingState]]):
with connection.cursor() as cursor:
query = INSERT_INSIGHT_CACHING_STATES_QUERY.format(values=", ".join(values))
cursor.execute(query, params=params)
INSIGHT_CACHING_STATES_UPSERTED_COUNT.inc(cursor.rowcount)

0 comments on commit a618c6b

Please sign in to comment.