Skip to content

Commit b2ff2d6

Browse files
authored
Merge pull request #647 from kubernetes-sigs/645-cache-update
Updated cache module
2 parents b1c9d87 + c479862 commit b2ff2d6

File tree

7 files changed

+40
-95
lines changed

7 files changed

+40
-95
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ require (
3737
github.com/spf13/pflag v1.0.1
3838
github.com/stretchr/objx v0.1.1
3939
github.com/stretchr/testify v1.2.2
40-
github.com/ticketmaster/aws-sdk-go-cache v0.0.0-20180921213015-16a56fa84aac
40+
github.com/ticketmaster/aws-sdk-go-cache v0.0.0-20180926195306-58922816129c
4141
golang.org/x/crypto v0.0.0-20180723164146-c126467f60eb
4242
golang.org/x/net v0.0.0-20180724234803-3673e40ba225
4343
golang.org/x/sys v0.0.0-20180724212812-e072cadbbdc8

go.sum

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
github.com/aws/aws-sdk-go v1.14.33 h1:WEZ+Nfjt0Pln1wcQVt3BBQKABcvUxjqNjkwYAp1wnzE=
2-
github.com/aws/aws-sdk-go v1.14.33/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0=
31
github.com/aws/aws-sdk-go v1.15.39 h1:MUxm375zGxxVhgL5NNCIDuwn4SkMQsX8CQWD+zLULcw=
42
github.com/aws/aws-sdk-go v1.15.39/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0=
53
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0=
@@ -8,8 +6,6 @@ github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdn
86
github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
97
github.com/cenkalti/backoff v2.0.0+incompatible h1:5IIPUHhlnUZbcHQsQou5k1Tn58nJkeJL9U+ig5CHJbY=
108
github.com/cenkalti/backoff v2.0.0+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
11-
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
12-
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
139
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
1410
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
1511
github.com/eapache/channels v1.1.0 h1:F1taHcn7/F0i8DYqKXJnyhJcVpp2kgFcNePxXtnyu4k=
@@ -27,8 +23,6 @@ github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekf
2723
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
2824
github.com/golang/groupcache v0.0.0-20180513044358-24b0969c4cb7 h1:u4bArs140e9+AfE52mFHOXVFnOSBJBRlzTHrOPLOIhE=
2925
github.com/golang/groupcache v0.0.0-20180513044358-24b0969c4cb7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
30-
github.com/golang/protobuf v1.1.0 h1:0iH4Ffd/meGoXqF2lSAhZHt8X+cPgkfn/cb6Cce5Vpc=
31-
github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
3226
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
3327
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
3428
github.com/google/btree v0.0.0-20180124185431-e89373fe6b4a h1:ZJu5NB1Bk5ms4vw0Xu4i+jD32SE9jQXyfnOvwhHqlT0=
@@ -49,6 +43,7 @@ github.com/json-iterator/go v0.0.0-20180701071628-ab8a2e0c74be h1:AHimNtVIpiBjPU
4943
github.com/json-iterator/go v0.0.0-20180701071628-ab8a2e0c74be/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
5044
github.com/karlseguin/ccache v2.0.2+incompatible h1:MpSlLlHgG3vPWTAIJsSYlyAQsHwfQ2HzgUlbJFh9Ufk=
5145
github.com/karlseguin/ccache v2.0.2+incompatible/go.mod h1:CM9tNPzT6EdRh14+jiW8mEF9mkNZuuE51qmgGYUB93w=
46+
github.com/karlseguin/expect v1.0.1/go.mod h1:zNBxMY8P21owkeogJELCLeHIt+voOSduHYTFUbwRAV8=
5247
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
5348
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
5449
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
@@ -61,34 +56,22 @@ github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR
6156
github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
6257
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
6358
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
64-
github.com/prometheus/client_golang v0.0.0-20180713201052-bcbbc08eb2dd h1:T6Y9DkTZlfcCB1qlrwQFCiAcLhTjmkjxW8EP3ZhV7Ts=
65-
github.com/prometheus/client_golang v0.0.0-20180713201052-bcbbc08eb2dd/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
66-
github.com/prometheus/client_golang v0.8.0 h1:1921Yw9Gc3iSc4VQh3PIoOqgPCZS7G/4xQNVUp8Mda8=
6759
github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
68-
github.com/prometheus/client_golang v0.9.0-pre1 h1:AWTOhsOI9qxeirTuA0A4By/1Es1+y9EcCGY6bBZ2fhM=
69-
github.com/prometheus/client_golang v0.9.0-pre1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
7060
github.com/prometheus/client_golang v0.9.0-pre1.0.20180919114304-73edb9af667d h1:DYicbQQTRiJXT51TQULZYt3cNfpC+5y0TeG/vqwsGH4=
7161
github.com/prometheus/client_golang v0.9.0-pre1.0.20180919114304-73edb9af667d/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
7262
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 h1:idejC8f05m9MGOsuEi1ATq9shN03HrxNkD/luQvxCv8=
7363
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
74-
github.com/prometheus/common v0.0.0-20180518154759-7600349dcfe1 h1:osmNoEW2SCW3L7EX0km2LYM8HKpNWRiouxjE3XHkyGc=
75-
github.com/prometheus/common v0.0.0-20180518154759-7600349dcfe1/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
7664
github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e h1:n/3MEhJQjQxrOUCzh1Y3Re6aJUUWRp2M9+Oc3eVn/54=
7765
github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
78-
github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273 h1:agujYaXJSxSo18YNX3jzl+4G6Bstwt+kqv47GS12uL0=
79-
github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
8066
github.com/prometheus/procfs v0.0.0-20180920065004-418d78d0b9a7 h1:NgR6WN8nQ4SmFC1sSUHY8SriLuWCZ6cCIQtH4vDZN3c=
8167
github.com/prometheus/procfs v0.0.0-20180920065004-418d78d0b9a7/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
8268
github.com/spf13/pflag v1.0.1 h1:aCvUg6QPl3ibpQUxyLkrEkCHtPqYJL4x9AuhqVqFis4=
8369
github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
8470
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
8571
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
86-
github.com/ticketmaster/aws-sdk-go-cache v0.0.0-20180921202740-1e3c11921d56 h1:6G0xCL3YDKiE5Y6WL/FQHlPTbIib1F/W6wGb95HUUOM=
87-
github.com/ticketmaster/aws-sdk-go-cache v0.0.0-20180921202740-1e3c11921d56/go.mod h1:BxK9RuImIB1miXVNCwzH4K1v1hq48ZyUFrgGGV+rYuk=
88-
github.com/ticketmaster/aws-sdk-go-cache v0.0.0-20180921211908-6cca1e60b3c2 h1:rikJ+c8/TXfPlsbZXu8BAEuFzOBTrbmsrA/MdAMMtrA=
89-
github.com/ticketmaster/aws-sdk-go-cache v0.0.0-20180921211908-6cca1e60b3c2/go.mod h1:6mN3wnKE+Yn0E3aiUE0YTjOd7rfgxfGvZhN1ei8RZh8=
90-
github.com/ticketmaster/aws-sdk-go-cache v0.0.0-20180921213015-16a56fa84aac h1:3JEamh93jxTpTwgjua/oq7DohXE0ZUHttVrAw+gQvxs=
91-
github.com/ticketmaster/aws-sdk-go-cache v0.0.0-20180921213015-16a56fa84aac/go.mod h1:6mN3wnKE+Yn0E3aiUE0YTjOd7rfgxfGvZhN1ei8RZh8=
72+
github.com/ticketmaster/aws-sdk-go-cache v0.0.0-20180926195306-58922816129c h1:3cRzuTKE8C2VkXUQNHOU7FWOOMN1Ddklypzs4ZyQSBw=
73+
github.com/ticketmaster/aws-sdk-go-cache v0.0.0-20180926195306-58922816129c/go.mod h1:H9sbOivuFYIUAS9No3MxP7K6WXz8i8Xg4qRJ/nu3zM4=
74+
github.com/wsxiaoys/terminal v0.0.0-20160513160801-0940f3fc43a0/go.mod h1:IXCdmsXIht47RaVFLEdVnh1t+pgYtTAhQGj73kz+2DM=
9275
golang.org/x/crypto v0.0.0-20180723164146-c126467f60eb h1:Ah9YqXLj6fEgeKqcmBuLCbAsrF3ScD7dJ/bYM0C6tXI=
9376
golang.org/x/crypto v0.0.0-20180723164146-c126467f60eb/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
9477
golang.org/x/net v0.0.0-20180724234803-3673e40ba225 h1:kNX+jCowfMYzvlSvJu5pQWEmyWFrBXJ3PBy10xKMXK8=

internal/aws/albrgt/rgt.go

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package albrgt
22

33
import (
4+
"os"
45
"strings"
56

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

5960
paramSet := []*resourcegroupstaggingapi.GetResourcesInput{
6061
{
62+
ResourcesPerPage: aws.Int64(50),
6163
ResourceTypeFilters: []*string{
6264
aws.String("ec2"),
6365
},
@@ -73,6 +75,7 @@ func (r *RGT) GetClusterResources() (*Resources, error) {
7375
},
7476
},
7577
{
78+
ResourcesPerPage: aws.Int64(50),
7679
ResourceTypeFilters: []*string{
7780
aws.String("ec2"),
7881
},
@@ -88,6 +91,7 @@ func (r *RGT) GetClusterResources() (*Resources, error) {
8891
},
8992
},
9093
{
94+
ResourcesPerPage: aws.Int64(50),
9195
ResourceTypeFilters: []*string{
9296
aws.String("elasticloadbalancing"),
9397
},
@@ -123,25 +127,28 @@ func (r *RGT) GetClusterResources() (*Resources, error) {
123127
}
124128
}
125129

126-
// Legacy deployments may not have the proper tags, and RGT doesn't allow you to use wildcards on names
127-
err := r.GetResourcesPages(&resourcegroupstaggingapi.GetResourcesInput{
128-
ResourceTypeFilters: []*string{
129-
aws.String("elasticloadbalancing"),
130-
},
131-
}, func(page *resourcegroupstaggingapi.GetResourcesOutput, lastPage bool) bool {
132-
for _, rtm := range page.ResourceTagMappingList {
133-
s := strings.Split(*rtm.ResourceARN, ":")
134-
if strings.HasPrefix(s[5], "targetgroup/"+r.clusterName) {
135-
resources.TargetGroups[*rtm.ResourceARN] = rgtTagAsELBV2Tag(rtm.Tags)
136-
}
137-
if strings.HasPrefix(s[5], "loadbalancer/app/"+r.clusterName) {
138-
resources.LoadBalancers[*rtm.ResourceARN] = rgtTagAsELBV2Tag(rtm.Tags)
130+
if os.Getenv("ALB_SUPPORT_LEGACY_DEPLOYMENTS") != "" {
131+
// Legacy deployments may not have the proper tags, and RGT doesn't allow you to use wildcards on names
132+
err := r.GetResourcesPages(&resourcegroupstaggingapi.GetResourcesInput{
133+
ResourcesPerPage: aws.Int64(50),
134+
ResourceTypeFilters: []*string{
135+
aws.String("elasticloadbalancing"),
136+
},
137+
}, func(page *resourcegroupstaggingapi.GetResourcesOutput, lastPage bool) bool {
138+
for _, rtm := range page.ResourceTagMappingList {
139+
s := strings.Split(*rtm.ResourceARN, ":")
140+
if strings.HasPrefix(s[5], "targetgroup/"+r.clusterName) {
141+
resources.TargetGroups[*rtm.ResourceARN] = rgtTagAsELBV2Tag(rtm.Tags)
142+
}
143+
if strings.HasPrefix(s[5], "loadbalancer/app/"+r.clusterName) {
144+
resources.LoadBalancers[*rtm.ResourceARN] = rgtTagAsELBV2Tag(rtm.Tags)
145+
}
139146
}
147+
return true
148+
})
149+
if err != nil {
150+
return nil, err
140151
}
141-
return true
142-
})
143-
if err != nil {
144-
return nil, err
145152
}
146153

147154
return resources, nil

internal/aws/albsession/session.go

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,21 @@
11
package albsession
22

33
import (
4-
"context"
54
"fmt"
65
"time"
76

87
"github.com/aws/aws-sdk-go/aws"
98
"github.com/aws/aws-sdk-go/aws/request"
109
"github.com/aws/aws-sdk-go/aws/session"
10+
"github.com/aws/aws-sdk-go/service/ec2"
11+
"github.com/aws/aws-sdk-go/service/resourcegroupstaggingapi"
1112
"github.com/golang/glog"
1213
"github.com/kubernetes-sigs/aws-alb-ingress-controller/internal/ingress/metric"
1314
"github.com/kubernetes-sigs/aws-alb-ingress-controller/pkg/util/log"
1415
"github.com/prometheus/client_golang/prometheus"
1516
"github.com/ticketmaster/aws-sdk-go-cache/cache"
1617
)
1718

18-
type timingContextKeyType int
19-
20-
var timingContextKey = new(timingContextKeyType)
21-
2219
// NewSession returns an AWS session based off of the provided AWS config
2320
func NewSession(awsconfig *aws.Config, AWSDebug bool, mc metric.Collector, cc *cache.Config) *session.Session {
2421
session, err := session.NewSession(awsconfig)
@@ -28,13 +25,10 @@ func NewSession(awsconfig *aws.Config, AWSDebug bool, mc metric.Collector, cc *c
2825
return nil
2926
}
3027

31-
session.Handlers.Validate.PushFront(func(r *request.Request) {
32-
r.HTTPRequest = r.HTTPRequest.WithContext(context.WithValue(r.HTTPRequest.Context(), timingContextKey, time.Now()))
33-
})
34-
3528
// Adds caching to session
3629
cache.AddCaching(session, cc)
37-
cc.SetCacheTTL("tagging", "GetResources", time.Hour)
30+
cc.SetCacheTTL(resourcegroupstaggingapi.ServiceName, "GetResources", time.Hour)
31+
cc.SetCacheTTL(ec2.ServiceName, "DescribeInstanceStatus", time.Minute)
3832

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

5044
session.Handlers.Complete.PushFront(func(r *request.Request) {
51-
ctx := r.HTTPRequest.Context()
52-
if !cache.IsCacheHit(ctx) {
53-
startTime := ctx.Value(timingContextKey)
54-
if startTime != nil {
55-
mc.ObserveAPIRequest(
56-
prometheus.Labels{"service": r.ClientInfo.ServiceName, "operation": r.Operation.Name},
57-
startTime.(time.Time))
58-
}
59-
}
60-
6145
if r.Error != nil {
6246
mc.IncAPIErrorCount(prometheus.Labels{"service": r.ClientInfo.ServiceName, "operation": r.Operation.Name})
6347
if AWSDebug {
6448
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))
6549
}
50+
} else {
51+
if AWSDebug {
52+
glog.InfoDepth(4, fmt.Sprintf("Response: %s/%s, Body: %s", r.ClientInfo.ServiceName, r.Operation.Name, log.Prettify(r.Data)))
53+
}
6654
}
6755
})
6856
return session

internal/ingress/metric/collectors/aws.go

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,16 @@ limitations under the License.
1717
package collectors
1818

1919
import (
20-
"time"
21-
2220
"github.com/prometheus/client_golang/prometheus"
2321
)
2422

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

29-
awsAPIRequest *prometheus.CounterVec
30-
awsAPIRequestLatency *prometheus.HistogramVec
31-
awsAPIError *prometheus.CounterVec
32-
awsAPIRetry *prometheus.CounterVec
27+
awsAPIRequest *prometheus.CounterVec
28+
awsAPIError *prometheus.CounterVec
29+
awsAPIRetry *prometheus.CounterVec
3330
}
3431

3532
// NewAWSAPIController creates a new prometheus collector for the
@@ -44,17 +41,6 @@ func NewAWSAPIController() *AWSAPIController {
4441
},
4542
[]string{"service", "operation"},
4643
),
47-
awsAPIRequestLatency: prometheus.NewHistogramVec(prometheus.HistogramOpts{
48-
Namespace: PrometheusNamespace,
49-
Name: "aws_api_requests_latency_seconds",
50-
Help: `Total latency distributions of requests made to the AWS API (in seconds)`,
51-
52-
// lowest bucket start of upper bound 0.0001 sec (0.1 ms) with factor 2
53-
// highest bucket start of 0.0001 sec * 2^17 == 13.1072 sec
54-
Buckets: prometheus.ExponentialBuckets(0.0001, 2, 18),
55-
},
56-
[]string{"service", "operation"},
57-
),
5844
awsAPIError: prometheus.NewCounterVec(
5945
prometheus.CounterOpts{
6046
Namespace: PrometheusNamespace,
@@ -79,11 +65,6 @@ func (a *AWSAPIController) IncAPIRequestCount(l prometheus.Labels) {
7965
a.awsAPIRequest.With(l).Inc()
8066
}
8167

82-
// ObserveAPIRequest tracks request latency
83-
func (a *AWSAPIController) ObserveAPIRequest(l prometheus.Labels, start time.Time) {
84-
a.awsAPIRequestLatency.With(l).Observe(time.Since(start).Seconds())
85-
}
86-
8768
// IncAPIErrorCount increment the reconcile counter
8869
func (a *AWSAPIController) IncAPIErrorCount(l prometheus.Labels) {
8970
a.awsAPIError.With(l).Inc()
@@ -97,15 +78,13 @@ func (a *AWSAPIController) IncAPIRetryCount(l prometheus.Labels) {
9778
// Describe implements prometheus.Collector
9879
func (a AWSAPIController) Describe(ch chan<- *prometheus.Desc) {
9980
a.awsAPIRequest.Describe(ch)
100-
a.awsAPIRequestLatency.Describe(ch)
10181
a.awsAPIError.Describe(ch)
10282
a.awsAPIRetry.Describe(ch)
10383
}
10484

10585
// Collect implements the prometheus.Collector interface.
10686
func (a AWSAPIController) Collect(ch chan<- prometheus.Metric) {
10787
a.awsAPIRequest.Collect(ch)
108-
a.awsAPIRequestLatency.Collect(ch)
10988
a.awsAPIError.Collect(ch)
11089
a.awsAPIRetry.Collect(ch)
11190
}

internal/ingress/metric/dummy.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ limitations under the License.
1717
package metric
1818

1919
import (
20-
"time"
21-
2220
"github.com/prometheus/client_golang/prometheus"
2321
)
2422

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

40-
// ObserveAPIRequest ...
41-
func (dc DummyCollector) ObserveAPIRequest(prometheus.Labels, time.Time) {}
42-
4338
// IncAPIErrorCount ...
4439
func (dc DummyCollector) IncAPIErrorCount(prometheus.Labels) {}
4540

internal/ingress/metric/main.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ limitations under the License.
1717
package metric
1818

1919
import (
20-
"time"
21-
2220
"github.com/prometheus/client_golang/prometheus"
2321

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

3432
IncAPIRequestCount(prometheus.Labels)
35-
ObserveAPIRequest(prometheus.Labels, time.Time)
3633
IncAPIErrorCount(prometheus.Labels)
3734
IncAPIRetryCount(prometheus.Labels)
3835

@@ -77,10 +74,6 @@ func (c *collector) IncAPIRequestCount(l prometheus.Labels) {
7774
c.awsAPIController.IncAPIRequestCount(l)
7875
}
7976

80-
func (c *collector) ObserveAPIRequest(l prometheus.Labels, start time.Time) {
81-
c.awsAPIController.ObserveAPIRequest(l, start)
82-
}
83-
8477
func (c *collector) IncAPIErrorCount(l prometheus.Labels) {
8578
c.awsAPIController.IncAPIErrorCount(l)
8679
}

0 commit comments

Comments
 (0)