Skip to content

Commit

Permalink
feat(upgradeinsights): add client stats support to upgrade insights
Browse files Browse the repository at this point in the history
  • Loading branch information
floreks committed Oct 9, 2024
1 parent 2a0e189 commit 9a5fb8d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ require (
github.com/open-policy-agent/gatekeeper/v3 v3.17.1
github.com/orcaman/concurrent-map/v2 v2.0.1
github.com/pkg/errors v0.9.1
github.com/pluralsh/console/go/client v1.20.0
github.com/pluralsh/console/go/client v1.21.0
github.com/pluralsh/controller-reconcile-helper v0.1.0
github.com/pluralsh/gophoenix v0.1.3-0.20231201014135-dff1b4309e34
github.com/pluralsh/polly v0.1.10
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -666,8 +666,8 @@ github.com/phayes/freeport v0.0.0-20220201140144-74d24b5ae9f5/go.mod h1:iIss55rK
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pluralsh/console/go/client v1.20.0 h1:XZ9GcNAcEXRXtcyHZdA1dpi/GovMdHbC+obJgD+RnzE=
github.com/pluralsh/console/go/client v1.20.0/go.mod h1:lpoWASYsM9keNePS3dpFiEisUHEfObIVlSL3tzpKn8k=
github.com/pluralsh/console/go/client v1.21.0 h1:l7gltTPY8gR4qhK0RV8WYBP3MdpwJe96AIclTti9Hz0=
github.com/pluralsh/console/go/client v1.21.0/go.mod h1:lpoWASYsM9keNePS3dpFiEisUHEfObIVlSL3tzpKn8k=
github.com/pluralsh/controller-reconcile-helper v0.1.0 h1:BV3dYZFH5rn8ZvZjtpkACSv/GmLEtRftNQj/Y4ddHEo=
github.com/pluralsh/controller-reconcile-helper v0.1.0/go.mod h1:RxAbvSB4/jkvx616krCdNQXPbpGJXW3J1L3rASxeFOA=
github.com/pluralsh/gophoenix v0.1.3-0.20231201014135-dff1b4309e34 h1:ab2PN+6if/Aq3/sJM0AVdy1SYuMAnq4g20VaKhTm/Bw=
Expand Down
8 changes: 8 additions & 0 deletions internal/controller/upgradeinsights_cloudprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package controller
import (
"context"
"fmt"
"strconv"
"time"

"github.com/aws/aws-sdk-go-v2/aws"
Expand Down Expand Up @@ -156,6 +157,13 @@ func (in *EKSCloudProvider) toInsightDetails(insight *types.Insight) []*console.
ReplacedIn: r.StartServingReplacementVersion,
RemovedIn: r.StopServingVersion,
Status: in.fromClientStats(r.ClientStats),
ClientInfo: algorithms.Map(r.ClientStats, func(cs types.ClientStat) *console.InsightClientInfoAttributes {
return &console.InsightClientInfoAttributes{
UserAgent: cs.UserAgent,
Count: lo.ToPtr(strconv.FormatInt(int64(cs.NumberOfRequestsLast30Days), 10)),
LastRequestAt: lo.ToPtr(cs.LastRequestTime.Format(time.RFC3339)),
}
}),
})
}

Expand Down

0 comments on commit 9a5fb8d

Please sign in to comment.