-
Notifications
You must be signed in to change notification settings - Fork 18
Appinsights implementation #237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Ritvik-Jayaswal
wants to merge
9
commits into
documentdb:main
Choose a base branch
from
Ritvik-Jayaswal:users/rjayaswal/appinsights-implementation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
db6ad55
added Appinsights doc
rjayaswal 0165f5c
dixed PII
rjayaswal 7e64d7f
Implement Application Insights telemetry integration
rjayaswal 453da4e
feat: Add Application Insights telemetry integration
rjayaswal ded55fa
Merge branch 'main' into users/rjayaswal/appinsights-implementation
Ritvik-Jayaswal 615a3da
Address Copilot PR review comments for telemetry implementation
rjayaswal c5b0719
Remove accidentally added github-secrets-telemetry-setup.md
rjayaswal c3b92fe
feat: Inject App Insights connection string in release workflow
rjayaswal b795272
Merge branch 'main' into users/rjayaswal/appinsights-implementation
Ritvik-Jayaswal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,134 @@ | ||
| # Application Insights Telemetry Configuration | ||
|
|
||
| This document describes how to configure Application Insights telemetry collection for the DocumentDB Kubernetes Operator. | ||
|
|
||
| ## Overview | ||
|
|
||
| The DocumentDB Operator can send telemetry data to Azure Application Insights to help monitor operator health, track cluster lifecycle events, and diagnose issues. All telemetry is designed with privacy in mind - no personally identifiable information (PII) is collected. | ||
|
|
||
| ## Configuration | ||
|
|
||
| ### Environment Variables | ||
|
|
||
| Configure telemetry by setting these environment variables in the operator deployment: | ||
|
|
||
| | Variable | Description | Required | | ||
| |----------|-------------|----------| | ||
| | `APPINSIGHTS_INSTRUMENTATIONKEY` | Application Insights instrumentation key | Yes (or connection string) | | ||
| | `APPLICATIONINSIGHTS_CONNECTION_STRING` | Application Insights connection string (alternative to instrumentation key) | Yes (or instrumentation key) | | ||
| | `DOCUMENTDB_TELEMETRY_ENABLED` | Set to `false` to disable telemetry collection | No (default: `true`) | | ||
|
|
||
| ### Helm Chart Configuration | ||
|
|
||
| When installing via Helm, you can configure telemetry in your values.yaml: | ||
|
|
||
| ```yaml | ||
| # values.yaml | ||
| telemetry: | ||
| enabled: true | ||
| instrumentationKey: "YOUR-INSTRUMENTATION-KEY-HERE" | ||
| # Or use connection string: | ||
| # connectionString: "InstrumentationKey=xxx;IngestionEndpoint=https://..." | ||
| # Or use an existing secret containing APPINSIGHTS_INSTRUMENTATIONKEY / APPLICATIONINSIGHTS_CONNECTION_STRING: | ||
| # existingSecret: "documentdb-operator-telemetry" | ||
| ``` | ||
|
|
||
| ### Kubernetes Secret | ||
|
|
||
| For production deployments, store the instrumentation key in a Kubernetes secret: | ||
|
|
||
| ```yaml | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: documentdb-operator-telemetry | ||
| namespace: documentdb-system | ||
| type: Opaque | ||
| stringData: | ||
| APPINSIGHTS_INSTRUMENTATIONKEY: "YOUR-INSTRUMENTATION-KEY-HERE" | ||
| ``` | ||
|
|
||
| Then reference it in the operator deployment: | ||
|
|
||
| ```yaml | ||
| envFrom: | ||
| - secretRef: | ||
| name: documentdb-operator-telemetry | ||
| ``` | ||
|
|
||
| ## Privacy & Data Collection | ||
|
|
||
| ### What We Collect | ||
|
|
||
| The operator collects anonymous, aggregated telemetry data including: | ||
|
|
||
| - **Operator lifecycle**: Startup events, health status, version information | ||
| - **Cluster operations**: Create, update, delete events (with timing metrics) | ||
| - **Backup operations**: Backup creation, completion, and expiration events | ||
| - **Error tracking**: Categorized errors (no raw error messages with sensitive data) | ||
| - **Performance metrics**: Reconciliation duration, API call latency | ||
|
|
||
| ### What We DON'T Collect | ||
|
|
||
| To protect your privacy, we explicitly do NOT collect: | ||
|
|
||
| - Cluster names, namespace names, or any user-provided resource names | ||
| - Connection strings, passwords, or credentials | ||
| - IP addresses or hostnames | ||
| - Storage class names (may contain organizational information) | ||
| - Raw error messages (only categorized error types) | ||
| - Container image names | ||
|
|
||
| ### Privacy Protection Mechanisms | ||
|
|
||
| 1. **GUIDs Instead of Names**: All resources are identified by auto-generated GUIDs stored in annotations (`telemetry.documentdb.io/cluster-id`) | ||
| 2. **Hashed Namespaces**: Namespace names are SHA-256 hashed before transmission | ||
| 3. **Categorized Data**: Values like PVC sizes are categorized (small/medium/large) instead of exact values | ||
| 4. **Error Sanitization**: Error messages are stripped of potential PII and truncated | ||
|
|
||
| ## Disabling Telemetry | ||
|
|
||
| To completely disable telemetry collection: | ||
|
|
||
| 1. **Via environment variable**: | ||
| ```yaml | ||
| env: | ||
| - name: DOCUMENTDB_TELEMETRY_ENABLED | ||
| value: "false" | ||
| ``` | ||
|
|
||
| 2. **Via Helm**: | ||
| ```yaml | ||
| telemetry: | ||
| enabled: false | ||
| ``` | ||
|
|
||
| 3. **Don't provide instrumentation key**: If no `APPINSIGHTS_INSTRUMENTATIONKEY` or `APPLICATIONINSIGHTS_CONNECTION_STRING` is set, telemetry is automatically disabled. | ||
|
|
||
| ## Telemetry Events Reference | ||
|
|
||
| See [appinsights-metrics.md](appinsights-metrics.md) for the complete specification of all telemetry events and metrics collected. | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| ### Telemetry Not Being Sent | ||
|
|
||
| 1. Verify the instrumentation key is correctly configured: | ||
| ```bash | ||
| kubectl get deployment documentdb-operator -n documentdb-system -o yaml | grep -A5 APPINSIGHTS | ||
| ``` | ||
|
|
||
| 2. Check operator logs for telemetry initialization: | ||
| ```bash | ||
| kubectl logs -n documentdb-system -l app=documentdb-operator | grep -i telemetry | ||
| ``` | ||
|
|
||
| 3. Verify network connectivity to Application Insights endpoint (`dc.services.visualstudio.com`) | ||
|
|
||
| ### High Cardinality Warnings | ||
|
|
||
| If you see warnings about high cardinality dimensions, this indicates too many unique values for a dimension. The telemetry system automatically samples high-frequency events to mitigate this. | ||
|
|
||
| ## Support | ||
|
|
||
| For issues related to telemetry collection, please open an issue on the [GitHub repository](https://github.com/documentdb/documentdb-kubernetes-operator/issues). |
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
envFromis being rendered inside theenv:list whentelemetry.existingSecretis set, which produces an invalid container spec (and can break YAML/schema validation).envFrommust be a sibling ofenv, not an item within it; consider renderingenvFromat the container level and keepingenv:as a pure list of- name:entries.