feat(telemetry): add optional application label via env var#1992
Merged
Conversation
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
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
COCOINDEX_APPLICATION_FOR_TRACKINGenv var; when set to a non-empty value, every telemetry event payload gains anapplicationfield so end applications can self-identify in aggregate telemetry.telemetry::init()(mirrors the read-once pattern ofCOCOINDEX_DISABLE_USAGE_TRACKING); stored onTelemetryContextasOption<String>and serialized withskip_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 newsend_event_includes_application_when_settest. All 8 telemetry tests pass.