Hi Christopher,

On Tue, Nov 19, 2019 at 04:35:47PM +0100, Christopher Faulet wrote:
> +/* Parse the query stirng of request URI to filter the metrics. It returns 1 
> on
> + * success and -1 on error. */
> +static int promex_parse_uri(struct appctx *appctx, struct stream_interface 
> *si)
> +{
> +     struct channel *req = si_oc(si);
> +     struct channel *res = si_ic(si);
> +     struct htx *req_htx, *res_htx;
> +     struct htx_sl *sl;
> +     const char *p, *end;
> +     struct buffer *err;
> +     int default_scopes = PROMEX_FL_SCOPE_ALL;
> +     int len;
> +
> +     /* Get the query-string */
> +     req_htx = htxbuf(&req->buf);
> +     sl = http_get_stline(req_htx);
> +     if (!sl)
> +             goto error;
> +     p = http_find_param_list(HTX_SL_REQ_UPTR(sl), HTX_SL_REQ_ULEN(sl), '?');
> +     if (!p)
> +             goto end;

It's my turn to be sorry. I wrongly tested on my side regarding a real
integration with prometheus, because I mixed the old metrics and the new
ones. Indeed, prometheus is trying to scrape the encoded url such as:

metrics%3Fscope=global&scope=frontend&scope=backend
instead of
metrics?scope=global&scope=frontend&scope=backend

Do you think it could be acceptable to send a patch adding a function
such as:
static inline char *http_find_encoded_param_list(char *path, size_t path_l, 
char* delim);

and test the encoded search if we don't find '?'
Or is there a way to convert the url first?

I'm ok to handle the patch if you validate the solution.

Thanks,
-- 
William

Reply via email to