fix(container): unify ManagedContainers metric attributes
- commit
- 01f069e0cfe2020afd0a3c27c4aefc1934f7a0a6
- author
- bnema · · 2026-02-11 20:36 UTC
- parent
- 0567a55
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
1 file · +2 -6
M internal/usecase/container/service.go +2 -6
| @@ -464,9 +464,7 @@ func (s *Service) activateDeployedContainer(ctx context.Context, domainName stri | |||
| 464 | 464 | ||
| 465 | 465 | // Track managed container count (only increment for new domains, not replacements) | |
| 466 | 466 | if !wasTracked && s.metrics != nil { | |
| 467 | - | s.metrics.ManagedContainers.Add(ctx, 1, metric.WithAttributes( | |
| 468 | - | attribute.String("domain", domainName), | |
| 469 | - | )) | |
| 467 | + | s.metrics.ManagedContainers.Add(ctx, 1) | |
| 470 | 468 | } | |
| 471 | 469 | ||
| 472 | 470 | s.publishContainerDeployed(ctx, domainName, container.ID) | |
| @@ -695,9 +693,7 @@ func (s *Service) Remove(ctx context.Context, containerID string, force bool) er | |||
| 695 | 693 | ||
| 696 | 694 | // Decrement managed container count | |
| 697 | 695 | if removedDomain != "" && s.metrics != nil { | |
| 698 | - | s.metrics.ManagedContainers.Add(ctx, -1, metric.WithAttributes( | |
| 699 | - | attribute.String("domain", removedDomain), | |
| 700 | - | )) | |
| 696 | + | s.metrics.ManagedContainers.Add(ctx, -1) | |
| 701 | 697 | } | |
| 702 | 698 | ||
| 703 | 699 | // Note: We intentionally do NOT clean up deployMu entries to avoid a race condition: | |
| @@ -464,9 +464,7 @@ func (s *Service) activateDeployedContainer(ctx context.Context, domainName stri | |||||
| 464 | 464 | ||||
| 465 | // Track managed container count (only increment for new domains, not replacements) | 465 | // Track managed container count (only increment for new domains, not replacements) | ||
| 466 | if !wasTracked && s.metrics != nil { | 466 | if !wasTracked && s.metrics != nil { | ||
| 467 | - | s.metrics.ManagedContainers.Add(ctx, 1, metric.WithAttributes( | 467 | + | s.metrics.ManagedContainers.Add(ctx, 1) |
| 468 | - | attribute.String("domain", domainName), | |||
| 469 | - | )) | |||
| 470 | } | 468 | } | ||
| 471 | 469 | ||||
| 472 | s.publishContainerDeployed(ctx, domainName, container.ID) | 470 | s.publishContainerDeployed(ctx, domainName, container.ID) | ||
| @@ -695,9 +693,7 @@ func (s *Service) Remove(ctx context.Context, containerID string, force bool) er | |||||
| 695 | 693 | ||||
| 696 | // Decrement managed container count | 694 | // Decrement managed container count | ||
| 697 | if removedDomain != "" && s.metrics != nil { | 695 | if removedDomain != "" && s.metrics != nil { | ||
| 698 | - | s.metrics.ManagedContainers.Add(ctx, -1, metric.WithAttributes( | 696 | + | s.metrics.ManagedContainers.Add(ctx, -1) |
| 699 | - | attribute.String("domain", removedDomain), | |||
| 700 | - | )) | |||
| 701 | } | 697 | } | ||
| 702 | 698 | ||||
| 703 | // Note: We intentionally do NOT clean up deployMu entries to avoid a race condition: | 699 | // Note: We intentionally do NOT clean up deployMu entries to avoid a race condition: | ||