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/riemann exporter #58

Merged
merged 18 commits into from
Jan 29, 2021
Merged

Feat/riemann exporter #58

merged 18 commits into from
Jan 29, 2021

Conversation

uggla
Copy link
Collaborator

@uggla uggla commented Jan 17, 2021

First "version" of Riemann exporter.

The implementation was done as a proof of concept. So I tried to do it minimizing the modifications to the existing files.
This is inspired and not so far from the Prometheus one.
As a result it works fine, but there are a lot of duplications in the code currently.

Future improvements could be to:

  • Split the run method which is as long as hell.
  • Factorize code which is pretty similar in Prometheus and Riemann (mostly run method) in the Exporter trait and just change the way metrics are exposed or sent.

Sorry this PR is a bit large, but it mostly introduced new files, so it can probably be merged without being too worried about it.
Note, I have also fixed a couple of typos in Prometheus exporter.

Put in place Riemann exporter skeleton.
- Fix typo.
- Fix construction.
Refactor run function to avoid nested code.
Event is sent to Riemann.
It needs to be refactored because it is really raw.
However it is working.
Add hostname crate to get system hostname.
Simplify usage of send_metric function.
- Allow &str and String type as Metric
- Allow to pass ttl, tag, description
- Refactor to add some functions
- Rename add_metric to set_metric
Add dependencies to protobuf to insert tags.
Add mem and cpu metrics.
Fix a small typo in prometheus exporter.
Add new measures.
Only processes are missing.
Refactoring needed.
Refactor host and socket part.
Avoid to set a default version.
Update code due to rebase on upstream.
Add option --qemu introduce by latest rebase.
Add power consumption on processes.
- Add vmname is -q or --qemu option is passed.
- Factorize common code into utils.rs.
Add Riemann exporter documentation.
@uggla uggla mentioned this pull request Jan 17, 2021
@bpetit
Copy link
Contributor

bpetit commented Jan 18, 2021

This is awesome, thanks a lot !
I'll have a look in the following days.

@bpetit
Copy link
Contributor

bpetit commented Jan 27, 2021

I'm trying the PR and this is great so far ! Thanks !
What do you think about prefixing the services/metrics with scaph_ ?
If I query all the metrics at once it's pretty hard to differentiate the metrics from riemann-health and those from scaphandre, for example.
Don't worry about the conflicts, I fixed it locally. Feel free to push new commits if you want to change something and I'll manage the merge.

@@ -18,6 +18,9 @@ clap = "2.33.3"
regex = "1"
procfs = "0.8.1"
actix-web = "3"
riemann_client = "0.7.0"
Copy link

Choose a reason for hiding this comment

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

I never tried it but you also have https://github.com/sunng87/rustmann which supports stuff like mTLS.

Copy link
Contributor

Choose a reason for hiding this comment

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

In your experience is this a must have or a nice to have for a riemann client ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Interesting because based on tokio as well, but maybe a bit early to use this client. As stated in the presentation.

A riemann client using tokio. This project is still in its early stage and API changes aggressively.

So we may run to adapt the code to the api changes. I think we can keep an eye on it and move as soon as the api is more stable and if it makes sens.

Copy link

Choose a reason for hiding this comment

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

In your experience is this a must have or a nice to have for a riemann client ?

it's not mandatory but I usually run all of my services using mTLS if I can.
But as @uggla said, the current lib may be enough for now.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks a lot for your feedbacks. Let's keep this one for now and keep an eye on rustmann :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Another option could be to add mTLS to the current riemann client using rustls. Seems not "too hard" although with security it is never as easy as it looks...

@uggla
Copy link
Collaborator Author

uggla commented Jan 29, 2021

Don't worry about the conflicts, I fixed it locally. Feel free to push new commits if you want to change something and I'll manage the merge.

@bpetit, if it is ok for you, as soon as this PR will be merged, I will open a new one to do the proposed changes to reduce duplication.
This may also simplify implementations of new exporters.
How do you want to proceed, would you like to discuss the idea upfront or would you like me to propose an example MR first.

@bpetit
Copy link
Contributor

bpetit commented Jan 29, 2021

I've added prefixes to the PR as I solved the docs conflicts. I'd like to know if you find it relevant or not before I push.
I know that having specific prefixes is a good practice for prometheus exporters. Is this the same for riemann clients ?

@bpetit bpetit merged commit 24d1727 into hubblo-org:main Jan 29, 2021
@bpetit
Copy link
Contributor

bpetit commented Jan 29, 2021

I pushed as I preferred to integrate that PR before others. We can open another PR as you suggested to change some details if needed.

@uggla
Copy link
Collaborator Author

uggla commented Jan 29, 2021

I've added prefixes to the PR as I solved the docs conflicts. I'd like to know if you find it relevant or not before I push.
I know that having specific prefixes is a good practice for prometheus exporters. Is this the same for riemann clients ?
Can you give an exemple ? I'm not sure I catch it ?

@bpetit
Copy link
Contributor

bpetit commented Jan 29, 2021

I've added scaph_ prefix in the name of each metric:

2021-01-29_19-00

So they have the same name as the ones in the prometheus exporter (except for the one you mentionned in the docs).

What do you think ?

@uggla
Copy link
Collaborator Author

uggla commented Jan 29, 2021

I pushed as I preferred to integrate that PR before others. We can open another PR as you suggested to change some details if needed.

Yes of course. We have a base now and it's better to iterate and improve it.

What do you think ?

I got it now. Yes sounds good.
Fyi, I have also attached tags and attributes to the metrics as well. It can be seen clicking on a metric at the bottom of the screen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Previous releases
Development

Successfully merging this pull request may close these issues.

3 participants