Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions src/components/SubHeading.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,30 @@

export let title;
export let helpText;
export let withLink;
</script>

<h2>
{@html title}
{#if helpText}
<HelpHoverable content={helpText} />
{/if}
</h2>
{#if withLink}
<a href="#{title}">
<h2 id={title} class="anchor">
{@html title}
{#if helpText}
<HelpHoverable content={helpText} />
{/if}
</h2>
</a>
{:else}
<h2>
{@html title}
{#if helpText}
<HelpHoverable content={helpText} />
{/if}
</h2>
{/if}

<style lang="scss">
@import "../main.scss";

h2 {
@include text-title-xs;
}
Expand Down
4 changes: 4 additions & 0 deletions src/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@
}
}
}

.anchor {
scroll-margin-top: 80px;
}
41 changes: 26 additions & 15 deletions src/pages/MetricDetail.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,15 @@
schema={METRIC_DEFINITION_SCHEMA}
/>

<h2>
Metric sampling
<HelpHoverable
content={"Information about the sampling state and rate."}
link={"https://mozilla.github.io/glean/book/user/metrics/data-control-plane/index.html"}
/>
</h2>
<a href="#metric-sampling"
><h2 id="metric-sampling" class="anchor">
Metric sampling
<HelpHoverable
content={"Information about the sampling state and rate."}
link={"https://mozilla.github.io/glean/book/user/metrics/data-control-plane/index.html"}
/>
</h2></a
>
{#if !isEmpty(metric.sampling_info)}
{#each Object.entries(metric.sampling_info) as [keyName, definition]}
<table>
Expand Down Expand Up @@ -355,20 +357,26 @@
</table>

{#if metric.extra_keys && !isEmpty(metric.extra_keys)}
<h2>
Extra keys
<HelpHoverable
content={'The acceptable keys on the "extra" object sent with events.'}
link={"https://mozilla.github.io/glean/book/reference/metrics/event.html#extra_keys"}
/>
</h2>
<a href="#extra-keys"
><h2 id="extra-keys" class="anchor">
Extra keys
<HelpHoverable
content={'The acceptable keys on the "extra" object sent with events.'}
link={"https://mozilla.github.io/glean/book/reference/metrics/event.html#extra_keys"}
/>
</h2></a
>
<table>
<col />
<col />
<col />
{#each Object.entries(metric.extra_keys) as [keyName, definition]}
<tr>
<td><code>{keyName}</code></td>
<td
><a href="#extra-key-{keyName}"
><code id="extra-key-{keyName}" class="anchor">{keyName}</code></a
></td
>
<td>
<code>{definition.type || "string"}</code>
</td>
Expand All @@ -383,6 +391,7 @@
<SubHeading
title={"Metadata"}
helpText={"Metadata about this metric, as defined by the implementor."}
withLink={true}
/>
<MetadataTable
appName={params.app}
Expand All @@ -393,12 +402,14 @@
<SubHeading
title={"Commentary"}
helpText={"Reviewed commentary from Mozilla data practitioners on this metric."}
withLink={true}
/>
<Commentary item={metric} itemType={"metric"} />

<SubHeading
title={"Access"}
helpText={"Ways to access this metric in Mozilla's data warehouse."}
withLink={true}
/>
{#if isRecent(metric)}
<AppAlert
Expand Down