{"id":90528,"plugin_id":"plugin_asdk_app_6aa02bd506908191bbf12fc2ec2f3161","kind":"skill","collection_source":"plugin_package","comparison_source":null,"observed_at":"2026-11-11T06:08:17.002Z","digest":"14153bfdeff4aae7ed95c67a27a0b3e0fbe8777e1604b76a7b88b4d3faeb59ea","against":null,"payload":{"description":"Query shapes and settings for Better Stack map_chart (geographic map) and hierarchy_chart (host map hexagons). MUST load before creating either chart type — on dashboards or in Explore.","included_files":[],"name":"map-hierarchy-charts","skill_md_contents":"---\nname: map-hierarchy-charts\ndescription: Query shapes and settings for Better Stack map_chart (geographic map) and hierarchy_chart (host map hexagons). MUST load before creating either chart type — on dashboards or in Explore.\n---\n\n# Map & Hierarchy Charts\n\nBoth are **not** time-series: the query returns one row per location/entity — **no `time` column, no `GROUP BY time`, no series**. `AS value` is fine for both — neither renders a legend, so the value alias is never displayed. Load the query skill for the data type first (`metrics-query` / `logs-query`).\n\n## Map Charts (`map_chart`)\n\nPlot a numeric value at geographic points on a world map. Select exactly two things — a numeric value and a location — and group by the location.\n\n**Metrics:**\n\n```sql\nSELECT\n  avgMerge(rate_avg) AS value,\n  location(label('colo')) AS location\nFROM {{source}}\nWHERE {{time}} BETWEEN {{start_time}} AND {{end_time}}\n  AND name = 'cloudflare_zone_colocation_requests_total'\nGROUP BY location\n```\n\n**Raw events (logs / web events, e.g. in Explore):**\n\n```sql\nSELECT\n  COUNT(*) AS value,\n  location(JSONExtractCaseInsensitive(raw, 'remote_ip', 'Nullable(String)')) AS location\nFROM {{source}}\nWHERE {{time}} BETWEEN {{start_time}} AND {{end_time}}\nGROUP BY location\n```\n\n- **`location(...)`** resolves a string to coordinates: an **IP** (`'1.1.1.1'`), **airport code** (`'JFK'`), **city** (`'San Francisco, CA'`), or **country** (`'US'`, `'UK'`) — typically a metric label (`location(label('colo'))`) or a raw event field. Explicit coordinates work too: `tuple(lat, lng, 'custom_label')`.\n- The location expression must be aliased `AS location` and the value `AS value` (or set `location_column` / `value_columns` to match your aliases).\n\n### Settings\n\n| Setting           | Purpose                                                                                                                       | Default       |\n| ----------------- | ----------------------------------------------------------------------------------------------------------------------------- | ------------- |\n| `location_column` | Result column holding the `location()` tuple                                                                                  | `\"location\"`  |\n| `value_columns`   | Single-entry array with the numeric value column                                                                              | `[\"value\"]`   |\n| `location_label`  | `\"automatic\"` shows the closest city/country in tooltips; `\"original_value\"` shows the raw input (the IP, airport code, etc.) | `\"automatic\"` |\n| `unit`            | Value formatting                                                                                                              | `\"auto\"`      |\n\nUse `location_label: \"original_value\"` when the raw values matter to the reader (e.g. to see the actual IP addresses rather than the nearest city).\n\n## Hierarchy Charts (`hierarchy_chart`)\n\nHost maps: one colored hexagon per entity — host, service, pod — colored by a single numeric value on a min→max scale. Select a numeric value and an identifying label, one row per entity:\n\n```sql\nSELECT\n  label('_host') AS host,\n  avgMerge(value_avg) AS value\nFROM {{source}}\nWHERE {{time}} BETWEEN {{start_time}} AND {{end_time}}\n  AND name = 'system_cpu_utilization_ratio'\nGROUP BY host\n-- Settings: value_columns: [\"value\"], label_column: \"host\"\n```\n\n- The label column identifies each hexagon (shown inside it / in the tooltip); the single `value_columns` entry colors it.\n- To nest hexagons into groups (e.g. by environment or region), select up to two extra label columns, add them to `GROUP BY`, and list them in `group_by_columns` (first = outer group, second = sub-cluster).\n\n### Settings\n\n| Setting                   | Purpose                                                                                                                             | Default                                  |\n| ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------- |\n| `value_columns`           | Single-entry array with the numeric value that colors each hexagon                                                                  | `[\"value\"]`                              |\n| `label_column`            | Result column identifying each hexagon                                                                                              | auto-detected (first non-numeric column) |\n| `group_by_columns`        | Up to two columns to nest hexagons by (first = outer group, second = sub-cluster)                                                   | `[]`                                     |\n| `palette`                 | `\"green_to_red\"` (low = green — for metrics where high is bad, e.g. CPU) or `\"red_to_green\"` (high is good)                         | `\"green_to_red\"`                         |\n| `min_value` / `max_value` | Color scale bounds; set `0`/`1` for 0-1 ratios with `unit: \"percent\"`                                                               | data min / max                           |\n| `link_template`           | URL opened when a hexagon is clicked; `{{column}}` placeholders are filled from the row (e.g. `https://example.com/hosts/{{host}}`) | none                                     |\n| `unit`                    | Value formatting                                                                                                                    | `\"auto\"`                                 |\n"},"changes":[],"summary":"First saved snapshot. No earlier version is available for comparison.","summary_kind":"deterministic","summary_metadata":{}}