Skip to content
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

feat: Expose firecracker metrics #357

Merged
merged 3 commits into from
Feb 1, 2022

Conversation

yitsushi
Copy link
Contributor

@yitsushi yitsushi commented Jan 18, 2022

What this PR does / why we need it:

  • Basic logic for the metrics exporter.
  • Basic docker compose file to start a prometheus and grafana instance
    for testing.
  • Metrics collection under provider.
  • Documentation

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #210

Special notes for your reviewer:

Checklist:

  • squashed commits into logical changes
  • includes documentation
  • adds unit tests
  • adds or updates e2e tests

@yitsushi yitsushi added the kind/feature New feature or request label Jan 18, 2022
@@ -26,8 +26,6 @@ linters-settings:
local-prefixes: github.com/weaveworks/flintlock
govet:
check-shadowing: true
misspell:
locale: GB
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Duplicated entry, removed one of them.


type WithFlagsFunc func() []cli.Flag

func CLIFlags(options ...WithFlagsFunc) []cli.Flag {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like this component builder pattern here because that way when/if we add more binaries (now exporter, maybe a helper to hide a lot of "setup" steps into a single binary to deploy, an agent that can sit in the microvm, or basically anything) we can reused the same flags. Maybe it will not work long term, but now it has a nice structure.

Copy link
Member

Choose a reason for hiding this comment

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

i like everything going on in this file ✨

}
}

func ParseFlags(cfg *config.Config) cli.BeforeFunc {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It will parse everything we know, and if not defined it will be empty or default value.

@codecov-commenter
Copy link

codecov-commenter commented Jan 25, 2022

Codecov Report

Merging #357 (f7cbd61) into main (dd27bc6) will decrease coverage by 0.70%.
The diff coverage is 0.00%.

❗ Current head f7cbd61 differs from pull request most recent head ea1014c. Consider uploading reports for the commit ea1014c to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##             main     #357      +/-   ##
==========================================
- Coverage   57.34%   56.63%   -0.71%     
==========================================
  Files          51       52       +1     
  Lines        2567     2599      +32     
==========================================
  Hits         1472     1472              
- Misses        970     1003      +33     
+ Partials      125      124       -1     
Impacted Files Coverage Δ
infrastructure/firecracker/metrics.go 0.00% <0.00%> (ø)
infrastructure/firecracker/provider.go 0.00% <0.00%> (ø)
infrastructure/containerd/event_service.go 56.14% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dd27bc6...ea1014c. Read the comment docs.

@yitsushi yitsushi marked this pull request as ready for review January 25, 2022 10:24
@yitsushi yitsushi marked this pull request as draft January 26, 2022 10:29
@yitsushi yitsushi marked this pull request as ready for review January 27, 2022 09:59
@yitsushi
Copy link
Contributor Author

Example metrics output:

❯ curl -s http://localhost:8000/machine | grep vcpu_failures
vcpu_failures{namespace="ns1",name="mvm1",uid="01FTBC51BK5V82XEDBASXAF61Z"} 0
vcpu_failures{namespace="ns1",name="mvm2",uid="01FTBC5ZEKE79FGYNRHPC8MME5"} 0
vcpu_failures{namespace="ns1",name="mvm2",uid="01FTBFG9KAC46TVDYGH1JMH665"} 0
vcpu_failures{namespace="ns2",name="mvm5",uid="01FTDFSRDFKMBR5GVT6J8F6K2E"} 0

❯ curl -s http://localhost:8000/machine/ns1 | grep vcpu_failures
vcpu_failures{namespace="ns1",name="mvm2",uid="01FTBC5ZEKE79FGYNRHPC8MME5"} 0
vcpu_failures{namespace="ns1",name="mvm2",uid="01FTBFG9KAC46TVDYGH1JMH665"} 0
vcpu_failures{namespace="ns1",name="mvm1",uid="01FTBC51BK5V82XEDBASXAF61Z"} 0

❯ curl -s http://localhost:8000/machine/ns1/mvm2 | grep vcpu_failures
vcpu_failures{namespace="ns1",name="mvm2",uid="01FTBC5ZEKE79FGYNRHPC8MME5"} 0
vcpu_failures{namespace="ns1",name="mvm2",uid="01FTBFG9KAC46TVDYGH1JMH665"} 0

❯ curl -s http://localhost:8000/machine/uid/01FTDFSRDFKMBR5GVT6J8F6K2E | grep vcpu_failures
vcpu_failures{namespace="ns2",name="mvm5",uid="01FTDFSRDFKMBR5GVT6J8F6K2E"} 0

@yitsushi
Copy link
Contributor Author

yitsushi commented Jan 27, 2022

Hmm actually it's not #209 but #210.

@richardcase : is there anything in your mind what can we expose from flintlock right other than firecracker metrics? Or this PR can close both of them now and when we have something to expose we file a new ticket?

Update: #209 is not just exposing but implementing stuff to expose.

@yitsushi yitsushi changed the title feat: Expose flintlock metrics feat: Expose firecracker metrics Jan 27, 2022
* Basic logic for the metrics exporter.
* Basic docker compose file to start a prometheus and grafana instance
  for testing.
* Metrics collection under provider.
* Documentation

Fixes liquidmetal-dev#210
Copy link
Member

@Callisto13 Callisto13 left a comment

Choose a reason for hiding this comment

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

can you add a bit in the Makefile under build for this?

are we having tests?


type WithFlagsFunc func() []cli.Flag

func CLIFlags(options ...WithFlagsFunc) []cli.Flag {
Copy link
Member

Choose a reason for hiding this comment

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

i like everything going on in this file ✨

@Callisto13
Copy link
Member

i am trying really hard to run this thing but containerd is not behaving today so i can't even create anything 😫

Callisto13
Callisto13 previously approved these changes Jan 31, 2022
Copy link
Member

@Callisto13 Callisto13 left a comment

Choose a reason for hiding this comment

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

LGTM, the only thing i would love is to refactor all the handlefuncs into their own little things for tidiness

oh and a build bit in Makefile

@yitsushi
Copy link
Contributor Author

yitsushi commented Feb 1, 2022

@Callisto13 : Can I get a new review? Changes:

  • Separate function for different serve endpoints.
  • Make with build and build-release for metric
  • Updated release workflow to include the new binaries.

Copy link
Member

@Callisto13 Callisto13 left a comment

Choose a reason for hiding this comment

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

🚀

@yitsushi yitsushi merged commit a5f4023 into liquidmetal-dev:main Feb 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose Firecracker metrics
3 participants