mirror of
https://github.com/grafana/grafana.git
synced 2025-07-31 23:12:30 +08:00

* update eslint, tsconfig + esbuild to handle new jsx transform * remove thing that breaks the new jsx transform * remove react imports * adjust grafana-icons build * is this the correct syntax? * try this * well this was much easier than expected... * change grafana-plugin-configs webpack config * fixes * fix lockfile * fix 2 more violations * use path.resolve instead of require.resolve * remove react import * fix react imports * more fixes * remove React import * remove import React from docs * remove another react import
70 lines
2.3 KiB
TypeScript
70 lines
2.3 KiB
TypeScript
import { Alert } from '@grafana/ui';
|
|
|
|
type Props = {
|
|
onDismiss: () => void;
|
|
};
|
|
|
|
export default function MappingsHelp(props: Props): JSX.Element {
|
|
return (
|
|
<Alert severity="info" title="How to map Graphite metrics to labels?" onRemove={props.onDismiss}>
|
|
<p>Mappings are currently supported only between Graphite and Loki queries.</p>
|
|
<p>
|
|
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.
|
|
</p>
|
|
<p>
|
|
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.
|
|
</p>
|
|
<p>
|
|
Example: for a mapping = <code>servers.(cluster).(server).*</code>:
|
|
</p>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Graphite query</th>
|
|
<th>Mapped to Loki query</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>
|
|
<code>
|
|
alias(servers.<u>west</u>.<u>001</u>.cpu,1,2)
|
|
</code>
|
|
</td>
|
|
<td>
|
|
<code>
|
|
{cluster="<u>west</u>", server="<u>001</u>"}
|
|
</code>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<code>
|
|
alias(servers.*.<u>{001,002}</u>.*,1,2)
|
|
</code>
|
|
</td>
|
|
<td>
|
|
<code>
|
|
{server=~"<u>(001|002)</u>"}
|
|
</code>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<code>interpolate(seriesByTag('foo=bar', 'server=002'), inf))</code>
|
|
</td>
|
|
<td>
|
|
<code>{foo="bar", server="002"}</code>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</Alert>
|
|
);
|
|
}
|