-
Notifications
You must be signed in to change notification settings - Fork 207
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
Add Status Code Metrics for API Calls in the Agent #1442
Conversation
reload_interval: 0s | ||
server_name_override: "" | ||
write_buffer_size: 524288 | ||
awscloudwatch: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The indentation is because of our default indentation which was altered previously and this is correcting it. You can ignore the whitespace
@@ -280,14 +281,12 @@ func (t *Tagger) ebsVolumesRetrieved() bool { | |||
|
|||
// Start acts as input validation and serves the purpose of updating ec2 tags and ebs volumes if necessary. | |||
// It will be called when OTel is enabling each processor | |||
func (t *Tagger) Start(ctx context.Context, _ component.Host) error { | |||
func (t *Tagger) Start(ctx context.Context, host component.Host) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adding host so we can grab the handler and attach them to the client.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this PR being merged in CodeHandler branch and not main ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have 2 questions:
- Have you tested this on EKS
- Have you ran go race test on this
translator/translate/otel/processor/ec2taggerprocessor/translator.go
Outdated
Show resolved
Hide resolved
translator/translate/otel/processor/resourcedetection/translator.go
Outdated
Show resolved
Hide resolved
5bdc971
to
23c2761
Compare
f1cebbb
to
e37caa9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing looks good
Description
Issue Overview
The agent currently lacks visibility into the status codes returned by its API calls, making it challenging to monitor API interactions and debug issues effectively.
Summary of Changes
This PR introduces functionality to collect and report status code metrics for the agent’s API clients, enhancing monitoring capabilities. The metrics cover the following APIs:
PutRetentionPolicy
DescribeInstances
DescribeTags
DescribeVolumes
DescribeContainerInstances
DescribeServices
DescribeTaskDefinition
ListServices
ListTasks
DescribeTasks
CreateLogGroup
CreateLogStream
Implementation Details
Handler Integration
awsmiddleware
component ID. The appropriate status code handler is attached to each client to enable metric collection.Metric Creation
CloudwatchStatsHandler
.CloudwatchStatsHandler
processes the JSON and creates status code metric, enabling enhanced visibility.Example Outputs
Example JSON Payload
Below is a sample JSON structure that categorizes status codes for various API calls:
Example Visualization
The screenshot below demonstrates the captured status codes in the monitoring interface:
Testing Details
Configuration Used
The agent was configured with the following
agent.json
file to validate metrics collection: (Also this is removed not but added some api calls so we can make sure we can get metrics for all the calls).Tests Performed
Tested on EKS by changing agent contrib to this branch.
Ex: replace github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor => github.com/amazon-contributing/opentelemetry-collector-contrib/processor/resourcedetectionprocessor v0.0.0-20241212025412-4bd7a1e9deed
### RequirementsBefore committing, complete the following:
make fmt
andmake fmt-sh
.make lint
.License
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution under the terms of your choice.