Repository navigation
[#174] Add JSON configuration support for pgexporter metrics - #178
bassamadnan wants to merge 1 commit into
Conversation
|
@resyfer Can you take a look ? |
| * @return 0 upon success, otherwise 1 | ||
| */ | ||
| int | ||
| pgexporter_read_json(struct prometheus* prometheus, int prometheus_idx, char* filename, int* number_of_metrics); |
There was a problem hiding this comment.
Hi, the json APIs are actually migrated from pgexporter's sister project pgmoneta, where it's a few updates ahead, one of which includes a pgmoneta_json_read_file(). I'm pretty sure that's what you need. Could you migrate it from pgmoneta to json.c and use that instead? We try to keep the core APIs consistent across projects but I'm pretty tied up lately.
You'll need to remove some of the duplicated implementations (sorry about that), but I think you can still keep most of your work. Remember, that you'll need to change the prefix from pgmoneta_ to pgexporter_
If you need anything just let me know.
There was a problem hiding this comment.
Hi, I will look into it. I will go through pgmoneta's implementation for the APIs i have used from pgexporter's json.c and import over whatever is needed to itself. Just to be sure though, should i make these changes in the current PR or raise an issue for importing (& updating) current implementations?
Thank you for bringing this to my attention, will be happy to work on this as well.
There was a problem hiding this comment.
Hey,
Hi, I will look into it. I will go through pgmoneta's implementation for the APIs i have used from pgexporter's json.c and import over whatever is needed to itself.
Great! I would only port things related to read_file. We have had some other fixes and changes here and there so it's quite trivial to pick up all of them. We probably would just do a complete copy'n'paste some other day. Nevertheless, feel free to go through the APIs and propose ideas if you have any, we are pretty proud of our JSON APIs.
Just to be sure though, should i make these changes in the current PR or raise an issue for importing (& updating) current implementations?
Core API migration is under issue #141, so make sure you tag your commit with that issue number. I'm fine with either do this in one PR or in a separate one. @jesperpedersen Thoughts?
Thank you for bringing this to my attention, will be happy to work on this as well.
Thank you for working on this! Welcome to the community~
There was a problem hiding this comment.
@bassamadnan Try and port all the core APIs to here in a separate pull request. If it is just the function then you can do it in this pull request
|
You can rebase this now. Remember to add yourself to the manuals too, and describe the feature |
|
i've added myself to the AUTHORS in this PR if that is what we are talking about. Also in |
|
There are a few more files ... see my latest commit |
|
@jesperpedersen something i just noticed with the recent merge is this:
./src/pgexporter -c ./config/pgexporter.conf -u ./config/pgexporter_users.conf -Y /home/bassam/Documents/os/pgexporter/contrib/yaml/
should this be a matter of concern? also for the JSON thing im trying out i have these logs: This is likely due to memory leaks im assuming? trying to fix this ATM (these do not seem to come from the latest changes, but was a bug in this PR itself) |
|
Do that will enable ASAN and give you more clues, but yes, it is something that need to be investigated |
|
thanks, will try to fix the json issue asap. this is also reproduceable with simple curl requests on pgexporter/metrics |
5386820 to
7a8d747
Compare
|
updated the code to use the recently imported |
|
Rebased, and merged. Thanks for your contribution ! |
This is to support custom matrics by specifying a JSON path, this can be run from source using the -J flag, addressing #174.
Examples from the current
contrib/yamlhave also been added to the new directorycontrib/jsonand only one flag (either -Y or -J) is allowed to be set at a time. To run:Much like the YAML, this also has file support (
-J /path/to/json/file/).