This pull request introduces a new service for handling Copilot metrics storage and updates the existing usage storage service to improve functionality and maintainability. The most important changes include the creation of CopilotMetricsStorageService, updates to CopilotUsageStorageService, and the addition of new storage classes for metrics.
New Service for Metrics Storage:
src/api/CopilotMetricsStorageService.ts: Added a new service CopilotMetricsStorageService to handle the storage and retrieval of Copilot metrics data. This includes methods for saving and querying metrics data, as well as handling errors.
Updates to Usage Storage Service:
src/api/CopilotUsageStorageService.ts: Updated CopilotUsageStorageService to use GitHubApiCopilotUsage instead of GitHubApi and replaced references to Metrics with CopilotUsage. This includes changes to method names and error handling. [1][2][3][4][5]
New Storage Classes:
src/api/FileMetricsStorage.ts: Added a new class FileMetricsStorage to handle file-based storage of Copilot metrics. This class includes methods for saving, querying, and comparing metrics data.
src/api/MySQLMetricsStorage.ts: Added a new class MySQLMetricsStorage to handle MySQL-based storage of Copilot metrics. (Not shown in the provided changes but implied by the imports and usage in CopilotServiceFactory)
Factory Updates:
src/api/CopilotServiceFactory.ts: Updated CopilotServiceFactory to include a new method createMetricsService for creating instances of CopilotMetricsStorageService based on the storage configuration. [1][2]
These changes collectively enhance the system's ability to handle metrics and usage data more effectively and provide a clear structure for future extensions.… introduce new metrics as copilot_metrics to reflect github latest copilot API change. and support both files and mysql databases for seat/copilot_usage/copilot_seat API data fetching.
This pull request introduces a new service for handling Copilot metrics storage and updates the existing usage storage service to improve functionality and maintainability. The most important changes include the creation of
CopilotMetricsStorageService
, updates toCopilotUsageStorageService
, and the addition of new storage classes for metrics.New Service for Metrics Storage:
src/api/CopilotMetricsStorageService.ts
: Added a new serviceCopilotMetricsStorageService
to handle the storage and retrieval of Copilot metrics data. This includes methods for saving and querying metrics data, as well as handling errors.Updates to Usage Storage Service:
src/api/CopilotUsageStorageService.ts
: UpdatedCopilotUsageStorageService
to useGitHubApiCopilotUsage
instead ofGitHubApi
and replaced references toMetrics
withCopilotUsage
. This includes changes to method names and error handling. [1] [2] [3] [4] [5]New Storage Classes:
src/api/FileMetricsStorage.ts
: Added a new classFileMetricsStorage
to handle file-based storage of Copilot metrics. This class includes methods for saving, querying, and comparing metrics data.src/api/MySQLMetricsStorage.ts
: Added a new classMySQLMetricsStorage
to handle MySQL-based storage of Copilot metrics. (Not shown in the provided changes but implied by the imports and usage inCopilotServiceFactory
)Factory Updates:
src/api/CopilotServiceFactory.ts
: UpdatedCopilotServiceFactory
to include a new methodcreateMetricsService
for creating instances ofCopilotMetricsStorageService
based on the storage configuration. [1] [2]Test Updates:
src/api/CopilotUsageStorageService.test.ts
: Updated tests to reflect changes inCopilotUsageStorageService
, including the import ofCopilot_Usage
instead ofMetrics
.These changes collectively enhance the system's ability to handle metrics and usage data more effectively and provide a clear structure for future extensions.… introduce new metrics as copilot_metrics to reflect github latest copilot API change. and support both files and mysql databases for seat/copilot_usage/copilot_seat API data fetching.