diff --git a/package.json b/package.json index 51f8bce..6c5c5c7 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/src/clients/prometheus.js b/src/clients/prometheus.js index ad177e4..5d46b8f 100644 --- a/src/clients/prometheus.js +++ b/src/clients/prometheus.js @@ -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} 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;