You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 90ccf42
Browse filesBrowse the repository at this point in the historyBrowse files
## Why make this change?
Closes#3216
DAB ships as an open-source container customers run anywhere, so we have
little visibility into how it is configured or which features are used.
This change encodes an anonymous usage fingerprint into the connection's
`Application Name`, which the database side already records (e.g.
`sys.dm_exec_sessions.program_name`), giving aggregate insight with no
new endpoints, no network calls, and no per-customer data.
## What is this change?
Embeds an anonymous, decodable usage-telemetry token into the
`Application Name` of the connection strings DAB uses for SQL Server /
Azure SQL, DWSQL, and PostgreSQL.
- **Format:** `dab_oss_<version>+<context>|<runtime>|<entity>+` a
version plus three flag sections (Context = 4, Runtime = 20, Entity =
14). Values use `0`/`1` (off/on), `M` (missing section), `X` (not
applicable at pool open), `?` (not yet modeled).
- **Pooling-safe (Model A):** only fields known when a pooled connection
opens are encoded (the data-source engine as `Source`); per-request
facets (protocol/object/role) are `X` so the connection-pool key, and
therefore pool count, is unchanged.
- **Where it's injected:** at config load (`RuntimeConfigLoader`) and on
the hosted/late-config `POST /configuration` paths
(`RuntimeConfigProvider.Initialize`). Embedding is **idempotent** (skips
if the `dab_oss_` marker is already present).
- **Multi-database:** the global runtime + merged entity fingerprint is
encoded at every pool (the token has no correlation id, so any single
sampled connection reflects the whole deployment); `Source` still varies
per pool.
- **Opt-out:** `DAB_TELEMETRY_APPNAME_OPT_OUT=1` reduces the value to
version-only.
- **Hosted label:** an existing `DAB_APP_NAME_ENV` value (e.g.
`dab_hosted`) is preserved as a comma prefix and never suppresses the
token.
- **CLI:** new offline `dab appname` command to encode (`--config`) or
decode (`--decode`) a token; `-o/--output` writes to a file.
- **Logging:** the computed token (never the connection string) is
logged at Debug via a bounded, drop-oldest `LogBuffer` flushed once the
logger is available.
- **Scope:** MySQL and Cosmos DB connection strings are left unchanged.
- Design doc: `docs/design/application-name-telemetry.md`.
## How was this tested?
- [x] Integration Tests
- [x] Unit Tests
Added encoder/decoder unit tests (token shape, every flag/section,
Source + auth-provider maps, opt-out, host-label prefix,
truncation-tolerant decode), connection-string injection tests for
MSSQL/DWSQL/PostgreSQL (incl. user-supplied `Application Name` prefix)
and no-op cases for MySQL/Cosmos, multi-database and hosted/late-config
(`/configuration` + `/configuration/v2`) tests, an idempotency test,
`LogBuffer` bound/flush tests, and CLI encode/decode/error/opt-out
tests.
## Sample Request(s)
Encode the token for a config (offline, no DB connection):
```bash
dab appname --config dab-config.json
# dab_oss_2.0.0+XXXX|110000M1M000MMMMMWMM|100?111001110?+
```
Decode a token back to a human-readable legend:
```bash
dab appname --decode "dab_oss_2.0.0+XXSX|110000M1M000MMMMMWMM|100?111001110?+"
```
Observe it on the SQL Server side:
```sql
SELECT program_name
FROM sys.dm_exec_sessions
WHERE program_name LIKE 'dab_oss%' OR program_name LIKE '%,dab_oss%';
```
0 commit comments