-
Notifications
You must be signed in to change notification settings - Fork 2
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
Replace provider with typescript client for querying prometheus data #60
Conversation
"*.json" | ||
] | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What you did to my newline? :p
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was just on vacation it's coming back
* At first, I needed to copy it here to fix an issue with the url. | ||
* But then I realized that we would need to polyfill fetch to use it, | ||
* so I think we'll just keep this version here for now, and | ||
* rely on the utilities to transform the request/response into the format we need. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might be a nice solution to add this to fiberplane-prometheus-query
instead:
export type QueryPrometheusOptions = RequestInit & {
/**
* Base URL to the Prometheus service, without trailing slash.
*/
baseUrl: string;
/**
* Custom `fetch` function to use instead of the global `fetch`.
*
* May be used to support environments that don't support `fetch`, or to inject `fetch` during tests.
*/
fetch?: typeof fetch;
};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah agreed — i was a little hesitant in this case because node-fetch is subtly different than browser fetch (e.g., it doesn't accept a cors parameter, but i don't think typescript would complain about that)
This PR swaps out the
prometheus.ts
file, removes the provider runtime, and addsfiberplane-prometheus-query
as a dependency.The
Prometheus
client exported byprometheus.ts
still exposes the same interface, so there weren't many changes outside of that file.Motivation for this PR was that the provider didn't seem to like using the URL
http://localhost:9090/prometheus
, i.e., the path to prometheus data exposed byam
.I tested locally, but would appreciate a second set of eyes.