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

Enhance NodeExporterPath JSON option to pass additional node_exporter arguments #30

Merged
merged 6 commits into from
Jun 18, 2019
Merged

Conversation

jecassis
Copy link
Contributor

Example from config.json:
"NodeExporterPath": "./node_exporter --collector.systemd"

This should result in the following process being launched when metrics are enabled:
./node_exporter --collector.systemd --web.listen-address=:9100 --web.telemetry-path=/metrics

As of now the changing the NodeExporterPath as above causes StartProcess to error and does not launch node_exporter.

@CLAassistant
Copy link

CLAassistant commented Jun 14, 2019

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@tsachiherman tsachiherman left a comment

Choose a reason for hiding this comment

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

The reasoning here seems valid, however, I would have the code so that if any of the parsed values contains web.listen-address or web.telemetry-path, we would omit the ones that we try to set.

Copy link
Contributor

@tsachiherman tsachiherman left a comment

Choose a reason for hiding this comment

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

Moreover, since the code now generates a list of arguments that are going to be sent to the node_exporter process, I think it would be best if we've have a function that would parse the input argument ( i.e. NodeExporterPath ), and generate a list of argument that would be sent to node exporter.
Then, once we have this function and using it, we can create a series of unit tests that would validate that the passed parameters are constructed correctly in various test cases.

As an alternative, consider modifying the node_exporter process itself and add support for environment variable. The fact that the node_exporter doesn't have an environment variable that can be set to override the default parameters force all the derived applications to have "special" cases.

@jecassis
Copy link
Contributor Author

Moreover, since the code now generates a list of arguments that are going to be sent to the node_exporter process, I think it would be best if we've have a function that would parse the input argument ( i.e. NodeExporterPath ), and generate a list of argument that would be sent to node exporter.
Then, once we have this function and using it, we can create a series of unit tests that would validate that the passed parameters are constructed correctly in various test cases.

I think this the direction I'd probably explore with a filter for the existing ones.

As an alternative, consider modifying the node_exporter process itself and add support for environment variable. The fact that the node_exporter doesn't have an environment variable that can be set to override the default parameters force all the derived applications to have "special" cases.

My suspicion is that doing so adds an additional level of obfuscation/abstraction and in addition one could also make the same request to algod.

Copy link
Contributor

@Karmastic Karmastic left a comment

Choose a reason for hiding this comment

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

This seems good to me.

Copy link
Contributor

@tsachiherman tsachiherman left a comment

Choose a reason for hiding this comment

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

Units tests and updated functionality looks great.
Just one small request :
Within the unit test, can you use the require package instead of using the t.Errorf directly ?
When adding the require package, please place it in a separate line-separated “group”, like in the rest of the unit tests.

@jecassis
Copy link
Contributor Author

Much cleaner to use the require package. Had never used it before :) The changes are in flight. And the separate line grouping is enforced by gofmt, so it goes without saying.

@jecassis jecassis closed this Jun 17, 2019
@jecassis jecassis reopened this Jun 17, 2019
Copy link
Contributor

@tsachiherman tsachiherman left a comment

Choose a reason for hiding this comment

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

Looks great @jecassis, thank you for your contribution !

@derbear derbear merged commit a1c864a into algorand:master Jun 18, 2019
pzbitskiy pushed a commit to pzbitskiy/go-algorand that referenced this pull request Apr 3, 2020
Fix exceed map lookups in local state access in TEAL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants