Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9337151
D6351.id23270.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D6351.id23270.diff
View Options
diff --git a/swh/provenance/provenance.py b/swh/provenance/provenance.py
--- a/swh/provenance/provenance.py
+++ b/swh/provenance/provenance.py
@@ -11,6 +11,7 @@
from typing_extensions import Literal, TypedDict
+from swh.core.statsd import statsd
from swh.model.model import Sha1Git
from .interface import (
@@ -25,6 +26,8 @@
LOGGER = logging.getLogger(__name__)
+BACKEND_DURATION_METRIC = "swh_provenance_backend_duration_seconds"
+
class DatetimeCache(TypedDict):
data: Dict[Sha1Git, Optional[datetime]]
@@ -94,11 +97,15 @@
def close(self) -> None:
self.storage.close()
+ @statsd.timed(metric=BACKEND_DURATION_METRIC, tags={"method": "flush"})
def flush(self) -> None:
self.flush_revision_content_layer()
self.flush_origin_revision_layer()
self.clear_caches()
+ @statsd.timed(
+ metric=BACKEND_DURATION_METRIC, tags={"method": "flush_origin_revision"}
+ )
def flush_origin_revision_layer(self) -> None:
# Origins and revisions should be inserted first so that internal ids'
# resolution works properly.
@@ -159,6 +166,9 @@
RelationType.REV_IN_ORG,
)
+ @statsd.timed(
+ metric=BACKEND_DURATION_METRIC, tags={"method": "flush_revision_content"}
+ )
def flush_revision_content_layer(self) -> None:
# Register in the storage all content, directories and revisions that are
# involved in this layer's associated relations.
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Jul 3 2025, 7:55 AM (10 w, 3 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3218601
Attached To
D6351: Add StatsD support to provenance backend
Event Timeline
Log In to Comment