diff --git a/src/data/schemas.js b/src/data/schemas.js index 4f031db81..04cc03e9d 100644 --- a/src/data/schemas.js +++ b/src/data/schemas.js @@ -9,11 +9,14 @@ import { import { getCodeSearchLink } from "../formatters/codesearch"; import { getPingReasons } from "../formatters/text"; import { formatMonitor } from "../formatters/monitor"; +import { getStructureMarkdown } from "../formatters/structure"; const REQUIRED_METRIC_PARAMS_DOCS = "https://mozilla.github.io/glean/book/user/metric-parameters.html#required-metric-parameters"; const OPTIONAL_METRIC_PARAMS_DOCS = "https://mozilla.github.io/glean/book/user/metric-parameters.html#optional-metric-parameters"; +const EXAMPLE_OBJECT_DEFINITION_DOC = + "https://mozilla.github.io/glean/book/reference/metrics/object.html#example-object-metric-definition"; const PING_REASONS_DOCS = "https://mozilla.github.io/glean/book/reference/yaml/pings.html#reasons"; const METRIC_MONITOR_DOCS = @@ -233,6 +236,14 @@ export const METRIC_METADATA_SCHEMA = [ helpLink: METRIC_MONITOR_DOCS, valueFormatter: formatMonitor, }, + { + title: "Structure", + id: "structure", + type: "markdown", + helpText: "The defined structure of the object metric.", + helpLink: EXAMPLE_OBJECT_DEFINITION_DOC, + valueFormatter: getStructureMarkdown, + }, ]; export const PING_SCHEMA = [ { diff --git a/src/formatters/structure.js b/src/formatters/structure.js new file mode 100644 index 000000000..9e699b000 --- /dev/null +++ b/src/formatters/structure.js @@ -0,0 +1,5 @@ +export function getStructureMarkdown(structure) { + return structure + ? `
${JSON.stringify(structure, null, 2)}`
+ : null;
+}
diff --git a/src/pages/MetricDetail.svelte b/src/pages/MetricDetail.svelte
index 0b14fb160..7e75c3776 100644
--- a/src/pages/MetricDetail.svelte
+++ b/src/pages/MetricDetail.svelte
@@ -153,6 +153,7 @@
url: "url.html",
rate: "rate.html",
text: "text.html",
+ object: "object.html",
};
return links[type] ? `${sourceDocs}${links[type]}` : sourceDocs;