From d3490cab82ee877e884ce744d3ef5408b7156f9a Mon Sep 17 00:00:00 2001 From: Ryan Barrett Date: Wed, 18 Dec 2024 16:00:20 -0800 Subject: [PATCH] set up, but don't enable, ndb debug logging for #1149 --- app.yaml | 2 +- atproto_hub.yaml | 3 ++- config.py | 6 ++++++ router.yaml | 3 ++- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app.yaml b/app.yaml index f1b5db1d..7faf8068 100644 --- a/app.yaml +++ b/app.yaml @@ -36,7 +36,7 @@ env_variables: # ...or test against labeler.dholms.xyz / did:plc:vzxheqfwpbi3lxbgdh22js66 # https://github.com/googleapis/python-ndb/blob/c55ec62b5153787404488b046c4bf6ffa02fee64/google/cloud/ndb/utils.py#L78-L81 - NDB_DEBUG: true + # NDB_DEBUG: true handlers: diff --git a/atproto_hub.yaml b/atproto_hub.yaml index 53bb59b0..453194ca 100644 --- a/atproto_hub.yaml +++ b/atproto_hub.yaml @@ -34,8 +34,9 @@ env_variables: MEMCACHE_HOST: '10.126.144.3' ROLLBACK_WINDOW: 200000 SUBSCRIBE_REPOS_BATCH_DELAY: 10 + # https://github.com/googleapis/python-ndb/blob/c55ec62b5153787404488b046c4bf6ffa02fee64/google/cloud/ndb/utils.py#L78-L81 - NDB_DEBUG: true + # NDB_DEBUG: true # need only one instance so that new commits can be delivered to subscribeRepos # subscribers in memory diff --git a/config.py b/config.py index e05167a2..dc3d2f67 100644 --- a/config.py +++ b/config.py @@ -23,6 +23,7 @@ ENV = 'development' CACHE_TYPE = 'NullCache' SECRET_KEY = 'sooper seekret' + else: ENV = 'production' CACHE_TYPE = 'SimpleCache' @@ -35,6 +36,11 @@ for logger in ('oauth_dropins.webutil.webmention', 'lexrpc'): logging.getLogger(logger).setLevel(logging.DEBUG) +# for debugging ndb. also needs NDB_DEBUG env var. +# https://github.com/googleapis/python-ndb/blob/c55ec62b5153787404488b046c4bf6ffa02fee64/google/cloud/ndb/utils.py#L78-L81 +# logging.getLogger('google.cloud.ndb').setLevel(logging.DEBUG) +# logging.getLogger('google.cloud.ndb._cache').setLevel(logging.DEBUG) + os.environ.setdefault('APPVIEW_HOST', 'api.bsky.local') os.environ.setdefault('BGS_HOST', 'bgs.bsky.local') os.environ.setdefault('PLC_HOST', 'plc.bsky.local') diff --git a/router.yaml b/router.yaml index 32759c87..d59cd5df 100644 --- a/router.yaml +++ b/router.yaml @@ -26,8 +26,9 @@ env_variables: CHAT_HOST: api.bsky.chat CHAT_DID: did:web:api.bsky.chat MEMCACHE_HOST: '10.126.144.3' + # https://github.com/googleapis/python-ndb/blob/c55ec62b5153787404488b046c4bf6ffa02fee64/google/cloud/ndb/utils.py#L78-L81 - NDB_DEBUG: true + # NDB_DEBUG: true automatic_scaling: min_num_instances: 2