Skip to content

Conversation

@rkistner
Copy link
Contributor

@rkistner rkistner commented Jul 1, 2025

This includes an identifying name in database connections, which helps to distinguish database connections made by powersync from other sources.

  • MongoDB source database (direct connection and change stream): 'powersync' as appName.
  • MongoDB storage database: 'powersync-storage' as appName.
  • MySQL direct connection: 'powersync' as program_name.
  • MySQL replication connection: Not supported by Zongji yet.
  • Postgres connections (all): 'PowerSync' (already present before this PR)

For MongoDB, this is present in db.currentOp(), as well as in logs:

// currentOp:
       client: '127.0.0.1:40558',
      appName: 'powersync',
      clientMetadata: {
        application: { name: 'powersync' },
        driver: { name: 'nodejs', version: '6.14.2' },
        platform: 'Node.js v22.14.0, LE',
        os: {
          name: 'linux',
          architecture: 'x64',
          version: '6.15.0-061500-generic',
          type: 'Linux'
        }
      }

// logs:
{"application":{"name":"powersync"},"driver":{"name":"nodejs","version":"6.14.2"}, ...

In MySQL, this can be accessed via select * from performance_schema.session_connect_attrs;:

+----------------+-----------------+--------------+------------------+
| PROCESSLIST_ID | ATTR_NAME       | ATTR_VALUE   | ORDINAL_POSITION |
|             18 | _client_name    | Node-MySQL-2 |                0 |
|             18 | _client_version | 3.11.3       |                1 |
|             18 | program_name    | powersync    |                2 |
+----------------+-----------------+--------------+------------------+

In Postgres, use select usename, client_addr, application_name, backend_type from pg_stat_activity;:

| usename  | client_addr                          | application_name              | backend_type   |
| -------- | ------------------------------------ | ----------------------------- | -------------- |
| postgres | 54.195.180.72                        | PowerSync                     | walsender      |

@rkistner rkistner requested a review from stevensJourney July 1, 2025 08:03
@changeset-bot
Copy link

changeset-bot bot commented Jul 1, 2025

🦋 Changeset detected

Latest commit: 09f60c8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 12 packages
Name Type
@powersync/service-module-mongodb-storage Patch
@powersync/service-module-mongodb Patch
@powersync/service-module-mysql Patch
@powersync/lib-service-mongodb Patch
@powersync/service-core Patch
@powersync/service-image Patch
@powersync/service-schema Patch
@powersync/service-module-postgres Patch
@powersync/service-core-tests Patch
@powersync/service-module-core Patch
@powersync/service-module-postgres-storage Patch
test-client Patch

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

Copy link
Collaborator

@stevensJourney stevensJourney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rkistner rkistner merged commit 71cf892 into main Jul 1, 2025
49 of 51 checks passed
@rkistner rkistner deleted the mongodb-appname branch July 1, 2025 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants