-
Notifications
You must be signed in to change notification settings - Fork 30
feat: Sync Stream Metadata Logs #413
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
Conversation
🦋 Changeset detectedLatest commit: df088e1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 11 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
rkistner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend tweaking the limits a bit, but happy with the rest.
Overview
This allows connecting clients to specify additional metadata to be included in the PowerSync service logs. Typical use cases might be to log the client's application version or other device metadata.
A new optional
app_metadatafield is now accepted for the HTTP and WebSocket/sync/streamendpoint. This can contain aRecord<string,string>map of values.The service will now log the metadata when a client's sync stream starts and stops. This metadata is not currently added to all logs, the request
ridcan be used to correlate metadata with other logs.The service limits the amount of logged/stored data. We currently only log a maximum of 10 keys in the provided
app_metadata. Each string is capped to 50 characters in length. These values might be configurable in future.A JSON sample for a log
{ "container": "default", "level": "info", "message": "Sync stream started", "namespace": "anamespace", "node": "anode", "pod": "apod", "timestamp": "2025-11-24T12:13:45.647Z", "_entry": "{\"app_metadata\":{\"appVersion\":\"1.0.0\"},\"client_id\":\"2788c57b-1cf4-41a0-bc0f-a46c5\",\"client_params\":{},\"level\":\"info\",\"message\":\"Sync stream started\",\"rid\":\"s/019ac8-c6a0-7455-93c2-c41f83963d50\",\"timestamp\":\"2025-11-24T12:13:45.647Z\",\"user_agent\":\"powersync-js/1.43.0 powersync-web Chromium/142 macos\",\"user_id\":\"123\"}" }This also adds logging
client_paramsto sync stream requests. This could be used to aid with debugging.