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

force rfc 3339 date format in metrics push #2402

Merged
merged 3 commits into from
Nov 28, 2023
Merged
Changes from 2 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
10 changes: 5 additions & 5 deletions pkg/apiserver/apic_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
machinesInfo[i] = &models.MetricsAgentInfo{
Version: machine.Version,
Name: machine.MachineId,
LastUpdate: machine.UpdatedAt.String(),
LastPush: ptr.OrEmpty(machine.LastPush).String(),
LastUpdate: machine.UpdatedAt.Format(time.RFC3339),
LastPush: ptr.OrEmpty(machine.LastPush).Format(time.RFC3339),
}
}

Expand All @@ -43,7 +43,7 @@
Version: bouncer.Version,
CustomName: bouncer.Name,
Name: bouncer.Type,
LastPull: bouncer.LastPull.String(),
LastPull: bouncer.LastPull.Format(time.RFC3339),

Check warning on line 46 in pkg/apiserver/apic_metrics.go

View check run for this annotation

Codecov / codecov/patch

pkg/apiserver/apic_metrics.go#L46

Added line #L46 was not covered by tests
}
}

Expand Down Expand Up @@ -81,7 +81,7 @@
const checkInt = 20 * time.Second

// intervals must always be > 0
metInts := []time.Duration{1*time.Millisecond, a.metricsIntervalFirst, a.metricsInterval}
metInts := []time.Duration{1 * time.Millisecond, a.metricsIntervalFirst, a.metricsInterval}

log.Infof("Start sending metrics to CrowdSec Central API (interval: %s once, then %s)",
metInts[1].Round(time.Second), metInts[2])
Expand Down Expand Up @@ -123,7 +123,7 @@
reloadMachineIDs()
if !slices.Equal(oldIDs, machineIDs) {
log.Infof("capi metrics: machines changed, immediate send")
metTicker.Reset(1*time.Millisecond)
metTicker.Reset(1 * time.Millisecond)

Check warning on line 126 in pkg/apiserver/apic_metrics.go

View check run for this annotation

Codecov / codecov/patch

pkg/apiserver/apic_metrics.go#L126

Added line #L126 was not covered by tests
}
case <-metTicker.C:
metTicker.Stop()
Expand Down
Loading