import React from 'react'; import { Alert } from '@grafana/ui'; type Props = { onDismiss: () => void; }; export default function MappingsHelp(props: Props): JSX.Element { return (

Mappings are currently supported only between Graphite and Loki queries.

When you switch your data source from Graphite to Loki, your queries are mapped according to the mappings defined in the example below. To define a mapping, write the full path of the metric and replace nodes you want to map to label with the label name in parentheses. The value of the label is extracted from your Graphite query when you switch data sources.

All tags are automatically mapped to labels regardless of the mapping configuration. Graphite matching patterns (using {}) are converted to Loki's regular expressions matching patterns. When you use functions in your queries, the metrics, and tags are extracted to match them with defined mappings.

Example: for a mapping = servers.(cluster).(server).*:

Graphite query Mapped to Loki query
alias(servers.west.001.cpu,1,2) {cluster="west", server="001"}
alias(servers.*.{001,002}.*,1,2) {server=~"(001|002)"}
interpolate(seriesByTag('foo=bar', 'server=002'), inf)) {foo="bar", server="002"}
); }