Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

doc/admin/telemetry: telemetry export reference and changelog#57606

Merged
bobheadxi merged 1 commit into
mainfrom
telemetry-export-admin-docs
Oct 18, 2023
Merged

doc/admin/telemetry: telemetry export reference and changelog#57606
bobheadxi merged 1 commit into
mainfrom
telemetry-export-admin-docs

Conversation

@bobheadxi

@bobheadxi bobheadxi commented Oct 14, 2023

Copy link
Copy Markdown
Member

This PR adds doc/admin documentation about the new telemetry export and changelog entries to document the changes coming in https://github.com/sourcegraph/sourcegraph/pull/57605 as outlined in the plan for the 5.2.1 release.

Part of https://github.com/sourcegraph/sourcegraph/issues/56816

Test plan

n/a

Preview 🤩

Preview Link

@cla-bot cla-bot Bot added the cla-signed label Oct 14, 2023
@bobheadxi bobheadxi changed the title doc/admin/telemetry: telemetry export reference doc/admin/telemetry: telemetry export reference and changelog Oct 14, 2023
@bobheadxi bobheadxi force-pushed the telemetry-export-admin-docs branch 3 times, most recently from f81d9d7 to e1d4ea8 Compare October 14, 2023 19:35
@bobheadxi bobheadxi force-pushed the telemetry-export-admin-docs branch from e1d4ea8 to 5ae23b2 Compare October 16, 2023 16:56
@bobheadxi

Copy link
Copy Markdown
Member Author

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

