Skip to content

Commit

Permalink
Add memory map profiling
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Nov 19, 2024
1 parent 77f2e59 commit aadc21a
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 aadc21a

Please sign in to comment.