Skip to content

Updated cache module #647

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

Merged
merged 7 commits into from
Sep 26, 2018
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ require (
github.com/spf13/pflag v1.0.1
github.com/stretchr/objx v0.1.1
github.com/stretchr/testify v1.2.2
github.com/ticketmaster/aws-sdk-go-cache v0.0.0-20180921213015-16a56fa84aac
github.com/ticketmaster/aws-sdk-go-cache v0.0.0-20180926195306-58922816129c
golang.org/x/crypto v0.0.0-20180723164146-c126467f60eb
golang.org/x/net v0.0.0-20180724234803-3673e40ba225
golang.org/x/sys v0.0.0-20180724212812-e072cadbbdc8
Expand Down
25 changes: 4 additions & 21 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
github.com/aws/aws-sdk-go v1.14.33 h1:WEZ+Nfjt0Pln1wcQVt3BBQKABcvUxjqNjkwYAp1wnzE=
github.com/aws/aws-sdk-go v1.14.33/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0=
github.com/aws/aws-sdk-go v1.15.39 h1:MUxm375zGxxVhgL5NNCIDuwn4SkMQsX8CQWD+zLULcw=
github.com/aws/aws-sdk-go v1.15.39/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0=
Expand All @@ -8,8 +6,6 @@ github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdn
github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
github.com/cenkalti/backoff v2.0.0+incompatible h1:5IIPUHhlnUZbcHQsQou5k1Tn58nJkeJL9U+ig5CHJbY=
github.com/cenkalti/backoff v2.0.0+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/eapache/channels v1.1.0 h1:F1taHcn7/F0i8DYqKXJnyhJcVpp2kgFcNePxXtnyu4k=
Expand All @@ -27,8 +23,6 @@ github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekf
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/groupcache v0.0.0-20180513044358-24b0969c4cb7 h1:u4bArs140e9+AfE52mFHOXVFnOSBJBRlzTHrOPLOIhE=
github.com/golang/groupcache v0.0.0-20180513044358-24b0969c4cb7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/protobuf v1.1.0 h1:0iH4Ffd/meGoXqF2lSAhZHt8X+cPgkfn/cb6Cce5Vpc=
github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/google/btree v0.0.0-20180124185431-e89373fe6b4a h1:ZJu5NB1Bk5ms4vw0Xu4i+jD32SE9jQXyfnOvwhHqlT0=
Expand All @@ -49,6 +43,7 @@ github.com/json-iterator/go v0.0.0-20180701071628-ab8a2e0c74be h1:AHimNtVIpiBjPU
github.com/json-iterator/go v0.0.0-20180701071628-ab8a2e0c74be/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/karlseguin/ccache v2.0.2+incompatible h1:MpSlLlHgG3vPWTAIJsSYlyAQsHwfQ2HzgUlbJFh9Ufk=
github.com/karlseguin/ccache v2.0.2+incompatible/go.mod h1:CM9tNPzT6EdRh14+jiW8mEF9mkNZuuE51qmgGYUB93w=
github.com/karlseguin/expect v1.0.1/go.mod h1:zNBxMY8P21owkeogJELCLeHIt+voOSduHYTFUbwRAV8=
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
Expand All @@ -61,34 +56,22 @@ github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR
github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_golang v0.0.0-20180713201052-bcbbc08eb2dd h1:T6Y9DkTZlfcCB1qlrwQFCiAcLhTjmkjxW8EP3ZhV7Ts=
github.com/prometheus/client_golang v0.0.0-20180713201052-bcbbc08eb2dd/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v0.8.0 h1:1921Yw9Gc3iSc4VQh3PIoOqgPCZS7G/4xQNVUp8Mda8=
github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v0.9.0-pre1 h1:AWTOhsOI9qxeirTuA0A4By/1Es1+y9EcCGY6bBZ2fhM=
github.com/prometheus/client_golang v0.9.0-pre1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v0.9.0-pre1.0.20180919114304-73edb9af667d h1:DYicbQQTRiJXT51TQULZYt3cNfpC+5y0TeG/vqwsGH4=
github.com/prometheus/client_golang v0.9.0-pre1.0.20180919114304-73edb9af667d/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 h1:idejC8f05m9MGOsuEi1ATq9shN03HrxNkD/luQvxCv8=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/common v0.0.0-20180518154759-7600349dcfe1 h1:osmNoEW2SCW3L7EX0km2LYM8HKpNWRiouxjE3XHkyGc=
github.com/prometheus/common v0.0.0-20180518154759-7600349dcfe1/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e h1:n/3MEhJQjQxrOUCzh1Y3Re6aJUUWRp2M9+Oc3eVn/54=
github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273 h1:agujYaXJSxSo18YNX3jzl+4G6Bstwt+kqv47GS12uL0=
github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20180920065004-418d78d0b9a7 h1:NgR6WN8nQ4SmFC1sSUHY8SriLuWCZ6cCIQtH4vDZN3c=
github.com/prometheus/procfs v0.0.0-20180920065004-418d78d0b9a7/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/spf13/pflag v1.0.1 h1:aCvUg6QPl3ibpQUxyLkrEkCHtPqYJL4x9AuhqVqFis4=
github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/ticketmaster/aws-sdk-go-cache v0.0.0-20180921202740-1e3c11921d56 h1:6G0xCL3YDKiE5Y6WL/FQHlPTbIib1F/W6wGb95HUUOM=
github.com/ticketmaster/aws-sdk-go-cache v0.0.0-20180921202740-1e3c11921d56/go.mod h1:BxK9RuImIB1miXVNCwzH4K1v1hq48ZyUFrgGGV+rYuk=
github.com/ticketmaster/aws-sdk-go-cache v0.0.0-20180921211908-6cca1e60b3c2 h1:rikJ+c8/TXfPlsbZXu8BAEuFzOBTrbmsrA/MdAMMtrA=
github.com/ticketmaster/aws-sdk-go-cache v0.0.0-20180921211908-6cca1e60b3c2/go.mod h1:6mN3wnKE+Yn0E3aiUE0YTjOd7rfgxfGvZhN1ei8RZh8=
github.com/ticketmaster/aws-sdk-go-cache v0.0.0-20180921213015-16a56fa84aac h1:3JEamh93jxTpTwgjua/oq7DohXE0ZUHttVrAw+gQvxs=
github.com/ticketmaster/aws-sdk-go-cache v0.0.0-20180921213015-16a56fa84aac/go.mod h1:6mN3wnKE+Yn0E3aiUE0YTjOd7rfgxfGvZhN1ei8RZh8=
github.com/ticketmaster/aws-sdk-go-cache v0.0.0-20180926195306-58922816129c h1:3cRzuTKE8C2VkXUQNHOU7FWOOMN1Ddklypzs4ZyQSBw=
github.com/ticketmaster/aws-sdk-go-cache v0.0.0-20180926195306-58922816129c/go.mod h1:H9sbOivuFYIUAS9No3MxP7K6WXz8i8Xg4qRJ/nu3zM4=
github.com/wsxiaoys/terminal v0.0.0-20160513160801-0940f3fc43a0/go.mod h1:IXCdmsXIht47RaVFLEdVnh1t+pgYtTAhQGj73kz+2DM=
golang.org/x/crypto v0.0.0-20180723164146-c126467f60eb h1:Ah9YqXLj6fEgeKqcmBuLCbAsrF3ScD7dJ/bYM0C6tXI=
golang.org/x/crypto v0.0.0-20180723164146-c126467f60eb/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225 h1:kNX+jCowfMYzvlSvJu5pQWEmyWFrBXJ3PBy10xKMXK8=
Expand Down
41 changes: 24 additions & 17 deletions internal/aws/albrgt/rgt.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package albrgt

import (
"os"
"strings"

"github.com/aws/aws-sdk-go/service/ec2"
Expand Down Expand Up @@ -58,6 +59,7 @@ func (r *RGT) GetClusterResources() (*Resources, error) {

paramSet := []*resourcegroupstaggingapi.GetResourcesInput{
{
ResourcesPerPage: aws.Int64(50),
ResourceTypeFilters: []*string{
aws.String("ec2"),
},
Expand All @@ -73,6 +75,7 @@ func (r *RGT) GetClusterResources() (*Resources, error) {
},
},
{
ResourcesPerPage: aws.Int64(50),
ResourceTypeFilters: []*string{
aws.String("ec2"),
},
Expand All @@ -88,6 +91,7 @@ func (r *RGT) GetClusterResources() (*Resources, error) {
},
},
{
ResourcesPerPage: aws.Int64(50),
ResourceTypeFilters: []*string{
aws.String("elasticloadbalancing"),
},
Expand Down Expand Up @@ -123,25 +127,28 @@ func (r *RGT) GetClusterResources() (*Resources, error) {
}
}

// Legacy deployments may not have the proper tags, and RGT doesn't allow you to use wildcards on names
err := r.GetResourcesPages(&resourcegroupstaggingapi.GetResourcesInput{
ResourceTypeFilters: []*string{
aws.String("elasticloadbalancing"),
},
}, func(page *resourcegroupstaggingapi.GetResourcesOutput, lastPage bool) bool {
for _, rtm := range page.ResourceTagMappingList {
s := strings.Split(*rtm.ResourceARN, ":")
if strings.HasPrefix(s[5], "targetgroup/"+r.clusterName) {
resources.TargetGroups[*rtm.ResourceARN] = rgtTagAsELBV2Tag(rtm.Tags)
}
if strings.HasPrefix(s[5], "loadbalancer/app/"+r.clusterName) {
resources.LoadBalancers[*rtm.ResourceARN] = rgtTagAsELBV2Tag(rtm.Tags)
if os.Getenv("ALB_SUPPORT_LEGACY_DEPLOYMENTS") != "" {
// Legacy deployments may not have the proper tags, and RGT doesn't allow you to use wildcards on names
err := r.GetResourcesPages(&resourcegroupstaggingapi.GetResourcesInput{
ResourcesPerPage: aws.Int64(50),
ResourceTypeFilters: []*string{
aws.String("elasticloadbalancing"),
},
}, func(page *resourcegroupstaggingapi.GetResourcesOutput, lastPage bool) bool {
for _, rtm := range page.ResourceTagMappingList {
s := strings.Split(*rtm.ResourceARN, ":")
if strings.HasPrefix(s[5], "targetgroup/"+r.clusterName) {
resources.TargetGroups[*rtm.ResourceARN] = rgtTagAsELBV2Tag(rtm.Tags)
}
if strings.HasPrefix(s[5], "loadbalancer/app/"+r.clusterName) {
resources.LoadBalancers[*rtm.ResourceARN] = rgtTagAsELBV2Tag(rtm.Tags)
}
}
return true
})
if err != nil {
return nil, err
}
return true
})
if err != nil {
return nil, err
}

return resources, nil
Expand Down
28 changes: 8 additions & 20 deletions internal/aws/albsession/session.go
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
package albsession

import (
"context"
"fmt"
"time"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/aws/aws-sdk-go/service/resourcegroupstaggingapi"
"github.com/golang/glog"
"github.com/kubernetes-sigs/aws-alb-ingress-controller/internal/ingress/metric"
"github.com/kubernetes-sigs/aws-alb-ingress-controller/pkg/util/log"
"github.com/prometheus/client_golang/prometheus"
"github.com/ticketmaster/aws-sdk-go-cache/cache"
)

type timingContextKeyType int

var timingContextKey = new(timingContextKeyType)

// NewSession returns an AWS session based off of the provided AWS config
func NewSession(awsconfig *aws.Config, AWSDebug bool, mc metric.Collector, cc *cache.Config) *session.Session {
session, err := session.NewSession(awsconfig)
Expand All @@ -28,13 +25,10 @@ func NewSession(awsconfig *aws.Config, AWSDebug bool, mc metric.Collector, cc *c
return nil
}

session.Handlers.Validate.PushFront(func(r *request.Request) {
r.HTTPRequest = r.HTTPRequest.WithContext(context.WithValue(r.HTTPRequest.Context(), timingContextKey, time.Now()))
})

// Adds caching to session
cache.AddCaching(session, cc)
cc.SetCacheTTL("tagging", "GetResources", time.Hour)
cc.SetCacheTTL(resourcegroupstaggingapi.ServiceName, "GetResources", time.Hour)
cc.SetCacheTTL(ec2.ServiceName, "DescribeInstanceStatus", time.Minute)

session.Handlers.Retry.PushFront(func(r *request.Request) {
mc.IncAPIRetryCount(prometheus.Labels{"service": r.ClientInfo.ServiceName, "operation": r.Operation.Name})
Expand All @@ -48,21 +42,15 @@ func NewSession(awsconfig *aws.Config, AWSDebug bool, mc metric.Collector, cc *c
})

session.Handlers.Complete.PushFront(func(r *request.Request) {
ctx := r.HTTPRequest.Context()
if !cache.IsCacheHit(ctx) {
startTime := ctx.Value(timingContextKey)
if startTime != nil {
mc.ObserveAPIRequest(
prometheus.Labels{"service": r.ClientInfo.ServiceName, "operation": r.Operation.Name},
startTime.(time.Time))
}
}

if r.Error != nil {
mc.IncAPIErrorCount(prometheus.Labels{"service": r.ClientInfo.ServiceName, "operation": r.Operation.Name})
if AWSDebug {
glog.ErrorDepth(4, fmt.Sprintf("Failed request: %s/%s, Payload: %s, Error: %s", r.ClientInfo.ServiceName, r.Operation.Name, log.Prettify(r.Params), r.Error))
}
} else {
if AWSDebug {
glog.InfoDepth(4, fmt.Sprintf("Response: %s/%s, Body: %s", r.ClientInfo.ServiceName, r.Operation.Name, log.Prettify(r.Data)))
}
}
})
return session
Expand Down
27 changes: 3 additions & 24 deletions internal/ingress/metric/collectors/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,16 @@ limitations under the License.
package collectors

import (
"time"

"github.com/prometheus/client_golang/prometheus"
)

// AWSAPIController defines base metrics about the AWS API client
type AWSAPIController struct {
prometheus.Collector

awsAPIRequest *prometheus.CounterVec
awsAPIRequestLatency *prometheus.HistogramVec
awsAPIError *prometheus.CounterVec
awsAPIRetry *prometheus.CounterVec
awsAPIRequest *prometheus.CounterVec
awsAPIError *prometheus.CounterVec
awsAPIRetry *prometheus.CounterVec
}

// NewAWSAPIController creates a new prometheus collector for the
Expand All @@ -44,17 +41,6 @@ func NewAWSAPIController() *AWSAPIController {
},
[]string{"service", "operation"},
),
awsAPIRequestLatency: prometheus.NewHistogramVec(prometheus.HistogramOpts{
Namespace: PrometheusNamespace,
Name: "aws_api_requests_latency_seconds",
Help: `Total latency distributions of requests made to the AWS API (in seconds)`,

// lowest bucket start of upper bound 0.0001 sec (0.1 ms) with factor 2
// highest bucket start of 0.0001 sec * 2^17 == 13.1072 sec
Buckets: prometheus.ExponentialBuckets(0.0001, 2, 18),
},
[]string{"service", "operation"},
),
awsAPIError: prometheus.NewCounterVec(
prometheus.CounterOpts{
Namespace: PrometheusNamespace,
Expand All @@ -79,11 +65,6 @@ func (a *AWSAPIController) IncAPIRequestCount(l prometheus.Labels) {
a.awsAPIRequest.With(l).Inc()
}

// ObserveAPIRequest tracks request latency
func (a *AWSAPIController) ObserveAPIRequest(l prometheus.Labels, start time.Time) {
a.awsAPIRequestLatency.With(l).Observe(time.Since(start).Seconds())
}

// IncAPIErrorCount increment the reconcile counter
func (a *AWSAPIController) IncAPIErrorCount(l prometheus.Labels) {
a.awsAPIError.With(l).Inc()
Expand All @@ -97,15 +78,13 @@ func (a *AWSAPIController) IncAPIRetryCount(l prometheus.Labels) {
// Describe implements prometheus.Collector
func (a AWSAPIController) Describe(ch chan<- *prometheus.Desc) {
a.awsAPIRequest.Describe(ch)
a.awsAPIRequestLatency.Describe(ch)
a.awsAPIError.Describe(ch)
a.awsAPIRetry.Describe(ch)
}

// Collect implements the prometheus.Collector interface.
func (a AWSAPIController) Collect(ch chan<- prometheus.Metric) {
a.awsAPIRequest.Collect(ch)
a.awsAPIRequestLatency.Collect(ch)
a.awsAPIError.Collect(ch)
a.awsAPIRetry.Collect(ch)
}
5 changes: 0 additions & 5 deletions internal/ingress/metric/dummy.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ limitations under the License.
package metric

import (
"time"

"github.com/prometheus/client_golang/prometheus"
)

Expand All @@ -37,9 +35,6 @@ func (dc DummyCollector) SetManagedIngresses(map[string]int) {}
// IncAPIRequestCount ...
func (dc DummyCollector) IncAPIRequestCount(prometheus.Labels) {}

// ObserveAPIRequest ...
func (dc DummyCollector) ObserveAPIRequest(prometheus.Labels, time.Time) {}

// IncAPIErrorCount ...
func (dc DummyCollector) IncAPIErrorCount(prometheus.Labels) {}

Expand Down
7 changes: 0 additions & 7 deletions internal/ingress/metric/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ limitations under the License.
package metric

import (
"time"

"github.com/prometheus/client_golang/prometheus"

"github.com/kubernetes-sigs/aws-alb-ingress-controller/internal/ingress/annotations/class"
Expand All @@ -32,7 +30,6 @@ type Collector interface {
SetManagedIngresses(map[string]int)

IncAPIRequestCount(prometheus.Labels)
ObserveAPIRequest(prometheus.Labels, time.Time)
IncAPIErrorCount(prometheus.Labels)
IncAPIRetryCount(prometheus.Labels)

Expand Down Expand Up @@ -77,10 +74,6 @@ func (c *collector) IncAPIRequestCount(l prometheus.Labels) {
c.awsAPIController.IncAPIRequestCount(l)
}

func (c *collector) ObserveAPIRequest(l prometheus.Labels, start time.Time) {
c.awsAPIController.ObserveAPIRequest(l, start)
}

func (c *collector) IncAPIErrorCount(l prometheus.Labels) {
c.awsAPIController.IncAPIErrorCount(l)
}
Expand Down