aws / aws-application-networking-k8s

A Kubernetes controller for Amazon VPC Lattice
https://www.gateway-api-controller.eks.aws.dev/
Apache License 2.0
164 stars 49 forks source link

Adding more Metrics #628

Closed liwenwu-amazon closed 5 months ago

liwenwu-amazon commented 5 months ago

What type of PR is this?

feature

Which issue does this PR fix:

601

What does this PR do / Why do we need it: It provides metrics on all lattice API calls, return code and error msgs.

curl -s localhost:8080/metrics | grep aws_api_requests_total
# HELP aws_api_requests_total Total number of HTTP requests that the SDK made
# TYPE aws_api_requests_total counter
aws_api_requests_total{error_code="",operation="CreateListener",service="VPC Lattice",status_code="201"} 1
aws_api_requests_total{error_code="",operation="CreateRule",service="VPC Lattice",status_code="201"} 1
aws_api_requests_total{error_code="",operation="CreateService",service="VPC Lattice",status_code="201"} 1
aws_api_requests_total{error_code="",operation="CreateServiceNetworkServiceAssociation",service="VPC Lattice",status_code="200"} 1
aws_api_requests_total{error_code="",operation="CreateTargetGroup",service="VPC Lattice",status_code="201"} 1
aws_api_requests_total{error_code="",operation="GetResources",service="Resource Groups Tagging API",status_code="200"} 24
aws_api_requests_total{error_code="",operation="GetRule",service="VPC Lattice",status_code="200"} 5
aws_api_requests_total{error_code="",operation="GetTargetGroup",service="VPC Lattice",status_code="200"} 5
aws_api_requests_total{error_code="",operation="ListListeners",service="VPC Lattice",status_code="200"} 6
aws_api_requests_total{error_code="",operation="ListRules",service="VPC Lattice",status_code="200"} 6
aws_api_requests_total{error_code="",operation="ListServiceNetworkServiceAssociations",service="VPC Lattice",status_code="200"} 4
aws_api_requests_total{error_code="",operation="ListServiceNetworkVpcAssociations",service="VPC Lattice",status_code="200"} 1
aws_api_requests_total{error_code="",operation="ListServiceNetworks",service="VPC Lattice",status_code="200"} 4
aws_api_requests_total{error_code="",operation="ListServices",service="VPC Lattice",status_code="200"} 8
aws_api_requests_total{error_code="",operation="ListTagsForResource",service="VPC Lattice",status_code="200"} 4
aws_api_requests_total{error_code="",operation="ListTargetGroups",service="VPC Lattice",status_code="200"} 18
aws_api_requests_total{error_code="",operation="ListTargets",service="VPC Lattice",status_code="200"} 9
aws_api_requests_total{error_code="",operation="RegisterTargets",service="VPC Lattice",status_code="200"} 5
aws_api_requests_total{error_code="ConflictException",operation="CreateServiceNetworkServiceAssociation",service="VPC Lattice",status_code="409"} 1
aws_api_requests_total{error_code="ConflictException",operation="RegisterTargets",service="VPC Lattice",status_code="409"} 1

If an issue # is not available please add repro steps and logs from aws-gateway-controller showing the issue:

Testing done on this change:

Automation added to e2e:

Will this PR introduce any new dependencies?:

no Will this break upgrades or downgrades. Has updating a running cluster been tested?: no Does this PR introduce any user-facing change?:

no

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.