Skip to content

Commit

Permalink
only use error reporting in prod
Browse files Browse the repository at this point in the history
  • Loading branch information
snarfed committed Oct 21, 2024
1 parent bff1f19 commit 4b7be47
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ License: This project is placed in the public domain. You may also use it under
### Declaration record
The [labeler declaration record](https://docs.bsky.app/docs/advanced-guides/moderation#labeler-declarations) is `at://did:plc:4wgmwsq4t3tg55ffl3r7ocec/app.bsky.labeler.service/self'. To add a new label value definition to it, run `npx @skyware/labeler add`. [Docs.](https://skyware.js.org/guides/labeler/introduction/getting-started/)
The [labeler declaration record](https://docs.bsky.app/docs/advanced-guides/moderation#labeler-declarations) is `at://did:plc:4wgmwsq4t3tg55ffl3r7ocec/app.bsky.labeler.service/self`. To add a new label value definition to it, run `npx @skyware/labeler add`. [Docs.](https://skyware.js.org/guides/labeler/introduction/getting-started/)
8 changes: 6 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,15 @@
'bridged-from-bridgy-fed-web',
]

# https://cloud.google.com/appengine/docs/flexible/python/runtime#environment_variables
PROD = 'GAE_INSTANCE' in os.environ

logging_client = google.cloud.logging.Client()
logging_client.setup_logging(log_level=logging.DEBUG)
logger = logging.getLogger(__name__)

error_reporting_client = error_reporting.Client()
if not PROD:
error_reporting_client = error_reporting.Client()

logger.info('Loading #atproto_label private key from privkey.atproto_label.pem')
with open('privkey.atproto_label.pem', 'rb') as f:
Expand Down Expand Up @@ -96,7 +100,7 @@ def jetstream():
}
uri = f'at://{msg["did"]}/{commit["collection"]}/{commit["rkey"]}'
for val in values:
if val not in KNOWN_LABELS:
if PROD and val not in KNOWN_LABELS:
error_reporting_client.report(f'new label! {val} {uri} {cid}')
label = {
'ver': 1,
Expand Down

0 comments on commit 4b7be47

Please sign in to comment.