mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Explore: Match queries that are longer than defined Graphite/Loki mapping (#34003)
This commit is contained in:
parent
a7efe19167
commit
6ac43130f2
@ -49,7 +49,7 @@ function fromGraphite(graphiteQuery: GraphiteQueryModel, config: GraphiteToLokiQ
|
||||
});
|
||||
} else {
|
||||
const targetNodes = graphiteQuery.segments.map((segment) => segment.value);
|
||||
let mappings = config.mappings.filter((mapping) => mapping.matchers.length === targetNodes.length);
|
||||
let mappings = config.mappings.filter((mapping) => mapping.matchers.length <= targetNodes.length);
|
||||
|
||||
for (let mapping of mappings) {
|
||||
const matchers = mapping.matchers.concat();
|
||||
|
@ -40,6 +40,7 @@ describe('importing from Graphite queries', () => {
|
||||
[
|
||||
// metrics: captured
|
||||
mockGraphiteQuery('interpolate(alias(servers.west.001.cpu,1,2))'),
|
||||
mockGraphiteQuery('interpolate(alias(servers.east.001.request.POST.200,1,2))'),
|
||||
mockGraphiteQuery('interpolate(alias(servers.*.002.*,1,2))'),
|
||||
// tags: captured
|
||||
mockGraphiteQuery("interpolate(seriesByTag('cluster=west', 'server=002'), inf))"),
|
||||
@ -53,6 +54,7 @@ describe('importing from Graphite queries', () => {
|
||||
|
||||
expect(lokiQueries).toMatchObject([
|
||||
{ refId: 'A', expr: '{cluster="west", server="001"}' },
|
||||
{ refId: 'A', expr: '{cluster="east", server="001"}' },
|
||||
{ refId: 'A', expr: '{server="002"}' },
|
||||
{ refId: 'A', expr: '{cluster="west", server="002"}' },
|
||||
{ refId: 'A', expr: '{foo="bar", server="002"}' },
|
||||
|
Loading…
Reference in New Issue
Block a user