Skip to content

Commit

Permalink
Merge pull request #2606 from camptocamp/backport/2605-to-master
Browse files Browse the repository at this point in the history
[Backport master] Add memory map profiling
  • Loading branch information
sbrunner authored Nov 19, 2024
2 parents 77f2e59 + aadc21a commit bab6939
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tilecloud_chain/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
import tilecloud.store.s3
from azure.core.exceptions import ResourceNotFoundError
from c2cwsgiutils import health_check
from prometheus_client import Summary
from c2cwsgiutils.prometheus import MemoryMapCollector
from prometheus_client import REGISTRY, Summary
from pyramid.config import Configurator
from pyramid.httpexceptions import HTTPException, exception_response
from pyramid.request import Request
Expand Down Expand Up @@ -931,4 +932,8 @@ def main(global_config: Any, **settings: Any) -> Router:

config.scan("tilecloud_chain.views")

if os.environ.get("TILECLOUD_CHAIN_PROMETHEUS_MEMORY_MAP", "false").lower() in ("true", "1", "on"):
REGISTRY.register(MemoryMapCollector("rss"))
REGISTRY.register(MemoryMapCollector("size"))

return config.make_wsgi_app()

0 comments on commit bab6939

Please sign in to comment.