CH-38 - Introduce deployment ID for unique telemetry identification and tracking.#45
Open
SammyOina wants to merge 6 commits intoabsmach:mainfrom
Open
CH-38 - Introduce deployment ID for unique telemetry identification and tracking.#45SammyOina wants to merge 6 commits intoabsmach:mainfrom
SammyOina wants to merge 6 commits intoabsmach:mainfrom
Conversation
028fee6 to
d523bb2
Compare
There was a problem hiding this comment.
Pull request overview
This PR introduces a deployment ID field to uniquely identify Magistrala deployments in the telemetry system, moving away from IP-based identification which can be unreliable due to NAT, dynamic IPs, or multiple deployments behind the same IP. The deployment ID can be configured via environment variables or is automatically generated and persisted to disk.
Key changes:
- Added
deployment_idfield to telemetry data model and database schema with migration - Implemented deployment ID retrieval logic with fallback: environment variable → file → generate new UUID
- Updated all SQL queries to use
COALESCE(deployment_id, ip_address)for backward compatibility
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| telemetry.go | Added DeploymentID field to the Telemetry struct with appropriate struct tags |
| pkg/client/client.go | Implemented getDeploymentID() function to retrieve/generate deployment ID from environment variables or file, and integrated it into the telemetry collection |
| timescale/init.go | Added migration telemetry_7 to add deployment_id column and create index |
| timescale/timescale.go | Updated all queries (RetrieveAll, Save, RetrieveSummary) to use deployment_id with COALESCE fallback to ip_address for backward compatibility |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… tracking. Signed-off-by: Sammy Oina <sammyoina@gmail.com>
Signed-off-by: Sammy Oina <sammyoina@gmail.com>
…ved request handling Signed-off-by: Sammy Oina <sammyoina@gmail.com>
…sistency Signed-off-by: Sammy Oina <sammyoina@gmail.com>
… creation for telemetry Signed-off-by: Sammy Oina <sammyoina@gmail.com>
5dd9462 to
bf9b6a4
Compare
Signed-off-by: Sammy Oina <sammyoina@gmail.com>
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.
What does this do?
This PR introduces a deployment ID field to uniquely identify Magistrala deployments in the telemetry system, moving away from IP-based identification which can be unreliable due to NAT, dynamic IPs, or multiple deployments behind the same IP. The deployment ID can be configured via environment variables or is automatically generated and persisted to disk.
Which issue(s) does this PR fix/relate to?
Resolves #38
List any changes that modify/break current functionality
Have you included tests for your changes?
Did you document any new/modified functionality?
Notes