Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport master] Add memory map profiling #2606

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
Loading