diff --git a/pkg/module/usage_metrics/server/module.go b/pkg/module/usage_metrics/server/module.go index a47dd5ec..13c75a1c 100644 --- a/pkg/module/usage_metrics/server/module.go +++ b/pkg/module/usage_metrics/server/module.go @@ -9,6 +9,7 @@ import ( "github.com/pluralsh/kuberentes-agent/pkg/module/modserver" "github.com/pluralsh/kuberentes-agent/pkg/module/modshared" "github.com/pluralsh/kuberentes-agent/pkg/module/usage_metrics" + pluralapi "github.com/pluralsh/kuberentes-agent/pkg/plural/api" "github.com/pluralsh/kuberentes-agent/pkg/tool/errz" ) @@ -53,11 +54,11 @@ func (m *module) sendUsageInternal(ctx context.Context) error { if usageData.IsEmpty() { return nil } - data := UsagePingData{ + data := pluralapi.UsagePingData{ Counters: usageData.Counters, UniqueCounters: usageData.UniqueCounters, } - err := SendUsagePing(data) + err := pluralapi.SendUsagePing(ctx, data) if err != nil { return err // don't wrap } @@ -69,13 +70,3 @@ func (m *module) sendUsageInternal(ctx context.Context) error { func (m *module) Name() string { return usage_metrics.ModuleName } - -// TODO: Send usage to console. Move this code to plural package. -type UsagePingData struct { - Counters map[string]int64 `json:"counters,omitempty"` - UniqueCounters map[string][]int64 `json:"unique_counters,omitempty"` -} - -func SendUsagePing(data UsagePingData) error { - return nil -} diff --git a/pkg/plural/api/send_usage_ping.go b/pkg/plural/api/send_usage_ping.go new file mode 100644 index 00000000..e4d14c53 --- /dev/null +++ b/pkg/plural/api/send_usage_ping.go @@ -0,0 +1,13 @@ +package api + +import "context" + +type UsagePingData struct { + Counters map[string]int64 `json:"counters,omitempty"` + UniqueCounters map[string][]int64 `json:"unique_counters,omitempty"` +} + +// TODO: Implement. +func SendUsagePing(_ context.Context, _ UsagePingData) error { + return nil +}