samber / chartjs-plugin-datasource-prometheus

📊 Chart.js plugin for Prometheus
https://www.npmjs.com/package/chartjs-plugin-datasource-prometheus
MIT License
107 stars 20 forks source link

baseURL as public parameter #2

Closed x-077 closed 4 years ago

x-077 commented 4 years ago

Hello @samber ,

Thanks for this grat plugin.

Would it be possible to make the internal parameter baseURL public ?

...
baseURL: this.endpoint + "/api/v1/",
 ...

something like this could be done here:

...
this.endpoint = options.endpoint.replace(/\/$/, "");
this.baseURL = options.baseURL || this.endpoint + "/api/v1/",
...

then here

...
baseURL: this.baseURL,
...

instead of :

...
baseURL: this.endpoint + "/api/v1/",,
...

My use case is that I proxy the request via a custom application and the url in my case would need to look like this when reaching my app:

Then I manage the construction of the URL in my backend to format the URL as necessary.

Thanks

samber commented 4 years ago

Hi @matth-c3

Thanks for your suggestion.

I updated the prometheus-query package and upgraded dependencies of chartjs-plugin-datasource-prometheus.

Please install v0.2.0.

This lib is very young, feel free to open PRs to improve it. Contributions from the community are welcome! ;)

x-077 commented 4 years ago

Hello @samber ,

Thanks, amazing work, I found out your plugin, it's awesome :D