Skip to content

feat(telemetry): add optional application label via env var#1992

Merged
georgeh0 merged 1 commit into
mainfrom
g/telemetry-application-label
May 18, 2026
Merged

feat(telemetry): add optional application label via env var#1992
georgeh0 merged 1 commit into
mainfrom
g/telemetry-application-label

Conversation

@georgeh0

@georgeh0 georgeh0 commented May 18, 2026

Copy link
Copy Markdown
Member

Summary

  • Add COCOINDEX_APPLICATION_FOR_TRACKING env var; when set to a non-empty value, every telemetry event payload gains an application field so end applications can self-identify in aggregate telemetry.
  • Read once at telemetry::init() (mirrors the read-once pattern of COCOINDEX_DISABLE_USAGE_TRACKING); stored on TelemetryContext as Option<String> and serialized with skip_serializing_if = "Option::is_none" so the field is omitted when unset.

Test plan

  • cargo test -p cocoindex_core telemetry — covers payload-absent-by-default and the new send_event_includes_application_when_set test. All 8 telemetry tests pass.

Read `COCOINDEX_APPLICATION_FOR_TRACKING` once at telemetry init. When
set to a non-empty value, every emitted event payload includes an
additional `application` field so end applications can self-identify in
aggregate telemetry. When unset or empty, the field is omitted.
@georgeh0 georgeh0 merged commit 92cf6c3 into main May 18, 2026
14 checks passed
@georgeh0 georgeh0 deleted the g/telemetry-application-label branch May 18, 2026 22:30
georgeh0 added a commit to cocoindex-io/cocoindex-code that referenced this pull request May 19, 2026
…de (#172)

Bump cocoindex (and the sentence-transformers extra) lower bound to 1.0.6,
the first release including cocoindex-io/cocoindex#1992 which adds the
optional `COCOINDEX_APPLICATION_FOR_TRACKING` env var.

Set `COCOINDEX_APPLICATION_FOR_TRACKING=cocoindex-code` at the top of
`cocoindex_code/__init__.py` (before any submodule imports `cocoindex`)
so aggregate telemetry can identify this application. Uses `setdefault`
to leave any explicit user value untouched.

Document the telemetry behavior and `COCOINDEX_DISABLE_USAGE_TRACKING`
opt-out in the README.
faysou pushed a commit to faysou/cocoindex-code that referenced this pull request Jun 9, 2026
…de (cocoindex-io#172)

Bump cocoindex (and the sentence-transformers extra) lower bound to 1.0.6,
the first release including cocoindex-io/cocoindex#1992 which adds the
optional `COCOINDEX_APPLICATION_FOR_TRACKING` env var.

Set `COCOINDEX_APPLICATION_FOR_TRACKING=cocoindex-code` at the top of
`cocoindex_code/__init__.py` (before any submodule imports `cocoindex`)
so aggregate telemetry can identify this application. Uses `setdefault`
to leave any explicit user value untouched.

Document the telemetry behavior and `COCOINDEX_DISABLE_USAGE_TRACKING`
opt-out in the README.
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.

1 participant