nucliadb 6.8.0.post4923__py3-none-any.whl → 6.8.0.post4925__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of nucliadb might be problematic. Click here for more details.
- nucliadb/metrics_exporter.py +16 -3
- {nucliadb-6.8.0.post4923.dist-info → nucliadb-6.8.0.post4925.dist-info}/METADATA +6 -6
- {nucliadb-6.8.0.post4923.dist-info → nucliadb-6.8.0.post4925.dist-info}/RECORD +6 -6
- {nucliadb-6.8.0.post4923.dist-info → nucliadb-6.8.0.post4925.dist-info}/WHEEL +0 -0
- {nucliadb-6.8.0.post4923.dist-info → nucliadb-6.8.0.post4925.dist-info}/entry_points.txt +0 -0
- {nucliadb-6.8.0.post4923.dist-info → nucliadb-6.8.0.post4925.dist-info}/top_level.txt +0 -0
nucliadb/metrics_exporter.py
CHANGED
|
@@ -37,6 +37,9 @@ MIGRATION_COUNT = metrics.Gauge("nucliadb_migration", labels={"type": "", "versi
|
|
|
37
37
|
|
|
38
38
|
PENDING_RESOURCE_COUNT = metrics.Gauge("nucliadb_pending_resources_count")
|
|
39
39
|
|
|
40
|
+
KBS_COUNT = metrics.Gauge("nucliadb_kbs_count")
|
|
41
|
+
RESOURCES_COUNT = metrics.Gauge("nucliadb_resources_count")
|
|
42
|
+
|
|
40
43
|
|
|
41
44
|
async def iter_kbids(context: ApplicationContext) -> AsyncGenerator[str, None]:
|
|
42
45
|
"""
|
|
@@ -47,9 +50,11 @@ async def iter_kbids(context: ApplicationContext) -> AsyncGenerator[str, None]:
|
|
|
47
50
|
yield kbid
|
|
48
51
|
|
|
49
52
|
|
|
50
|
-
async def
|
|
53
|
+
async def update_kb_metrics(context: ApplicationContext):
|
|
51
54
|
"""
|
|
52
|
-
Report
|
|
55
|
+
Report metrics at the kb level:
|
|
56
|
+
- total number of KBs
|
|
57
|
+
- the global migration version and the number of KBs per migration version.
|
|
53
58
|
"""
|
|
54
59
|
# Clear previoulsy set values so that we report only the current state
|
|
55
60
|
MIGRATION_COUNT.gauge.clear()
|
|
@@ -60,12 +65,16 @@ async def update_migration_metrics(context: ApplicationContext):
|
|
|
60
65
|
MIGRATION_COUNT.set(1, labels=dict(type="global", version=str(global_info.current_version)))
|
|
61
66
|
|
|
62
67
|
version_count: dict[str, int] = {}
|
|
68
|
+
n_kbs = 0
|
|
63
69
|
async for kbid in iter_kbids(context):
|
|
64
70
|
kb_info = await mdm.get_kb_info(kbid)
|
|
65
71
|
if kb_info is not None:
|
|
66
72
|
current_version = str(kb_info.current_version)
|
|
67
73
|
version_count.setdefault(current_version, 0)
|
|
68
74
|
version_count[current_version] += 1
|
|
75
|
+
n_kbs += 1
|
|
76
|
+
|
|
77
|
+
KBS_COUNT.set(n_kbs)
|
|
69
78
|
|
|
70
79
|
for version, count in version_count.items():
|
|
71
80
|
MIGRATION_COUNT.set(count, labels=dict(type="kb", version=version))
|
|
@@ -88,6 +97,10 @@ async def update_resource_metrics(context: ApplicationContext):
|
|
|
88
97
|
count = cast(Tuple[int], await cur.fetchone())[0]
|
|
89
98
|
PENDING_RESOURCE_COUNT.set(count)
|
|
90
99
|
|
|
100
|
+
await cur.execute("SELECT COUNT(*) FROM catalog")
|
|
101
|
+
count = cast(Tuple[int], await cur.fetchone())[0]
|
|
102
|
+
RESOURCES_COUNT.set(count)
|
|
103
|
+
|
|
91
104
|
|
|
92
105
|
async def run_exporter_task(context: ApplicationContext, exporter_task: Callable, interval: int):
|
|
93
106
|
"""
|
|
@@ -109,7 +122,7 @@ async def run_exporter(context: ApplicationContext):
|
|
|
109
122
|
# Schedule exporter tasks
|
|
110
123
|
tasks = []
|
|
111
124
|
for export_task, interval in [
|
|
112
|
-
(
|
|
125
|
+
(update_kb_metrics, 60 * 3),
|
|
113
126
|
(update_resource_metrics, 60 * 5),
|
|
114
127
|
]:
|
|
115
128
|
tasks.append(asyncio.create_task(run_exporter_task(context, export_task, interval=interval)))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nucliadb
|
|
3
|
-
Version: 6.8.0.
|
|
3
|
+
Version: 6.8.0.post4925
|
|
4
4
|
Summary: NucliaDB
|
|
5
5
|
Author-email: Nuclia <nucliadb@nuclia.com>
|
|
6
6
|
License-Expression: AGPL-3.0-or-later
|
|
@@ -19,11 +19,11 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
19
19
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
20
20
|
Requires-Python: <4,>=3.9
|
|
21
21
|
Description-Content-Type: text/markdown
|
|
22
|
-
Requires-Dist: nucliadb-telemetry[all]>=6.8.0.
|
|
23
|
-
Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.8.0.
|
|
24
|
-
Requires-Dist: nucliadb-protos>=6.8.0.
|
|
25
|
-
Requires-Dist: nucliadb-models>=6.8.0.
|
|
26
|
-
Requires-Dist: nidx-protos>=6.8.0.
|
|
22
|
+
Requires-Dist: nucliadb-telemetry[all]>=6.8.0.post4925
|
|
23
|
+
Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.8.0.post4925
|
|
24
|
+
Requires-Dist: nucliadb-protos>=6.8.0.post4925
|
|
25
|
+
Requires-Dist: nucliadb-models>=6.8.0.post4925
|
|
26
|
+
Requires-Dist: nidx-protos>=6.8.0.post4925
|
|
27
27
|
Requires-Dist: nucliadb-admin-assets>=1.0.0.post1224
|
|
28
28
|
Requires-Dist: nuclia-models>=0.47.0
|
|
29
29
|
Requires-Dist: uvicorn[standard]
|
|
@@ -48,7 +48,7 @@ migrations/pg/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
|
|
|
48
48
|
nucliadb/__init__.py,sha256=_abCmDJ_0ku483Os4UAjPX7Nywm39cQgAV_DiyjsKeQ,891
|
|
49
49
|
nucliadb/health.py,sha256=UIxxA4oms4HIsCRZM_SZsdkIZIlgzmOxw-qSHLlWuak,3465
|
|
50
50
|
nucliadb/learning_proxy.py,sha256=ZFCb4sTWGmNE1SNNAF2eJEcFksn1VMW7AD8-vu7o_U4,19294
|
|
51
|
-
nucliadb/metrics_exporter.py,sha256=
|
|
51
|
+
nucliadb/metrics_exporter.py,sha256=CdfDqKqR-4xMjZxITl6F6mV539iXVsF5ovXCPHjKp40,5341
|
|
52
52
|
nucliadb/openapi.py,sha256=dI5hHSUs2oHf4fd27gGagVltWfjVZPIoVqMtIN04VJk,2290
|
|
53
53
|
nucliadb/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
54
54
|
nucliadb/backups/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
|
|
@@ -379,8 +379,8 @@ nucliadb/writer/tus/local.py,sha256=7jYa_w9b-N90jWgN2sQKkNcomqn6JMVBOVeDOVYJHto,
|
|
|
379
379
|
nucliadb/writer/tus/s3.py,sha256=vu1BGg4VqJ_x2P1u2BxqPKlSfw5orT_a3R-Ln5oPUpU,8483
|
|
380
380
|
nucliadb/writer/tus/storage.py,sha256=ToqwjoYnjI4oIcwzkhha_MPxi-k4Jk3Lt55zRwaC1SM,2903
|
|
381
381
|
nucliadb/writer/tus/utils.py,sha256=MSdVbRsRSZVdkaum69_0wku7X3p5wlZf4nr6E0GMKbw,2556
|
|
382
|
-
nucliadb-6.8.0.
|
|
383
|
-
nucliadb-6.8.0.
|
|
384
|
-
nucliadb-6.8.0.
|
|
385
|
-
nucliadb-6.8.0.
|
|
386
|
-
nucliadb-6.8.0.
|
|
382
|
+
nucliadb-6.8.0.post4925.dist-info/METADATA,sha256=Of26ErA1L2l3SsuBlrfG_O1ywcdnjx4K_eXiJvqSbZs,4158
|
|
383
|
+
nucliadb-6.8.0.post4925.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
384
|
+
nucliadb-6.8.0.post4925.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
|
|
385
|
+
nucliadb-6.8.0.post4925.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
|
|
386
|
+
nucliadb-6.8.0.post4925.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|