-
Notifications
You must be signed in to change notification settings - Fork 21
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 podresourcesstore in awscontainerinsightreceiver #167
Add podresourcesstore in awscontainerinsightreceiver #167
Conversation
receiver/awscontainerinsightreceiver/internal/stores/kubeletutil/podresourcesclient.go
Outdated
Show resolved
Hide resolved
receiver/awscontainerinsightreceiver/internal/stores/kubeletutil/podresourcesclient.go
Outdated
Show resolved
Hide resolved
receiver/awscontainerinsightreceiver/internal/stores/kubeletutil/podresourcesclient.go
Outdated
Show resolved
Hide resolved
receiver/awscontainerinsightreceiver/internal/stores/podresourcesstore.go
Outdated
Show resolved
Hide resolved
receiver/awscontainerinsightreceiver/internal/stores/podresourcesstore.go
Outdated
Show resolved
Hide resolved
|
||
for _, deviceID := range device.GetDeviceIds() { | ||
resourceInfo := ResourceInfo{ | ||
resourceName: device.GetResourceName(), |
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.
We might want to pass in a set of device resource names that we are interested in, so that we don't waste space storing all devices.
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.
would it make sense to have a add_resource_name method which adds that to a set which we can then use for lookup and populate the map in the next run?
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.
Yes I like that.
receiver/awscontainerinsightreceiver/internal/stores/podresourcesstore.go
Show resolved
Hide resolved
receiver/awscontainerinsightreceiver/internal/stores/podresourcesstore_test.go
Outdated
Show resolved
Hide resolved
receiver/awscontainerinsightreceiver/internal/stores/podresourcesstore_test.go
Outdated
Show resolved
Hide resolved
…er edge cases in unit tests
receiver/awscontainerinsightreceiver/internal/stores/podresourcesstore.go
Outdated
Show resolved
Hide resolved
receiver/awscontainerinsightreceiver/internal/stores/podresourcesstore.go
Outdated
Show resolved
Hide resolved
resourceName: device.GetResourceName(), | ||
deviceID: deviceID, | ||
} | ||
_, found := p.resourceNameSet[resourceInfo.resourceName] |
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.
Another optimization - we don't even need to do the scrape at all if resourceNameSet
is empty.
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.
nice catch, updated the PR
if err != nil { | ||
return | ||
} |
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.
Is this just to avoid the compiler giving you a warning about ignoring the 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.
yup
Please update the target branch to |
a4af460
into
amazon-contributing:main
Pod correlation library amazon-contributing#167
…containerinsightreceiver (amazon-contributing#167)
Description:
Testing:
Tested the api in a test cluster with a custom script:
also tested on a the test cluster and printed the map, some of the entries in the map: