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: add json reporter #68

Merged
merged 7 commits into from
Feb 9, 2021
Merged

Conversation

wallet77
Copy link
Contributor

@wallet77 wallet77 commented Feb 3, 2021

Add JSON reporter.

You can use the following options:

  • -t to customize the timeout
  • -s to customize the interval
  • -f to change the destination file where to write the report

If no file is provided, then the JSON is displayed in the console.
If the directory where to create the file does not exist it will fail.

TODO:

  • interval should be in milliseconds or should at least allows sending float number.
  • documentation

@bpetit
Copy link
Contributor

bpetit commented Feb 3, 2021

Thanks a lot ! I'll have a look at why the build and test job failed. I think its because of my recent changes.

In the mean time, you can easily fix the two other tests by running cargo clippy and cargo fmt on your laptop :)

@bpetit
Copy link
Contributor

bpetit commented Feb 3, 2021

I tried a change in another PR that seems to fix the build_and_test job. Could you try that change ?

https://github.com/hubblo-org/scaphandre/pull/64/files#diff-bc668a2c9f2299cef15b222055b4b4d5311646caec2e7610e540cee18ae9b948

I'm looking at your PR in the mean time and I'll jump back in the discussion.

@wallet77
Copy link
Contributor Author

wallet77 commented Feb 3, 2021

I tried a change in another PR that seems to fix the build_and_test job. Could you try that change ?

https://github.com/hubblo-org/scaphandre/pull/64/files#diff-bc668a2c9f2299cef15b222055b4b4d5311646caec2e7610e540cee18ae9b948

What changes should I apply?
All of them? Because there are multiple files in the PR.

@bpetit
Copy link
Contributor

bpetit commented Feb 3, 2021

I tried a change in another PR that seems to fix the build_and_test job. Could you try that change ?
https://github.com/hubblo-org/scaphandre/pull/64/files#diff-bc668a2c9f2299cef15b222055b4b4d5311646caec2e7610e540cee18ae9b948

What changes should I apply?
All of them? Because there are multiple files in the PR.

No only the .gthub/workflow/build_and_test file,

This is just about fixing the CI job. Sorry that wasn't clear in my first message :)

@wallet77
Copy link
Contributor Author

wallet77 commented Feb 3, 2021

@bpetit still have some issue with build_test stage.
I will work on the improvements in the meantime.

@bpetit
Copy link
Contributor

bpetit commented Feb 3, 2021

Saw it. I think it's about secrets needed for the job. I'll let you know when I figure that out.

@wallet77
Copy link
Contributor Author

wallet77 commented Feb 3, 2021

@bpetit I'm wondering if it's better to write in the file (or display in stdout) at every step.
In this case, even if you kill the process (or if it crashes) you can still have the report.

---- a few moments later ----

@bpetit I commit some changes to gradually write into the file. So even if you kill the program before the timeout you should have a part of the report.

@bpetit
Copy link
Contributor

bpetit commented Feb 8, 2021

I'm currently reviewing it and it's great so far ! Thanks !
I have a few suggestions though:

  • maybe we could add the unit of the measurements unit somewhere in the JSON schema ?
  • I'm wondering if returning watts directly is prone to fit most usecases. In the prometheus exporter for example we return microwatts directly and let the user cast it in watts thanks to his TSDB.
  • do you have time to add a documentation reference page for the new exporter in docs_src ? Otherwise I'll do it before merging.
  • don't worry about the CI tests, I tested it manually and it's ok. I'll merge the fix for the CI with your PR

@wallet77
Copy link
Contributor Author

wallet77 commented Feb 9, 2021

  • maybe we could add the unit of the measurements unit somewhere in the JSON schema ?

If we keep microwatts and if we add a good doc, is it still relevant to add the unit in the JSON?

  • I'm wondering if returning watts directly is prone to fit most usecases. In the prometheus exporter for example we return microwatts directly and let the user cast it in watts thanks to his TSDB.

That was my idea too. I think it's better to keep raw data.

  • do you have time to add a documentation reference page for the new exporter in docs_src ? Otherwise I'll do it before merging.

Yes, I was waiting for your go, so I will add some explanations.

@bpetit
Copy link
Contributor

bpetit commented Feb 9, 2021

I think you are right and microwatts would fit more use cases.

About the unit, in this form it would not be required. But if we add different data in the json (which may happen as we will surely use it for debugging purposes) it will become important. So we could either add it now, or leave it as it is and just add it when different sort of data are included in the result, to be able to see the difference.

Great for the documentation. I think we are synchronized on the "raw data" topic, so give it a shot if you like :)

@wallet77
Copy link
Contributor Author

wallet77 commented Feb 9, 2021

@bpetit doc + microwatts pushed
For the unit, I think we can add it later if you are ok with that.

bpetit added a commit that referenced this pull request Feb 9, 2021
@bpetit bpetit merged commit 9503828 into hubblo-org:main Feb 9, 2021
@bpetit
Copy link
Contributor

bpetit commented Feb 9, 2021

This is great ! Thanks :)

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.

2 participants