Skip to content

Conversation

@ishleenk17
Copy link
Member

Add filesystem scraper parsing to opentelemetry-lib

Relates: https://github.com/elastic/opentelemetry-dev/issues/191

@ishleenk17 ishleenk17 marked this pull request as ready for review June 18, 2024 12:36
@ishleenk17 ishleenk17 requested a review from a team as a code owner June 18, 2024 12:36
}

for deviceKey, totalfsusage := range totalUsagePerDevice {
device, mpoint, fstype = parseDeviceKey(deviceKey)
Copy link

@devamanv devamanv Jun 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am wondering what happens if deviceKey isn't a valid one? The parseDeviceKey function should return an error to handle it, and propagate it to the caller, which should then return it to its caller as an error. The remapFilesystemMetrics returns an error, but in this it may fail silently.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whole logic of using the device key and then parsing looks like introduced complexity from us. We are first creating the device key by doing a sum and then parsing it(?) I am quite sure we should be able to merge this for loop in the first one but even if we are not we should be able to avoid the re-parsing of the key.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me try to simplify the logic

@kruskall kruskall dismissed their stale review June 20, 2024 11:17

the cake is a lie

@ishleenk17
Copy link
Member Author

@lahsivjar : Refactored the code with below changes mainly:
Usage of a single map
Removal of the parsekeylogic

Copy link
Contributor

@lahsivjar lahsivjar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some slight modifications to simplify the device key creation logic a bit. Rest LGTM!

Copy link
Contributor

@lahsivjar lahsivjar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving it now in case this is time sensitive and needs to be merged quickly. If not then would get great to get the above refactor done otherwise okay to do it in a followup PR to, I will leave it up to you.

Copy link
Contributor

@lahsivjar lahsivjar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making all the changes, LGTM!

@ishleenk17 ishleenk17 merged commit 030b953 into elastic:main Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants