Skip to content

Commit

Permalink
ZO-3967: Consolidate importer metrics into vivi_recent_content_publis…
Browse files Browse the repository at this point in the history
…hed_total wit label content (news, video, podcast, tts)
  • Loading branch information
wosc committed Feb 13, 2024
1 parent 0fe2628 commit 86627ec
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
1 change: 1 addition & 0 deletions core/docs/changelog/ZO-3967.change
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ZO-3967: Consolidate importer metrics into vivi_recent_content_published_total wit label content (news, video, podcast, tts)
17 changes: 12 additions & 5 deletions core/src/zeit/retresco/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,18 @@ def elastic(kind):


def _collect_importers():
metric = Gauge('vivi_recent_content_published_total', labelnames=['content'])
queries = {
'vivi_recent_audios_published_total': [{'term': {'doc_type': 'audio'}}],
'vivi_recent_news_published_total': [{'term': {'payload.workflow.product-id': 'News'}}],
'vivi_recent_videos_published_total': [{'term': {'doc_type': 'video'}}],
'podcast': [
{'term': {'doc_type': 'audio'}},
{'term': {'payload.audio.audio_type': 'podcast'}},
],
'tts': [
{'term': {'doc_type': 'audio'}},
{'term': {'payload.audio.audio_type': 'tts'}},
],
'news': [{'term': {'payload.workflow.product-id': 'News'}}],
'video': [{'term': {'doc_type': 'video'}}],
}
for name, query in queries.items():
query = {
Expand All @@ -71,8 +79,7 @@ def _collect_importers():
}
}
}
metric = Gauge(name)
metric.labels(environment()).set(elastic('external').search(query, rows=0).hits)
metric.labels(environment(), name).set(elastic('external').search(query, rows=0).hits)


def _collect_vgwort_report():
Expand Down

0 comments on commit 86627ec

Please sign in to comment.