Skip to content

Commit

Permalink
doc: documenting label option
Browse files Browse the repository at this point in the history
  • Loading branch information
yacoubii committed Jun 25, 2024
1 parent ad89c8f commit 9e92434
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,17 @@ This panel should be connected to one of these supported data sources:
Once done, you can define layers and metrics using code queries, following this format:

```
<query> <comment-sign>layer: <layerName>, ranges: [<min value>, <med value>, <max value>]
<query> <comment-sign>label: <label>, layer: <layerName>, ranges: [<min value>, <med value>, <max value>]
```
**Notes:**
- Palindrome.js metadata should be inside a comment section.
- Comment signs can be `#` or `//`.
- `label` metadata is optional

**Example for Prometheus data source**:

```Promql
node_disk_io_now{device="nvme0n1"} #layer: systemMetrics, ranges: [0, 50, 100]
node_disk_io_now{device="nvme0n1"} #label: ssdMetric, layer: systemMetrics, ranges: [0, 50, 100]
```

- Once you've finished typing queries, click on `Run queries`, and the 3D object will appear.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"server": "docker-compose up --build",
"sign": "npx --yes @grafana/sign-plugin@latest"
},
"author": "Smile",
"author": "Smile RnD <[email protected]>",
"license": "Apache-2.0",
"devDependencies": {
"@babel/core": "^7.21.4",
Expand Down
2 changes: 1 addition & 1 deletion src/components/PalindromePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const PalindromePanel: React.FC<Props> = ({ options, data, width, height,
executedQueryString = (data.request?.targets[i] as any).target;
}

const regex = /(?:#|\/\/)(?:metricLabel:\s*(.*?),\s*)?layer:\s*(.*?),\s*ranges:\s*\[(.*?)\]/;
const regex = /(?:#|\/\/)(?:label:\s*(.*?),\s*)?layer:\s*(.*?),\s*ranges:\s*\[(.*?)\]/;
const match = executedQueryString?.match(regex);
const parts = executedQueryString?.split(/#|\/\//);
let metricName, layerName, ranges;
Expand Down

0 comments on commit 9e92434

Please sign in to comment.