From f49286e4c0ceb1086e981cb1cd3caf5213e5cb97 Mon Sep 17 00:00:00 2001 From: Evan Benshetler Date: Thu, 6 Nov 2025 11:57:49 +0100 Subject: [PATCH 1/3] ROX-31635: Add design proposal for removing observatorium metrics federation.: --- .../observatorium-metrics-removal.md | 162 ++++++++++++++++++ .gitignore | 3 + 2 files changed, 165 insertions(+) create mode 100644 .design-proposals/observatorium-metrics-removal.md diff --git a/.design-proposals/observatorium-metrics-removal.md b/.design-proposals/observatorium-metrics-removal.md new file mode 100644 index 0000000000..5013049a46 --- /dev/null +++ b/.design-proposals/observatorium-metrics-removal.md @@ -0,0 +1,162 @@ +# Design Proposal: Remove Deprecated Observatorium Metrics Feature + +## Summary + +This proposal outlines the removal of the deprecated Observatorium metrics functionality from the ACS Fleet Manager. The feature includes OpenAPI schema definitions for exposing Prometheus metrics via Fleet Manager API endpoints, but the actual implementation (handlers, routes, services) was never completed. This cleanup will remove unused code and reduce maintenance overhead. + +## Background + +The ACS Fleet Manager OpenAPI specifications contain comprehensive schema definitions for metrics endpoints that would theoretically interact with Observatorium (Red Hat's managed Prometheus service). However, after thorough analysis, these schemas are not connected to any actual API endpoints, handlers, or service implementations. This indicates the feature was planned but never fully implemented. + +## Current State Analysis + +### OpenAPI Schema Definitions (Exist but Unused) + +The following schemas are defined in the OpenAPI specification but have no corresponding API endpoints or handlers: + +**File**: `openapi/fleet-manager.yaml` +- **Lines 700-718**: `MetricsRangeQueryList` schema definition +- **Lines 741-758**: `MetricsInstantQueryList` schema definition +- **Lines 759-760**: `MetricsFederationResult` schema definition +- **Lines 1038-1058**: Example metric data (`MetricsRangeQueryExample`, `MetricsInstantQueryExample`) + +### Generated Model Files (Auto-generated, No Usage) + +The following Go model files are generated from the OpenAPI schemas but not used anywhere in the codebase: + +- `internal/central/pkg/api/public/model_metrics_range_query_list.go` - MetricsRangeQueryList struct +- `internal/central/pkg/api/public/model_metrics_instant_query_list.go` - MetricsInstantQueryList struct +- `internal/central/pkg/api/public/model_range_query.go` - RangeQuery struct +- `internal/central/pkg/api/public/model_instant_query.go` - InstantQuery struct +- `internal/central/pkg/api/public/model_values.go` - Values struct + +### Configuration References + +**File**: `dev/env/manifests/addons/crds/00-addon-crd.yaml` +- **Lines 385-387**: Contains Observatorium endpoint URLs for staging and production environments + ```yaml + - Staging: https://observatorium-mst.stage.api.openshift.com/api/metrics/v1//api/v1/receive + - Production: https://observatorium-mst.api.openshift.com/api/metrics/v1//api/v1/receive + ``` + +### Authentication Configuration + +**Files**: +- `secrets/rhsso-metrics.clientId` - Empty secret file for Observatorium authentication +- `secrets/rhsso-metrics.clientSecret` - Empty secret file for Observatorium authentication +- `Makefile:630-631` - References to the above secret files in the `secrets/touch` target + +### Misleading Code Comment + +**File**: `pkg/metrics/metrics.go` +- **Line 664**: Contains a misleading comment referencing "observatorium request duration metric" but this is actually for database query metrics, not Observatorium API access + +## Missing Implementation (Confirms Feature is Incomplete) + +The following components are **NOT present** in the codebase, confirming the feature is incomplete: + +1. **No API endpoints** - No routes defined for metrics endpoints in route configuration +2. **No handlers** - No HTTP handlers to process metrics requests +3. **No services** - No service layer to interact with Observatorium +4. **No client code** - No code to authenticate with or query Observatorium APIs +5. **No middleware** - No authentication or authorization middleware for metrics endpoints +6. **No usage** - The generated model structs are never imported or used + +## Removal Plan + +### Phase 1: OpenAPI Schema Cleanup + +Remove the following sections from `openapi/fleet-manager.yaml`: + +1. **Lines 700-760**: Remove all metrics-related schema definitions: + - `MetricsRangeQueryList` + - `MetricsInstantQueryList` + - `MetricsFederationResult` + - `RangeQuery` + - `InstantQuery` + - `values` + +2. **Lines 1038-1058**: Remove example metric data: + - `MetricsRangeQueryExample` + - `MetricsInstantQueryExample` + +### Phase 2: Generated Code Cleanup + +The following files will be automatically removed during the next `make generate` run after the OpenAPI schema changes: + +- `internal/central/pkg/api/public/model_metrics_range_query_list.go` +- `internal/central/pkg/api/public/model_metrics_instant_query_list.go` +- `internal/central/pkg/api/public/model_range_query.go` +- `internal/central/pkg/api/public/model_instant_query.go` +- `internal/central/pkg/api/public/model_values.go` + +### Phase 3: Configuration Cleanup + +1. **Remove authentication secrets**: + - Delete `secrets/rhsso-metrics.clientId` + - Delete `secrets/rhsso-metrics.clientSecret` + - Update `Makefile` lines 630-631 to remove references to these files + +2. **Update CRD files** (Optional): + - Consider removing Observatorium endpoint references from `dev/env/manifests/addons/crds/00-addon-crd.yaml` lines 385-387 if they're not used by other components + +### Phase 4: Code Comment Cleanup + +1. **Fix misleading comment in `pkg/metrics/metrics.go`**: + - **Line 664**: Update comment from "Update the observatorium request duration metric" to "Update the database query duration metric" + +## Impact Assessment + +### Risk Level: **LOW** + +- **No functional impact**: The feature was never implemented, so removal cannot break existing functionality +- **No API compatibility issues**: No actual API endpoints exist to be removed +- **No user impact**: No users are consuming metrics through Fleet Manager API endpoints +- **No data loss**: No metrics data is stored or managed by Fleet Manager + +### Benefits + +1. **Reduced maintenance overhead**: Fewer files to maintain and test +2. **Cleaner codebase**: Removal of unused/incomplete features +3. **Clearer intent**: Eliminates confusion about unimplemented features +4. **Smaller binary size**: Removal of unused generated code + +### Dependencies + +- This removal requires no coordination with other teams since the feature is not implemented +- No migration of existing users needed +- The internal Prometheus metrics collection (for Fleet Manager's own metrics) remains unaffected + +## Testing + +### Verification Steps + +1. **Build verification**: Ensure `make all` completes successfully after changes +2. **OpenAPI validation**: Run `make openapi/validate` to ensure schema is still valid +3. **Generated code verification**: Run `make generate` and verify no metrics-related models are generated +4. **Secret verification**: Ensure application starts without requiring the removed secret files + +### Regression Testing + +- Verify all existing API endpoints continue to function +- Verify internal Prometheus metrics (for Fleet Manager monitoring) still work +- Verify no broken imports or references to removed model files + +## Future Considerations + +If Observatorium metrics functionality is needed in the future: + +1. **Implement complete feature**: Include handlers, services, authentication, and routes +2. **Consider alternative approaches**: Direct Observatorium access might be preferred over proxying through Fleet Manager +3. **Security review**: Ensure proper authentication and authorization for metrics access +4. **Performance considerations**: Evaluate impact of proxying metrics queries through Fleet Manager + +## Implementation Timeline + +- **Immediate**: This cleanup can be implemented immediately with no coordination needed +- **Estimated effort**: 1-2 hours for implementation and testing +- **No feature freeze concerns**: Since feature was never implemented, removal has no compatibility impact + +## Conclusion + +The removal of the incomplete Observatorium metrics feature will simplify the codebase without any functional impact. The feature appears to have been planned but never fully implemented, leaving only unused schema definitions and generated code. This cleanup aligns with best practices of removing dead code and reducing maintenance overhead. \ No newline at end of file diff --git a/.gitignore b/.gitignore index 7016525df2..42261f642a 100644 --- a/.gitignore +++ b/.gitignore @@ -89,3 +89,6 @@ reports/ .envrc e2e-report.json cover.profile + +# AI local configuration +.claude/settings.local.json From c42e0f46a2abcf1fc9811f3a7a7a68602c4aca05 Mon Sep 17 00:00:00 2001 From: Evan Benshetler Date: Thu, 6 Nov 2025 12:23:25 +0100 Subject: [PATCH 2/3] ROX-31635: Remove Observatorium metrics federation --- Makefile | 2 - .../central/pkg/api/public/api/openapi.yaml | 90 ----------------- .../pkg/api/public/model_instant_query.go | 18 ---- .../model_metrics_instant_query_list.go | 18 ---- .../public/model_metrics_range_query_list.go | 18 ---- .../pkg/api/public/model_range_query.go | 17 ---- .../central/pkg/api/public/model_values.go | 17 ---- openapi/fleet-manager.yaml | 97 ------------------- pkg/metrics/metrics.go | 2 +- 9 files changed, 1 insertion(+), 278 deletions(-) delete mode 100644 internal/central/pkg/api/public/model_instant_query.go delete mode 100644 internal/central/pkg/api/public/model_metrics_instant_query_list.go delete mode 100644 internal/central/pkg/api/public/model_metrics_range_query_list.go delete mode 100644 internal/central/pkg/api/public/model_range_query.go delete mode 100644 internal/central/pkg/api/public/model_values.go diff --git a/Makefile b/Makefile index 6ad2715af1..40ee2787a2 100644 --- a/Makefile +++ b/Makefile @@ -612,8 +612,6 @@ secrets/touch: secrets/ocm-service.token \ secrets/rhsso-logs.clientId \ secrets/rhsso-logs.clientSecret \ - secrets/rhsso-metrics.clientId \ - secrets/rhsso-metrics.clientSecret \ secrets/redhatsso-service.clientId \ secrets/redhatsso-service.clientSecret .PHONY: secrets/touch diff --git a/internal/central/pkg/api/public/api/openapi.yaml b/internal/central/pkg/api/public/api/openapi.yaml index 1e9de56134..52d5a2991e 100644 --- a/internal/central/pkg/api/public/api/openapi.yaml +++ b/internal/central/pkg/api/public/api/openapi.yaml @@ -723,27 +723,6 @@ components: supported_instance_types: - standard - eval - MetricsRangeQueryExample: - value: - metric: - __name__: central_server_brokertopicmetrics_bytes_in_total - central_operator_io_cluster: central-service - topic: __consumer_offsets - values: - - timestamp: 1611670230000 - value: 84154 - - timestamp: 1611670260000 - value: 85888 - - timestamp: 1611670290000 - value: 87622 - MetricsInstantQueryExample: - value: - metric: - __name__: central_server_brokertopicmetrics_bytes_in_total - central_operator_io_cluster: central-service - topic: __consumer_offsets - timestamp: 1611670230000 - value: 84154 CloudAccountsList: value: cloudAccounts: @@ -1176,51 +1155,6 @@ components: required: - enabled - supported_instance_types - MetricsRangeQueryList: - allOf: - - $ref: '#/components/schemas/MetricsRangeQueryList_allOf' - RangeQuery: - properties: - metric: - additionalProperties: - type: string - type: object - values: - items: - $ref: '#/components/schemas/values' - type: array - type: object - values: - properties: - timestamp: - format: int64 - type: integer - value: - format: double - type: number - required: - - value - type: object - MetricsInstantQueryList: - allOf: - - $ref: '#/components/schemas/MetricsInstantQueryList_allOf' - MetricsFederationResult: - type: string - InstantQuery: - properties: - metric: - additionalProperties: - type: string - type: object - timestamp: - format: int64 - type: integer - value: - format: double - type: number - required: - - value - type: object CloudAccountsList: example: cloudAccounts: @@ -1339,30 +1273,6 @@ components: allOf: - $ref: '#/components/schemas/CloudRegion' type: array - MetricsRangeQueryList_allOf: - example: '{"kind":"MetricsRangeQueryList","id":"1nbpS70HduPe4l0to8jSg2CLzfu","items":{"$ref":"#/components/examples/MetricsRangeQueryExample"}}' - properties: - kind: - type: string - id: - type: string - items: - items: - allOf: - - $ref: '#/components/schemas/RangeQuery' - type: array - MetricsInstantQueryList_allOf: - example: '{"kind":"MetricsInstantQueryList","id":"1nbpS70HduPe4l0to8jSg2CLzfu","items":{"$ref":"#/components/examples/MetricsInstantQueryExample"}}' - properties: - kind: - type: string - id: - type: string - items: - items: - allOf: - - $ref: '#/components/schemas/InstantQuery' - type: array securitySchemes: Bearer: bearerFormat: JWT diff --git a/internal/central/pkg/api/public/model_instant_query.go b/internal/central/pkg/api/public/model_instant_query.go deleted file mode 100644 index 4bc173d868..0000000000 --- a/internal/central/pkg/api/public/model_instant_query.go +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Red Hat Advanced Cluster Security Service Fleet Manager - * - * Red Hat Advanced Cluster Security (RHACS) Service Fleet Manager is a Rest API to manage instances of ACS components. - * - * API version: 1.2.0 - * Generated by: OpenAPI Generator (https://openapi-generator.tech) - */ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. -package public - -// InstantQuery struct for InstantQuery -type InstantQuery struct { - Metric map[string]string `json:"metric,omitempty"` - Timestamp int64 `json:"timestamp,omitempty"` - Value float64 `json:"value"` -} diff --git a/internal/central/pkg/api/public/model_metrics_instant_query_list.go b/internal/central/pkg/api/public/model_metrics_instant_query_list.go deleted file mode 100644 index 34310ce3a7..0000000000 --- a/internal/central/pkg/api/public/model_metrics_instant_query_list.go +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Red Hat Advanced Cluster Security Service Fleet Manager - * - * Red Hat Advanced Cluster Security (RHACS) Service Fleet Manager is a Rest API to manage instances of ACS components. - * - * API version: 1.2.0 - * Generated by: OpenAPI Generator (https://openapi-generator.tech) - */ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. -package public - -// MetricsInstantQueryList struct for MetricsInstantQueryList -type MetricsInstantQueryList struct { - Kind string `json:"kind,omitempty"` - Id string `json:"id,omitempty"` - Items []InstantQuery `json:"items,omitempty"` -} diff --git a/internal/central/pkg/api/public/model_metrics_range_query_list.go b/internal/central/pkg/api/public/model_metrics_range_query_list.go deleted file mode 100644 index ac5fafbc50..0000000000 --- a/internal/central/pkg/api/public/model_metrics_range_query_list.go +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Red Hat Advanced Cluster Security Service Fleet Manager - * - * Red Hat Advanced Cluster Security (RHACS) Service Fleet Manager is a Rest API to manage instances of ACS components. - * - * API version: 1.2.0 - * Generated by: OpenAPI Generator (https://openapi-generator.tech) - */ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. -package public - -// MetricsRangeQueryList struct for MetricsRangeQueryList -type MetricsRangeQueryList struct { - Kind string `json:"kind,omitempty"` - Id string `json:"id,omitempty"` - Items []RangeQuery `json:"items,omitempty"` -} diff --git a/internal/central/pkg/api/public/model_range_query.go b/internal/central/pkg/api/public/model_range_query.go deleted file mode 100644 index 27ca5e5099..0000000000 --- a/internal/central/pkg/api/public/model_range_query.go +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Red Hat Advanced Cluster Security Service Fleet Manager - * - * Red Hat Advanced Cluster Security (RHACS) Service Fleet Manager is a Rest API to manage instances of ACS components. - * - * API version: 1.2.0 - * Generated by: OpenAPI Generator (https://openapi-generator.tech) - */ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. -package public - -// RangeQuery struct for RangeQuery -type RangeQuery struct { - Metric map[string]string `json:"metric,omitempty"` - Values []Values `json:"values,omitempty"` -} diff --git a/internal/central/pkg/api/public/model_values.go b/internal/central/pkg/api/public/model_values.go deleted file mode 100644 index f1b9bddeeb..0000000000 --- a/internal/central/pkg/api/public/model_values.go +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Red Hat Advanced Cluster Security Service Fleet Manager - * - * Red Hat Advanced Cluster Security (RHACS) Service Fleet Manager is a Rest API to manage instances of ACS components. - * - * API version: 1.2.0 - * Generated by: OpenAPI Generator (https://openapi-generator.tech) - */ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. -package public - -// Values struct for Values -type Values struct { - Timestamp int64 `json:"timestamp,omitempty"` - Value float64 `json:"value"` -} diff --git a/openapi/fleet-manager.yaml b/openapi/fleet-manager.yaml index 340f10425f..524b662cbd 100644 --- a/openapi/fleet-manager.yaml +++ b/openapi/fleet-manager.yaml @@ -697,82 +697,6 @@ components: required: - enabled - supported_instance_types - # user-facing metrics related # - MetricsRangeQueryList: - allOf: - - type: object - example: - kind: "MetricsRangeQueryList" - id: "1nbpS70HduPe4l0to8jSg2CLzfu" - items: - $ref: "#/components/examples/MetricsRangeQueryExample" - properties: - kind: - type: string - id: - type: string - items: - type: array - items: - allOf: - - $ref: "#/components/schemas/RangeQuery" - RangeQuery: - type: object - properties: - metric: - type: object - additionalProperties: - type: string - values: - type: array - items: - $ref: "#/components/schemas/values" - values: - type: object - properties: - timestamp: - type: integer - format: int64 - value: - type: number - format: double - required: - - value - MetricsInstantQueryList: - allOf: - - type: object - example: - kind: "MetricsInstantQueryList" - id: "1nbpS70HduPe4l0to8jSg2CLzfu" - items: - $ref: "#/components/examples/MetricsInstantQueryExample" - properties: - kind: - type: string - id: - type: string - items: - type: array - items: - allOf: - - $ref: "#/components/schemas/InstantQuery" - MetricsFederationResult: - type: string - InstantQuery: - type: object - properties: - metric: - type: object - additionalProperties: - type: string - timestamp: - type: integer - format: int64 - value: - type: number - format: double - required: - - value CloudAccountsList: type: object properties: @@ -1035,27 +959,6 @@ components: display_name: "US East, N. Virginia" enabled: true supported_instance_types: ["standard", "eval"] - MetricsRangeQueryExample: - value: - metric: - __name__: central_server_brokertopicmetrics_bytes_in_total - central_operator_io_cluster: central-service - topic: __consumer_offsets - values: - - timestamp: 1611670230000 - value: 84154 - - timestamp: 1611670260000 - value: 85888 - - timestamp: 1611670290000 - value: 87622 - MetricsInstantQueryExample: - value: - metric: - __name__: central_server_brokertopicmetrics_bytes_in_total - central_operator_io_cluster: central-service - topic: __consumer_offsets - timestamp: 1611670230000 - value: 84154 CloudAccountsList: value: cloudAccounts: diff --git a/pkg/metrics/metrics.go b/pkg/metrics/metrics.go index 2eb3219224..7315766437 100644 --- a/pkg/metrics/metrics.go +++ b/pkg/metrics/metrics.go @@ -622,7 +622,7 @@ func init() { GitopsConfigProviderErrorCounter.WithLabelValues().Add(0) } -// UpdateDatabaseQueryDurationMetric Update the observatorium request duration metric with the following labels: +// UpdateDatabaseQueryDurationMetric Update the database query duration metric with the following labels: // - status: (i.e. "success" or "failure") // - queryType: (i.e. "SELECT", "UPDATE", "INSERT", "DELETE") func UpdateDatabaseQueryDurationMetric(status string, queryType string, elapsed time.Duration) { From e9fce24151af51e17d58bff21eb5b44f91e44cd6 Mon Sep 17 00:00:00 2001 From: Yury Kovalev <8366110+kovayur@users.noreply.github.com> Date: Wed, 1 Apr 2026 14:17:44 +0200 Subject: [PATCH 3/3] ROX-31635: Fix pre-commit and remove excessive doc files (#2646) --- .../observatorium-metrics-removal.md | 162 ---------------- .design-proposals/remove-dead-code-sentry.md | 183 ------------------ .secrets.baseline | 11 +- 3 files changed, 1 insertion(+), 355 deletions(-) delete mode 100644 .design-proposals/observatorium-metrics-removal.md delete mode 100644 .design-proposals/remove-dead-code-sentry.md diff --git a/.design-proposals/observatorium-metrics-removal.md b/.design-proposals/observatorium-metrics-removal.md deleted file mode 100644 index 5013049a46..0000000000 --- a/.design-proposals/observatorium-metrics-removal.md +++ /dev/null @@ -1,162 +0,0 @@ -# Design Proposal: Remove Deprecated Observatorium Metrics Feature - -## Summary - -This proposal outlines the removal of the deprecated Observatorium metrics functionality from the ACS Fleet Manager. The feature includes OpenAPI schema definitions for exposing Prometheus metrics via Fleet Manager API endpoints, but the actual implementation (handlers, routes, services) was never completed. This cleanup will remove unused code and reduce maintenance overhead. - -## Background - -The ACS Fleet Manager OpenAPI specifications contain comprehensive schema definitions for metrics endpoints that would theoretically interact with Observatorium (Red Hat's managed Prometheus service). However, after thorough analysis, these schemas are not connected to any actual API endpoints, handlers, or service implementations. This indicates the feature was planned but never fully implemented. - -## Current State Analysis - -### OpenAPI Schema Definitions (Exist but Unused) - -The following schemas are defined in the OpenAPI specification but have no corresponding API endpoints or handlers: - -**File**: `openapi/fleet-manager.yaml` -- **Lines 700-718**: `MetricsRangeQueryList` schema definition -- **Lines 741-758**: `MetricsInstantQueryList` schema definition -- **Lines 759-760**: `MetricsFederationResult` schema definition -- **Lines 1038-1058**: Example metric data (`MetricsRangeQueryExample`, `MetricsInstantQueryExample`) - -### Generated Model Files (Auto-generated, No Usage) - -The following Go model files are generated from the OpenAPI schemas but not used anywhere in the codebase: - -- `internal/central/pkg/api/public/model_metrics_range_query_list.go` - MetricsRangeQueryList struct -- `internal/central/pkg/api/public/model_metrics_instant_query_list.go` - MetricsInstantQueryList struct -- `internal/central/pkg/api/public/model_range_query.go` - RangeQuery struct -- `internal/central/pkg/api/public/model_instant_query.go` - InstantQuery struct -- `internal/central/pkg/api/public/model_values.go` - Values struct - -### Configuration References - -**File**: `dev/env/manifests/addons/crds/00-addon-crd.yaml` -- **Lines 385-387**: Contains Observatorium endpoint URLs for staging and production environments - ```yaml - - Staging: https://observatorium-mst.stage.api.openshift.com/api/metrics/v1//api/v1/receive - - Production: https://observatorium-mst.api.openshift.com/api/metrics/v1//api/v1/receive - ``` - -### Authentication Configuration - -**Files**: -- `secrets/rhsso-metrics.clientId` - Empty secret file for Observatorium authentication -- `secrets/rhsso-metrics.clientSecret` - Empty secret file for Observatorium authentication -- `Makefile:630-631` - References to the above secret files in the `secrets/touch` target - -### Misleading Code Comment - -**File**: `pkg/metrics/metrics.go` -- **Line 664**: Contains a misleading comment referencing "observatorium request duration metric" but this is actually for database query metrics, not Observatorium API access - -## Missing Implementation (Confirms Feature is Incomplete) - -The following components are **NOT present** in the codebase, confirming the feature is incomplete: - -1. **No API endpoints** - No routes defined for metrics endpoints in route configuration -2. **No handlers** - No HTTP handlers to process metrics requests -3. **No services** - No service layer to interact with Observatorium -4. **No client code** - No code to authenticate with or query Observatorium APIs -5. **No middleware** - No authentication or authorization middleware for metrics endpoints -6. **No usage** - The generated model structs are never imported or used - -## Removal Plan - -### Phase 1: OpenAPI Schema Cleanup - -Remove the following sections from `openapi/fleet-manager.yaml`: - -1. **Lines 700-760**: Remove all metrics-related schema definitions: - - `MetricsRangeQueryList` - - `MetricsInstantQueryList` - - `MetricsFederationResult` - - `RangeQuery` - - `InstantQuery` - - `values` - -2. **Lines 1038-1058**: Remove example metric data: - - `MetricsRangeQueryExample` - - `MetricsInstantQueryExample` - -### Phase 2: Generated Code Cleanup - -The following files will be automatically removed during the next `make generate` run after the OpenAPI schema changes: - -- `internal/central/pkg/api/public/model_metrics_range_query_list.go` -- `internal/central/pkg/api/public/model_metrics_instant_query_list.go` -- `internal/central/pkg/api/public/model_range_query.go` -- `internal/central/pkg/api/public/model_instant_query.go` -- `internal/central/pkg/api/public/model_values.go` - -### Phase 3: Configuration Cleanup - -1. **Remove authentication secrets**: - - Delete `secrets/rhsso-metrics.clientId` - - Delete `secrets/rhsso-metrics.clientSecret` - - Update `Makefile` lines 630-631 to remove references to these files - -2. **Update CRD files** (Optional): - - Consider removing Observatorium endpoint references from `dev/env/manifests/addons/crds/00-addon-crd.yaml` lines 385-387 if they're not used by other components - -### Phase 4: Code Comment Cleanup - -1. **Fix misleading comment in `pkg/metrics/metrics.go`**: - - **Line 664**: Update comment from "Update the observatorium request duration metric" to "Update the database query duration metric" - -## Impact Assessment - -### Risk Level: **LOW** - -- **No functional impact**: The feature was never implemented, so removal cannot break existing functionality -- **No API compatibility issues**: No actual API endpoints exist to be removed -- **No user impact**: No users are consuming metrics through Fleet Manager API endpoints -- **No data loss**: No metrics data is stored or managed by Fleet Manager - -### Benefits - -1. **Reduced maintenance overhead**: Fewer files to maintain and test -2. **Cleaner codebase**: Removal of unused/incomplete features -3. **Clearer intent**: Eliminates confusion about unimplemented features -4. **Smaller binary size**: Removal of unused generated code - -### Dependencies - -- This removal requires no coordination with other teams since the feature is not implemented -- No migration of existing users needed -- The internal Prometheus metrics collection (for Fleet Manager's own metrics) remains unaffected - -## Testing - -### Verification Steps - -1. **Build verification**: Ensure `make all` completes successfully after changes -2. **OpenAPI validation**: Run `make openapi/validate` to ensure schema is still valid -3. **Generated code verification**: Run `make generate` and verify no metrics-related models are generated -4. **Secret verification**: Ensure application starts without requiring the removed secret files - -### Regression Testing - -- Verify all existing API endpoints continue to function -- Verify internal Prometheus metrics (for Fleet Manager monitoring) still work -- Verify no broken imports or references to removed model files - -## Future Considerations - -If Observatorium metrics functionality is needed in the future: - -1. **Implement complete feature**: Include handlers, services, authentication, and routes -2. **Consider alternative approaches**: Direct Observatorium access might be preferred over proxying through Fleet Manager -3. **Security review**: Ensure proper authentication and authorization for metrics access -4. **Performance considerations**: Evaluate impact of proxying metrics queries through Fleet Manager - -## Implementation Timeline - -- **Immediate**: This cleanup can be implemented immediately with no coordination needed -- **Estimated effort**: 1-2 hours for implementation and testing -- **No feature freeze concerns**: Since feature was never implemented, removal has no compatibility impact - -## Conclusion - -The removal of the incomplete Observatorium metrics feature will simplify the codebase without any functional impact. The feature appears to have been planned but never fully implemented, leaving only unused schema definitions and generated code. This cleanup aligns with best practices of removing dead code and reducing maintenance overhead. \ No newline at end of file diff --git a/.design-proposals/remove-dead-code-sentry.md b/.design-proposals/remove-dead-code-sentry.md deleted file mode 100644 index 7c48b8d5be..0000000000 --- a/.design-proposals/remove-dead-code-sentry.md +++ /dev/null @@ -1,183 +0,0 @@ -# Design Proposal: Remove Dead Sentry Code - -## Summary - -This proposal outlines the removal of unused Sentry logging functionality from the ACS Fleet Manager codebase. The Sentry error monitoring feature was implemented but is not being used in production, making it dead code that should be cleaned up. - -## Background - -Sentry is an error monitoring service that was integrated into Fleet Manager to capture and report errors in real-time. However, this functionality is currently disabled and not used in production environments. The code, configuration, and documentation related to Sentry should be removed to: - -- Reduce codebase complexity -- Remove unused dependencies -- Simplify configuration -- Eliminate dead code paths - -## Current Sentry Implementation - -### Core Package Files -The following files constitute the main Sentry implementation: - -1. **`pkg/services/sentry/sentry.go`** - Main Sentry initialization logic -2. **`pkg/services/sentry/config.go`** - Sentry configuration structure and flags -3. **`pkg/services/sentry/providers.go`** - Dependency injection setup for Sentry - -### Integration Points - -1. **Logger Integration** (`pkg/logger/logger.go`): - - Lines 10, 99, 108, 215, 223, 230-233, 240, 243-253: Sentry hub usage and event capture - - Sentry integration in error, warning, and fatal logging methods - -2. **Core Providers** (`pkg/providers/core.go`): - - Line 23: Import of sentry services - - Line 49: Sentry config providers registration - -3. **Environment Configurations**: - - `internal/central/pkg/environments/development.go` - Line 17: Sentry disabled - - `internal/central/pkg/environments/integration.go` - References to Sentry - - `internal/central/pkg/environments/production.go` - Sentry configuration - -### Configuration and Deployment Files - -1. **Kubernetes Templates**: - - `templates/secrets-template.yml`: - - Lines 53-54: SENTRY_KEY parameter definition - - Line 103: sentry.key secret mapping - - `templates/service-template.yml`: - - Lines 158-178: Sentry-related parameters (ENABLE_SENTRY, SENTRY_URL, etc.) - - Lines 663, 946-951: Sentry configuration flags in deployment - -2. **Makefile**: - - References to `secrets/sentry.key` file - - Sentry key parameter handling in deployment targets - -### Documentation References - -1. **Feature Documentation**: - - `docs/legacy/feature-flags.md` - Lines 18, 93-100: Sentry feature flag documentation - - `docs/development/running-fleet-manager.md` - Lines 11, 19: Environment descriptions mentioning Sentry - - `docs/development/populating-configuration.md` - Lines 118-132: Sentry configuration setup - - `docs/legacy/development/error-handling.md` - Lines 61, 66, 68, 90: Error handling with Sentry - - `CONTRIBUTING.md` - Lines 116-136: Sentry logging examples - -### Dependencies - -1. **Go Module** (`go.mod`): - - Line 22: `github.com/getsentry/sentry-go v0.34.0` dependency - -### Configuration Files - -1. **Environment Files**: - - Various environment files contain Sentry-related configurations that need to be cleaned up - -## Removal Plan - -### Phase 1: Remove Core Sentry Package -1. Delete the entire `pkg/services/sentry/` directory and all its contents: - - `pkg/services/sentry/sentry.go` - - `pkg/services/sentry/config.go` - - `pkg/services/sentry/providers.go` - -### Phase 2: Remove Integration Points -1. **Update `pkg/logger/logger.go`**: - - Remove Sentry import (line 10) - - Remove `sentryHub *sentry.Hub` field from logger struct (line 99) - - Remove Sentry hub initialization in `NewUHCLogger` (line 108) - - Remove `captureSentryEvent` calls from `Warningf`, `Errorf`, and `Fatalf` methods - - Remove entire `captureSentryEvent` method (lines 243-253) - - Simplify `Error` method to remove Sentry capture logic (lines 229-234) - -2. **Update `pkg/providers/core.go`**: - - Remove Sentry import (line 23) - - Remove Sentry config providers call (line 49) - -### Phase 3: Clean Up Configuration and Deployment -1. **Update Kubernetes templates**: - - `templates/secrets-template.yml`: - - Remove SENTRY_KEY parameter (lines 53-54) - - Remove sentry.key from secrets (line 103) - - `templates/service-template.yml`: - - Remove all Sentry-related parameters (lines 158-178) - - Remove Sentry command-line flags from deployment (lines 946-951) - - Remove sentry.key from fake configmap (line 663) - -2. **Update Makefile**: - - Remove any Sentry key handling logic - - Remove references to `secrets/sentry.key` - -### Phase 4: Remove Environment Configurations -1. **Update environment files**: - - `internal/central/pkg/environments/development.go` - Remove Sentry references - - `internal/central/pkg/environments/integration.go` - Remove Sentry references - - `internal/central/pkg/environments/production.go` - Remove Sentry references - -### Phase 5: Update Documentation -1. **Remove or update documentation files**: - - `docs/legacy/feature-flags.md` - Remove Sentry section (lines 18, 93-100) - - `docs/development/running-fleet-manager.md` - Remove Sentry mentions from environment descriptions - - `docs/development/populating-configuration.md` - Remove Sentry configuration section (lines 118-132) - - `docs/legacy/development/error-handling.md` - Remove Sentry references and update error handling examples - - `CONTRIBUTING.md` - Remove Sentry logging examples and references - -### Phase 6: Remove Dependencies -1. **Update `go.mod`**: - - Remove `github.com/getsentry/sentry-go v0.34.0` dependency - - Run `go mod tidy` to clean up unused dependencies - -### Phase 7: Clean Up Configuration Files -1. **Remove Sentry configuration from environment config files**: - - Check `dev/config/` directory for any Sentry-related configurations - - Remove any `secrets/sentry.key` file references or creation scripts - -## Testing Considerations - -1. **Unit Tests**: Verify that logger tests still pass after removing Sentry integration -2. **Integration Tests**: Ensure that error handling still works correctly without Sentry -3. **Build Verification**: Confirm that the application builds and starts successfully after removal -4. **Deployment Tests**: Verify that Kubernetes deployments work without Sentry configuration - -## Migration Notes - -1. **No Data Migration Required**: Since Sentry is not currently used, no data migration is needed -2. **Configuration Updates**: Existing deployments will need configuration updates to remove Sentry-related parameters -3. **Error Monitoring**: If error monitoring is needed in the future, a different solution should be implemented - -## Verification Steps - -After implementing the removal: - -1. **Code Verification**: - - Search codebase for any remaining "sentry" references (case-insensitive) - - Verify `go mod tidy` removes the Sentry dependency - - Ensure all imports are valid and no unused imports remain - -2. **Build Verification**: - - Run `make binary` to ensure compilation succeeds - - Run `make test` to verify tests pass - - Run `make lint` to check for any linting issues - -3. **Deployment Verification**: - - Verify Kubernetes templates are valid after removing Sentry parameters - - Test local deployment without Sentry configuration - -## Benefits - -1. **Reduced Complexity**: Removes unused code paths and configurations -2. **Cleaner Dependencies**: Eliminates unnecessary external dependency -3. **Simplified Configuration**: Reduces the number of configuration parameters -4. **Maintainability**: Less code to maintain and fewer potential security vulnerabilities -5. **Documentation Clarity**: Removes outdated documentation about unused features - -## Risks - -1. **Accidental Usage**: Low risk that some code might still reference Sentry (mitigated by comprehensive search) -2. **Future Needs**: If error monitoring is needed later, it will require re-implementation (acceptable trade-off for current cleanup) - -## Estimated Effort - -- **Development Time**: ~2-3 hours for a junior engineer -- **Testing Time**: ~1-2 hours -- **Documentation Update**: ~1 hour -- **Total**: ~4-6 hours - -This removal should be straightforward since Sentry is not actively used, making it a low-risk cleanup operation. diff --git a/.secrets.baseline b/.secrets.baseline index c9677ce8cc..0f28f91b69 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -244,15 +244,6 @@ "line_number": 1 } ], - "internal/central/pkg/api/public/api/openapi.yaml": [ - { - "type": "Base64 High Entropy String", - "filename": "internal/central/pkg/api/public/api/openapi.yaml", - "hashed_secret": "5b455797b93de5b6a19633ba22127c8a610f5c1b", - "is_verified": false, - "line_number": 1343 - } - ], "internal/central/pkg/services/centralservice_moq.go": [ { "type": "Secret Keyword", @@ -382,5 +373,5 @@ } ] }, - "generated_at": "2026-01-26T16:35:51Z" + "generated_at": "2026-03-27T17:26:09Z" }