@bobheadxi bobheadxi marked this pull request as ready for review October 16, 2023 20:05
@bobheadxi bobheadxi requested review from a team, dadlerj and nathan-downs October 16, 2023 20:05
bobheadxi referenced this pull request Oct 17, 2023
This change implements the license-based enforcement of telemetry export as outlined in [the plan for the 5.2.1 release](https://docs.google.com/document/d/1Z1Yp7G61WYlQ1B4vO5-mIXVtmvzGmD7PqYHNBQV-2Ik/edit#bookmark=id.w10771x4dx7y).

Most of this functionality has been tested in various environments for some time: dotcom, s2, rctest, cody-dev, demo, and 9 trial Cloud instances (with more to be enabled before the final 5.2.1 release, see sourcegraph/customer#2416), processing about 2 million events in the last 7 days (a small set of events currently instrumented in the new system). The following changes are made to how this feature is enabled:

1. An export enablement mode is added to package `internal/licensing` that evaluates what we export based on the configured license, configured based on license plan or tags in the license, but the levels are unlikely to change):
   - all events (default going forward)
   - cody-only (`Feature=~'cody|cody.*'`), since Cody events are a special case covered by terms of use
   - nothing (air-gapped instance)
3. When persisting events to the export queue, the enablement mode is checked to decide if anything gets written to the database.
4. Exporter background workers are now enabled by default, checking the mode on each iteration to decide if we need to run the exporter at all. We also create a new connection to Telemetry Gateway on each run now, to ensure Telemetry Gateway downtime does not break instances.

The feature flag `telemetry-export` and env var `TELEMETRY_GATEWAY_EXPORTER_EXPORT_ADDR` remain configurable, but in a default-enabled state - in 5.2.2, the ability to disable these capabilities via configuration will be removed, and the license-based mechanism will become the only way to disable this feature, as requested in the [telemetry export rollout plan](https://docs.google.com/document/d/1Z1Yp7G61WYlQ1B4vO5-mIXVtmvzGmD7PqYHNBQV-2Ik/edit#bookmark=id.w10771x4dx7y). Parts that require follow-up changes are denoted with `TODO(5.2.2)` comments.

A changelog entry and docs are added in https://github.com/sourcegraph/sourcegraph/pull/57606

Part of https://github.com/sourcegraph/sourcegraph/issues/56816

## Test plan

- [x] New unit/integration test coverage
- [x] Existing tests pass with minimal changes
- [x] Manual testing:
  - Comment out `sg.config.yaml` line `TELEMETRY_GATEWAY_EXPORTER_EXPORT_ADDR: "http://127.0.0.1:10080"` and add `TELEMETRY_GATEWAY_EXPORTER_EXPORT_INTERVAL: "30s"`, exporter starts by default. Run some searches to generate events, and see that worker doesn't export anything, as the default mode for an older license is to disable export (seen in logs and metrics)
  - Set `dev-private` license to a new, real one from sourcegraph.com, remove all mentions of `SOURCEGRAPH_LICENSE_GENERATION_KEY` from `sg.config.yaml`, repeat above, events now export (seen in logs and metrics):
    `[         worker] INFO worker.telemetrygateway-exporter telemetrygatewayexporter/exporter.go:129 events exported {"maxBatchSize": 10000, "succeeded": 1}`

---------

Co-authored-by: Joe Chen <joe@sourcegraph.com>

@nathan-downs nathan-downs left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

bobheadxi referenced this pull request Oct 18, 2023
This change implements the license-based enforcement of telemetry export as outlined in [the plan for the 5.2.1 release](https://docs.google.com/document/d/1Z1Yp7G61WYlQ1B4vO5-mIXVtmvzGmD7PqYHNBQV-2Ik/edit#bookmark=id.w10771x4dx7y).

Most of this functionality has been tested in various environments for some time: dotcom, s2, rctest, cody-dev, demo, and 9 trial Cloud instances (with more to be enabled before the final 5.2.1 release, see sourcegraph/customer#2416), processing about 2 million events in the last 7 days (a small set of events currently instrumented in the new system). The following changes are made to how this feature is enabled:

1. An export enablement mode is added to package `internal/licensing` that evaluates what we export based on the configured license, configured based on license plan or tags in the license, but the levels are unlikely to change):
   - all events (default going forward)
   - cody-only (`Feature=~'cody|cody.*'`), since Cody events are a special case covered by terms of use
   - nothing (air-gapped instance)
3. When persisting events to the export queue, the enablement mode is checked to decide if anything gets written to the database.
4. Exporter background workers are now enabled by default, checking the mode on each iteration to decide if we need to run the exporter at all. We also create a new connection to Telemetry Gateway on each run now, to ensure Telemetry Gateway downtime does not break instances.

The feature flag `telemetry-export` and env var `TELEMETRY_GATEWAY_EXPORTER_EXPORT_ADDR` remain configurable, but in a default-enabled state - in 5.2.2, the ability to disable these capabilities via configuration will be removed, and the license-based mechanism will become the only way to disable this feature, as requested in the [telemetry export rollout plan](https://docs.google.com/document/d/1Z1Yp7G61WYlQ1B4vO5-mIXVtmvzGmD7PqYHNBQV-2Ik/edit#bookmark=id.w10771x4dx7y). Parts that require follow-up changes are denoted with `TODO(5.2.2)` comments.

A changelog entry and docs are added in https://github.com/sourcegraph/sourcegraph/pull/57606

Part of https://github.com/sourcegraph/sourcegraph/issues/56816

- [x] New unit/integration test coverage
- [x] Existing tests pass with minimal changes
- [x] Manual testing:
  - Comment out `sg.config.yaml` line `TELEMETRY_GATEWAY_EXPORTER_EXPORT_ADDR: "http://127.0.0.1:10080"` and add `TELEMETRY_GATEWAY_EXPORTER_EXPORT_INTERVAL: "30s"`, exporter starts by default. Run some searches to generate events, and see that worker doesn't export anything, as the default mode for an older license is to disable export (seen in logs and metrics)
  - Set `dev-private` license to a new, real one from sourcegraph.com, remove all mentions of `SOURCEGRAPH_LICENSE_GENERATION_KEY` from `sg.config.yaml`, repeat above, events now export (seen in logs and metrics):
    `[         worker] INFO worker.telemetrygateway-exporter telemetrygatewayexporter/exporter.go:129 events exported {"maxBatchSize": 10000, "succeeded": 1}`

---------

Co-authored-by: Joe Chen <joe@sourcegraph.com>
(cherry picked from commit 20c771b)
keegancsmith referenced this pull request Oct 18, 2023
…57681)

telemetry-export: 5.2.1 default enablement (#57605)

This change implements the license-based enforcement of telemetry export as outlined in [the plan for the 5.2.1 release](https://docs.google.com/document/d/1Z1Yp7G61WYlQ1B4vO5-mIXVtmvzGmD7PqYHNBQV-2Ik/edit#bookmark=id.w10771x4dx7y).

Most of this functionality has been tested in various environments for some time: dotcom, s2, rctest, cody-dev, demo, and 9 trial Cloud instances (with more to be enabled before the final 5.2.1 release, see sourcegraph/customer#2416), processing about 2 million events in the last 7 days (a small set of events currently instrumented in the new system). The following changes are made to how this feature is enabled:

1. An export enablement mode is added to package `internal/licensing` that evaluates what we export based on the configured license, configured based on license plan or tags in the license, but the levels are unlikely to change):
   - all events (default going forward)
   - cody-only (`Feature=~'cody|cody.*'`), since Cody events are a special case covered by terms of use
   - nothing (air-gapped instance)
3. When persisting events to the export queue, the enablement mode is checked to decide if anything gets written to the database.
4. Exporter background workers are now enabled by default, checking the mode on each iteration to decide if we need to run the exporter at all. We also create a new connection to Telemetry Gateway on each run now, to ensure Telemetry Gateway downtime does not break instances.

The feature flag `telemetry-export` and env var `TELEMETRY_GATEWAY_EXPORTER_EXPORT_ADDR` remain configurable, but in a default-enabled state - in 5.2.2, the ability to disable these capabilities via configuration will be removed, and the license-based mechanism will become the only way to disable this feature, as requested in the [telemetry export rollout plan](https://docs.google.com/document/d/1Z1Yp7G61WYlQ1B4vO5-mIXVtmvzGmD7PqYHNBQV-2Ik/edit#bookmark=id.w10771x4dx7y). Parts that require follow-up changes are denoted with `TODO(5.2.2)` comments.

A changelog entry and docs are added in https://github.com/sourcegraph/sourcegraph/pull/57606

Part of https://github.com/sourcegraph/sourcegraph/issues/56816

- [x] New unit/integration test coverage
- [x] Existing tests pass with minimal changes
- [x] Manual testing:
  - Comment out `sg.config.yaml` line `TELEMETRY_GATEWAY_EXPORTER_EXPORT_ADDR: "http://127.0.0.1:10080"` and add `TELEMETRY_GATEWAY_EXPORTER_EXPORT_INTERVAL: "30s"`, exporter starts by default. Run some searches to generate events, and see that worker doesn't export anything, as the default mode for an older license is to disable export (seen in logs and metrics)
  - Set `dev-private` license to a new, real one from sourcegraph.com, remove all mentions of `SOURCEGRAPH_LICENSE_GENERATION_KEY` from `sg.config.yaml`, repeat above, events now export (seen in logs and metrics):
    `[         worker] INFO worker.telemetrygateway-exporter telemetrygatewayexporter/exporter.go:129 events exported {"maxBatchSize": 10000, "succeeded": 1}`

---------

Co-authored-by: Joe Chen <joe@sourcegraph.com>
(cherry picked from commit 20c771b)
@bobheadxi bobheadxi merged commit 8f48c6c into main Oct 18, 2023
@bobheadxi bobheadxi deleted the telemetry-export-admin-docs branch October 18, 2023 15:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants