Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

agent/billing: Use autoscaling.neon.tech/billing-endpoint-id for events #579

Merged
merged 5 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions pkg/agent/billing/billing.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@ type vmMetricsSeconds struct {
activeTime time.Duration
}

const (
EndpointLabel string = "neon/endpoint-id"
)

func RunBillingMetricsCollector(
backgroundCtx context.Context,
parentLogger *zap.Logger,
Expand Down Expand Up @@ -152,7 +148,7 @@ func (s *metricsState) collect(logger *zap.Logger, store VMStoreForNode, metrics
})
}
for _, vm := range vmsOnThisNode {
endpointID, isEndpoint := vm.Labels[EndpointLabel]
endpointID, isEndpoint := vm.Annotations[api.AnnotationBillingEndpointID]
metricsBatch.inc(isEndpointFlag(isEndpoint), autoscalingEnabledFlag(api.HasAutoscalingEnabled(vm)), vm.Status.Phase)
if !isEndpoint {
// we're only reporting metrics for VMs with endpoint IDs, and this VM doesn't have one
Expand Down
1 change: 1 addition & 0 deletions pkg/api/vminfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const (
LabelEnableAutoscaling = "autoscaling.neon.tech/enabled"
AnnotationAutoscalingBounds = "autoscaling.neon.tech/bounds"
AnnotationAutoscalingConfig = "autoscaling.neon.tech/config"
AnnotationBillingEndpointID = "autoscaling.neon.tech/billing-endpoint-id"
)

// HasAutoscalingEnabled returns true iff the object has the label that enables autoscaling
Expand Down
Loading