diff --git a/CHANGELOG.md b/CHANGELOG.md index c585509..c87f893 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## tip +* BUGFIX: fix variable substitution in queries. See [this issue](https://github.com/VictoriaMetrics/victorialogs-datasource/issues/77). + ## v0.5.0 * FEATURE: add support of the `$__interval` variable in queries. See [this issue](https://github.com/VictoriaMetrics/victorialogs-datasource/issues/61). diff --git a/src/datasource.ts b/src/datasource.ts index 7e26ba2..70fe1eb 100644 --- a/src/datasource.ts +++ b/src/datasource.ts @@ -1,4 +1,4 @@ -import { defaults, map as lodashMap } from 'lodash'; +import { defaults } from 'lodash'; import { Observable, lastValueFrom } from "rxjs"; import { map } from 'rxjs/operators'; @@ -166,16 +166,13 @@ export class VictoriaLogsDatasource } interpolateQueryExpr(value: any, _variable: any) { - const wrapInQuotes = (v: string) => `"${v}"`; - if (typeof value === 'string') { - return wrapInQuotes(value); + return value; } if (Array.isArray(value)) { - const escapedAndQuotedValues = lodashMap(value, wrapInQuotes); - const combinedValues = escapedAndQuotedValues.join(' OR '); - return escapedAndQuotedValues.length > 1 ? `(${combinedValues})` : combinedValues; + const combinedValues = value.join(' OR '); + return value.length > 1 ? `(${combinedValues})` : combinedValues; } return value;