kinto 21.1.0__py3-none-any.whl → 21.1.1__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 kinto might be problematic. Click here for more details.
- kinto/core/initialization.py +18 -17
- {kinto-21.1.0.dist-info → kinto-21.1.1.dist-info}/METADATA +1 -1
- {kinto-21.1.0.dist-info → kinto-21.1.1.dist-info}/RECORD +7 -7
- {kinto-21.1.0.dist-info → kinto-21.1.1.dist-info}/WHEEL +0 -0
- {kinto-21.1.0.dist-info → kinto-21.1.1.dist-info}/entry_points.txt +0 -0
- {kinto-21.1.0.dist-info → kinto-21.1.1.dist-info}/licenses/LICENSE +0 -0
- {kinto-21.1.0.dist-info → kinto-21.1.1.dist-info}/top_level.txt +0 -0
kinto/core/initialization.py
CHANGED
|
@@ -472,10 +472,18 @@ def setup_metrics(config):
|
|
|
472
472
|
auth, user_id = user_id.split(":")
|
|
473
473
|
metrics_service.count("users", unique=[("auth", auth), ("userid", user_id)])
|
|
474
474
|
|
|
475
|
+
status = event.response.status_code
|
|
476
|
+
|
|
477
|
+
if status >= 400:
|
|
478
|
+
# Prevent random values of 404 responses to become label values.
|
|
479
|
+
request_matchdict = {}
|
|
480
|
+
else:
|
|
481
|
+
request_matchdict = dict(request.matchdict or {})
|
|
482
|
+
|
|
475
483
|
# Add extra labels to metrics, based on fields extracted from the request matchdict.
|
|
476
484
|
metrics_matchdict_fields = aslist(settings["metrics_matchdict_fields"])
|
|
477
485
|
# Turn the `id` field of object endpoints into `{resource}_id` (eg. `mushroom_id`, `bucket_id`)
|
|
478
|
-
enhanced_matchdict =
|
|
486
|
+
enhanced_matchdict = request_matchdict
|
|
479
487
|
try:
|
|
480
488
|
enhanced_matchdict[request.current_resource_name + "_id"] = enhanced_matchdict.get(
|
|
481
489
|
"id", ""
|
|
@@ -487,8 +495,6 @@ def setup_metrics(config):
|
|
|
487
495
|
(field, enhanced_matchdict.get(field, "")) for field in metrics_matchdict_fields
|
|
488
496
|
]
|
|
489
497
|
|
|
490
|
-
status = event.response.status_code
|
|
491
|
-
|
|
492
498
|
service = request.current_service
|
|
493
499
|
if service:
|
|
494
500
|
# Use the service name as endpoint if available.
|
|
@@ -501,16 +507,14 @@ def setup_metrics(config):
|
|
|
501
507
|
"unnamed" if status != 404 else "unknown"
|
|
502
508
|
) # Do not multiply cardinality for unknown endpoints.
|
|
503
509
|
|
|
510
|
+
request_labels = [
|
|
511
|
+
("method", request.method.lower()),
|
|
512
|
+
("endpoint", endpoint),
|
|
513
|
+
("status", str(status)),
|
|
514
|
+
] + metrics_matchdict_labels
|
|
515
|
+
|
|
504
516
|
# Count served requests.
|
|
505
|
-
metrics_service.count(
|
|
506
|
-
"request_summary",
|
|
507
|
-
unique=[
|
|
508
|
-
("method", request.method.lower()),
|
|
509
|
-
("endpoint", endpoint),
|
|
510
|
-
("status", str(status)),
|
|
511
|
-
]
|
|
512
|
-
+ metrics_matchdict_labels,
|
|
513
|
-
)
|
|
517
|
+
metrics_service.count("request_summary", unique=request_labels)
|
|
514
518
|
|
|
515
519
|
try:
|
|
516
520
|
current = utils.msec_time()
|
|
@@ -518,8 +522,7 @@ def setup_metrics(config):
|
|
|
518
522
|
metrics_service.timer(
|
|
519
523
|
"request_duration",
|
|
520
524
|
value=duration,
|
|
521
|
-
labels=
|
|
522
|
-
+ metrics_matchdict_labels,
|
|
525
|
+
labels=request_labels,
|
|
523
526
|
)
|
|
524
527
|
except AttributeError: # pragma: no cover
|
|
525
528
|
# Logging was not setup in this Kinto app (unlikely but possible)
|
|
@@ -527,9 +530,7 @@ def setup_metrics(config):
|
|
|
527
530
|
|
|
528
531
|
# Observe response size.
|
|
529
532
|
metrics_service.observe(
|
|
530
|
-
"request_size",
|
|
531
|
-
len(event.response.body or b""),
|
|
532
|
-
labels=[("endpoint", endpoint)] + metrics_matchdict_labels,
|
|
533
|
+
"request_size", len(event.response.body or b""), labels=request_labels
|
|
533
534
|
)
|
|
534
535
|
|
|
535
536
|
# Count authentication verifications.
|
|
@@ -12,7 +12,7 @@ kinto/core/authorization.py,sha256=GywY25KEzuSSAI709dFHDfdLnKxy3SLEYGwW5FkQ7Qc,1
|
|
|
12
12
|
kinto/core/decorators.py,sha256=3SAPWXlyPNUSICZ9mz04bcN-UdbnDuFOtU0bQHHzLis,2178
|
|
13
13
|
kinto/core/errors.py,sha256=JXZjkPYjjC0I6x02d2VJRGeaQ2yZYS2zm5o7_ljfyes,8946
|
|
14
14
|
kinto/core/events.py,sha256=SYpXgKMtVjiD9fwYJA2Omdom9yA3nBqi9btdvU1I_nc,10345
|
|
15
|
-
kinto/core/initialization.py,sha256=
|
|
15
|
+
kinto/core/initialization.py,sha256=OMnwre6roy_JkOCA0wf47wUJv7erxOfACI9CT78tD5k,26329
|
|
16
16
|
kinto/core/metrics.py,sha256=h582cAZawzgJ9AL16t1ScgyVi0trXoJx-6147Ig-Vns,2693
|
|
17
17
|
kinto/core/openapi.py,sha256=92sZviff4NCxN0jMnu5lPUnF5iQbrKMGy7Cegf-VAME,3876
|
|
18
18
|
kinto/core/schema.py,sha256=d5L5TQynRYJPkZ8Mu2X7F72xEh6SKDbrHK1CNTdOf2E,3646
|
|
@@ -141,9 +141,9 @@ kinto/views/contribute.py,sha256=PJoIMLj9_IszSjgZkaCd_TUjekDgNqjpmVTmRN9ztaA,983
|
|
|
141
141
|
kinto/views/groups.py,sha256=jOq5fX0-4lwZE8k1q5HME2tU7x9052rtBPF7YqcJ-Qg,3181
|
|
142
142
|
kinto/views/permissions.py,sha256=F0_eKx201WyLonXJ5vLdGKa9RcFKjvAihrEEhU1JuLw,9069
|
|
143
143
|
kinto/views/records.py,sha256=lYfACW2L8qcQoyYBD5IX-fTPjFWmGp7GjHq_U4InlyE,5037
|
|
144
|
-
kinto-21.1.
|
|
145
|
-
kinto-21.1.
|
|
146
|
-
kinto-21.1.
|
|
147
|
-
kinto-21.1.
|
|
148
|
-
kinto-21.1.
|
|
149
|
-
kinto-21.1.
|
|
144
|
+
kinto-21.1.1.dist-info/licenses/LICENSE,sha256=oNEIMTuTJzppR5ZEyi86yvvtSagveMYXTYFn56zF0Uk,561
|
|
145
|
+
kinto-21.1.1.dist-info/METADATA,sha256=BxBYIcWxOiJ3ahr2dfZrcd7fGnCjtcFVdyAyieI281E,8731
|
|
146
|
+
kinto-21.1.1.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
|
|
147
|
+
kinto-21.1.1.dist-info/entry_points.txt,sha256=3KlqBWPKY81mrCe_oX0I5s1cRO7Q53nCLbnVr5P9LH4,85
|
|
148
|
+
kinto-21.1.1.dist-info/top_level.txt,sha256=EG_YmbZL6FAug9VwopG7JtF9SvH_r0DEnFp-3twPPys,6
|
|
149
|
+
kinto-21.1.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|