feat: enhanced telemetry backend#9
Merged
irfanuddinahmad merged 7 commits intoproductionfrom Feb 19, 2026
Merged
Conversation
CRITICAL FIX: Added missing mapstructure tags to GitActivity, Repository, and DevelopmentActivity structs. The api.Decode function uses mapstructure for decoding request bodies, which requires explicit tags for all fields in nested structures. Without these tags: - Git line counts were 0 (total_lines_added, total_lines_deleted, files_changed) - Repository details were partially missing (lines_added, lines_deleted, files_changed) - branches_worked arrays were null With this fix: - All git activity metrics now properly decoded and stored - Complete repository statistics including line changes - Branch information correctly preserved Tested: Full pipeline from collector → API → database verified with correct values.
- Remove old migrations (20240211_add_init_tables, 20260219_add_git_activity_fields) - Create single migration that drops and recreates tables from scratch - Cleaner schema with git_activity and development_activity fields - Removes deprecated command_counts field entirely - Safe for dev mode - drops existing tables and creates fresh schema
- Remove all references to CommandCounts field from models and API - Fix AutoMigrate syntax in migration (call separately for each table) - Clean schema without deprecated fields
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.
This pull request introduces comprehensive developer telemetry support to DevLake by adding detailed git activity tracking and development pattern analysis. The changes include significant updates to the data model, API, and database migration scripts to support new metrics, as well as a critical bug fix ensuring proper JSON deserialization of nested struct fields. The schema and API now support flexible, extensible storage and retrieval of developer activity metrics.
Key changes:
Data Model & API Enhancements
GitActivity,Repository, andDevelopmentActivityto the telemetry metrics, capturing commit counts, code churn, repository breakdowns, test runs, and build commands. All fields now include bothjsonandmapstructuretags to ensure correct serialization and deserialization. [1] [2]report_api.goto marshal and store the new metrics in the database, replacing the oldcommandsfield withgit_activityanddevelopment_activity. [1] [2] [3]Database Schema & Migration
20260219_init_schema.go) that creates the updated_tool_developer_metricstable, including new JSON fields forgit_activityanddevelopment_activity, and drops/recreates tables for a clean schema in development. [1] [2] [3]DeveloperMetricsmodel to match the new schema, removing the obsoleteCommandCountsfield and addingGitActivityandDevelopmentActivityas JSON text fields.Bug Fixes
mapstructuretags to all nested struct fields, ensuring accurate decoding of incoming telemetry data. [1] [2]