Skip to content

Commit

Permalink
match fix for series read
Browse files Browse the repository at this point in the history
  • Loading branch information
TzachiSh committed Nov 11, 2024
1 parent c7a5112 commit 53d704e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "qryn-client",
"version": "1.0.8",
"version": "1.0.9",
"description": "A client library for interacting with qryn, a high-performance observability backend.",
"main": "src/index.js",
"scripts": {
Expand Down
9 changes: 7 additions & 2 deletions src/clients/prometheus.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,22 @@ class Read {

/**
* Retrieve the list of time series that match a specified label set.
* @param {Object} match - The label set to match.
* @param {Array} match - The label set to match.
* @param {number} start - The start timestamp in seconds.
* @param {number} end - The end timestamp in seconds.
* @returns {Promise<QrynResponse>} A promise that resolves to the response from the series endpoint.
* @throws {QrynError} If the series request fails.
*/
async series(match, start, end) {
let params = new URLSearchParams({start, end })
if(!match) throw new QrynError('match parameter is required');
if(typeof match === 'string') match = [match];
match.forEach( match => params.append('match[]', match));

return this.service.request('/api/v1/series', {
method: 'POST',
headers: this.headers(),
body: new URLSearchParams({ match, start, end })
body: params
}).catch(error => {
if (error instanceof QrynError) {
throw error;
Expand Down

0 comments on commit 53d704e

Please sign in to comment.