Pulse/frontend-modern/src/utils/metricsKeys.ts
rcourtman f7ffb36c41 chore: remove dead code and unused exports
Remove ~900 lines of unused code identified by static analysis:

Go:
- internal/logging: Remove 10 unused functions (InitFromConfig, New,
  FromContext, WithLogger, etc.) that were built but never integrated
- cmd/pulse-sensor-proxy: Remove 7 dead validation functions for a
  removed command execution feature
- internal/metrics: Remove 8 unused notification metric functions and
  10 Prometheus metrics that were never wired up

Frontend:
- Delete ActivationBanner.tsx stub component
- Remove unused exports: stopMetricsSampler, getSamplerStatus,
  formatSpeedCompact, parseMetricKey, getResourceAlerts
2025-11-27 13:17:39 +00:00

26 lines
737 B
TypeScript

/**
* Metrics Key Utilities
*
* Centralized helper for building namespaced metric keys to prevent ID collisions
* across different resource types.
*/
export type MetricResourceKind = 'node' | 'vm' | 'container' | 'dockerHost' | 'dockerContainer';
/**
* Build a namespaced metric key for a resource
* Format: {kind}:{id}
*
* This prevents collisions if different resource types happen to share the same ID.
*/
export function buildMetricKey(kind: MetricResourceKind, id: string): string {
return `${kind}:${id}`;
}
/**
* Extract the prefix from a metric resource kind
* Used for bulk operations on a specific resource type
*/
export function getMetricKeyPrefix(kind: MetricResourceKind): string {
return `${kind}:`;
}