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

Feature request: ability to specify HTTP probe POST body content as on-disk file #391

Closed
emmanuel opened this issue Dec 14, 2018 · 4 comments · Fixed by #987
Closed

Feature request: ability to specify HTTP probe POST body content as on-disk file #391

emmanuel opened this issue Dec 14, 2018 · 4 comments · Fixed by #987

Comments

@emmanuel
Copy link

Blackbox exporter config allows specifying POST body for HTTP probe as an in-line string in the config file. I have a circumstance where I want to probe with some large body sizes, and there is a significant memory impact of treating those bodies as inline strings.

I propose adding a BodyPath parameter to the HTTP prober, that will be used to open a file on disk and use the content of that file as the body of the probe's requests. Something like this:

type HTTPProbe struct {
	// Defaults to 2xx.
	ValidStatusCodes       []int             `yaml:"valid_status_codes,omitempty"`
...
	Body                   string            `yaml:"body,omitempty"`
	BodyPath               string            `yaml:"body_path,omitempty"`
	HTTPClientConfig       config.HTTPClientConfig `yaml:"http_client_config,inline"`
}
emmanuel added a commit to emmanuel/blackbox_exporter that referenced this issue Dec 14, 2018
@brian-brazil
Copy link
Contributor

How big is the data you're sending?

@emmanuel
Copy link
Author

1.6MiB, so far.

Also, I have multiple endpoints I'm scraping with the same bodies (with different HTTP parameters of other sorts), so the same data is parsed into memory as multiple copies of this large string. The current (in-line string) config option compels this duplication. Plus (and more essentially), YAML is just not a good medium for values of that size.

emmanuel added a commit to emmanuel/blackbox_exporter that referenced this issue Dec 19, 2018
@Turgon37
Copy link

Turgon37 commented Jan 2, 2020

Hello I'm also looking for this feature @emmanuel do you have any time to works on this ?

Thanks in advance

@birmogave87
Copy link

i am looking for something like this also Feature Request: Is there a way to scrape "Probe Logs" #586

danteu added a commit to danteu/blackbox_exporter that referenced this issue Nov 14, 2022
danteu added a commit to danteu/blackbox_exporter that referenced this issue Nov 14, 2022
danteu added a commit to danteu/blackbox_exporter that referenced this issue Nov 15, 2022
electron0zero pushed a commit that referenced this issue Mar 29, 2023
* Add HTTP request body test

This commit adds a test for specifying a request body for HTTP probes.

Signed-off-by: Daniel Teunis <[email protected]>

* Add support for HTTP request body as file

Resolves #391

Signed-off-by: Daniel Teunis <[email protected]>

* Use io instead of io/ioutil

Signed-off-by: Marcelo Magallon <[email protected]>

---------

Signed-off-by: Daniel Teunis <[email protected]>
Signed-off-by: Marcelo Magallon <[email protected]>
Co-authored-by: Marcelo Magallon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants