Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(hnsstats): improve error handling and logging for VFP port counte…
…rs (#1002) # Description This pull request includes several improvements and error handling enhancements in the `hnsstats` package for Windows. The changes focus on better error reporting and wrapping errors with more context. ### Error Handling Improvements: * [`pkg/plugin/windows/hnsstats/hnsstats_windows.go`](diffhunk://#diff-f7aff15850299a4daebae31d62fbc55c0085872c1e216801367d51d73d8909aaL127-R131): Added a check to ensure `portguid` is not empty and logs an error if it is not found. * [`pkg/plugin/windows/hnsstats/hnsstats_windows.go`](diffhunk://#diff-f7aff15850299a4daebae31d62fbc55c0085872c1e216801367d51d73d8909aaL138-R142): Enhanced the error log message to include `portguid` when unable to find VFP port counters. ### Dependency and Error Wrapping: * [`pkg/plugin/windows/hnsstats/vfp_counters_windows.go`](diffhunk://#diff-ee7db77fb3268bc4192a25ed95de63cfc3be24044a55e739dc59b7e6d63e8095R10-R11): Imported the `github.com/pkg/errors` package for better error wrapping. * [`pkg/plugin/windows/hnsstats/vfp_counters_windows.go`](diffhunk://#diff-ee7db77fb3268bc4192a25ed95de63cfc3be24044a55e739dc59b7e6d63e8095L154-R163): Wrapped errors with additional context when running `vfpctrl` commands. ## Checklist - [X] I have read the [contributing documentation](https://retina.sh/docs/contributing). - [X] I signed and signed-off the commits (`git commit -S -s ...`). See [this documentation](https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification) on signing commits. - [X] I have correctly attributed the author(s) of the code. - [X] I have tested the changes locally. - [X] I have followed the project's style guidelines. - [X] I have updated the documentation, if necessary. - [X] I have added tests, if applicable. --- Please refer to the [CONTRIBUTING.md](../CONTRIBUTING.md) file for more information on how to contribute to this project.
- Loading branch information