-
Notifications
You must be signed in to change notification settings - Fork 44
/
PingDetail.svelte
243 lines (229 loc) · 7.24 KB
/
PingDetail.svelte
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<script>
import { getPingData } from "../state/api";
import {
pageState,
updateURLState,
updateBreadcrumbs,
} from "../state/stores";
import { getBigQueryURL } from "../state/urls";
import VariantSelector from "../components/VariantSelector.svelte";
import AuthenticatedLink from "../components/AuthenticatedLink.svelte";
import Commentary from "../components/Commentary.svelte";
import CopyButton from "../components/CopyButton.svelte";
import HelpHoverable from "../components/HelpHoverable.svelte";
import ItemList from "../components/ItemList.svelte";
import Label from "../components/Label.svelte";
import MetadataTable from "../components/MetadataTable.svelte";
import NotFound from "../components/NotFound.svelte";
import Markdown from "../components/Markdown.svelte";
import PageHeader from "../components/PageHeader.svelte";
import SubHeading from "../components/SubHeading.svelte";
import AppAlert from "../components/AppAlert.svelte";
import SqlModal from "../components/SqlModal.svelte";
import {
getLibraryDescription,
getRecentlyAddedItemDescription,
} from "../data/help";
import { PING_SCHEMA } from "../data/schemas";
import { getLibraryName } from "../formatters/library";
import { stripLinks } from "../formatters/markdown";
import { getMetricSearchURL } from "../state/urls";
import { isRecent } from "../state/items";
import { getAppBreadcrumbs } from "./AppDetail.svelte";
import { getGleanPingQuery } from "../data/gleanSql";
export let params;
let selectedAppVariant;
const pingDataPromise = getPingData(params.app, params.ping).then(
(pingData) => {
updateBreadcrumbs([
...getAppBreadcrumbs(params, pingData),
{
url: `/apps/${params.app}/pings/${params.ping}/`,
name: pingData.name,
},
]);
[selectedAppVariant] = $pageState.channel
? pingData.variants.filter((app) => app.id === $pageState.channel)
: pingData.variants;
return pingData;
}
);
</script>
{#await pingDataPromise then ping}
<PageHeader title={ping.name}>
<svelte:fragment slot="tags">
{#if ping.origin && ping.origin !== params.app}
<a href={getMetricSearchURL(params.app, ping.origin)}
><Label
text={getLibraryName(ping)}
description={getLibraryDescription("ping", ping.origin)}
/></a
>
{/if}
{#each ping.tags as tag}
<a href={getMetricSearchURL(params.app, tag.name)}
><Label
text={tag.name}
description={stripLinks(tag.description)}
/></a
>
{/each}
</svelte:fragment>
</PageHeader>
<Markdown text={ping.description} inline={false} />
<SubHeading
title={"Metadata"}
helpText={"Metadata about this ping, as defined by the implementor."}
/>
<MetadataTable appName={params.app} item={ping} schema={PING_SCHEMA} />
<SubHeading
title={"Commentary"}
helpText={"Reviewed commentary from Mozilla data practitioners on this ping."}
/>
<Commentary item={ping} itemType={"ping"} />
<SubHeading
title={"Server Knobs Configuration"}
helpText={"Information about Server Knobs configuration for this ping."}
/>
<table>
<col />
<col />
<col />
<tr>
<td>
Sampling Configuration Snippet
<HelpHoverable
content={"Click the button to copy a configuration snippet for use in Mozilla Experimenter configuration"}
link={"https://mozilla.github.io/glean/book/user/pings/data-control-plane/experimenter-configuration.html"}
/>
</td>
<td>
Click the button to copy a snippet for use in a
<a
href="https://mozilla.github.io/glean/book/user/pings/data-control-plane/experimenter-configuration.html"
data-glean-label="Mozilla Experimenter configuration"
data-glean-type="PingDetail.PingSampling.MozillaExperimenterConfigurationURL"
>
Mozilla Experimenter configuration.
</a>
</td>
<td>
<CopyButton
textToCopy="{'{\n "gleanMetricConfiguration": {\n "pings_enabled": {\n "'}{ping.name}{'": true\n }\n }\n}'}"
type="PingDetail.PingSampling.CopySamplingConfigurationSnippet"
/>
</td>
</tr>
</table>
<SubHeading
title={"Access"}
helpText={"Ways to access this metric in Mozilla's data warehouse."}
/>
{#if isRecent(ping)}
<AppAlert
status="warning"
message={getRecentlyAddedItemDescription(ping.variants.length, "ping")}
/>{/if}
{#if ping.variants.length > 1}
<VariantSelector
name={"app_id"}
label={"Application Variant"}
bind:selectedVariant={selectedAppVariant}
on:change={() => updateURLState({ channel: selectedAppVariant.id })}
variants={ping.variants}
/>
{/if}
{#if selectedAppVariant}
<table>
<col />
<col />
<tr>
<td>
BigQuery
<HelpHoverable
content={"The BigQuery representation of this ping."}
link={"https://docs.telemetry.mozilla.org/cookbooks/accessing_glean_data.html"}
/>
</td>
<td>
<a
href={getBigQueryURL(
params.app,
selectedAppVariant.id,
params.ping
)}
>
{selectedAppVariant.table}
</a>
</td>
</tr>
<td>
Data Catalog
<HelpHoverable
content={"View this table in Mozilla's instance of DataHub"}
/>
</td>
<td>
<AuthenticatedLink
href={`https://mozilla.acryl.io/dataset/urn:li:dataset:(urn:li:dataPlatform:Glean,${params.app}.${params.ping},PROD)`}
>
{params.app}.{params.ping}
</AuthenticatedLink>
</td>
{#if selectedAppVariant.looker_explore}
<tr>
<td>
Looker
<HelpHoverable
content={"Explore this ping in Mozilla's instance of Looker."}
/>
</td>
<td>
<AuthenticatedLink href={selectedAppVariant.looker_explore.url}>
{selectedAppVariant.looker_explore.name}
</AuthenticatedLink>
</td>
</tr>
{/if}
<td>
STMO
<HelpHoverable
content={"Query this metric in Mozilla's instance of Redash."}
link={"https://docs.telemetry.mozilla.org/tools/stmo.html"}
/>
</td>
<td class="stmo">
<div>
Start a query in
<AuthenticatedLink
href="https://sql.telemetry.mozilla.org/queries/new"
target="_blank">STMO</AuthenticatedLink
> with the following SQL ➡
</div>
<SqlModal
openModalText="Generate SQL"
sqlContent={getGleanPingQuery(selectedAppVariant.table)}
/>
</td>
</table>
{/if}
<SubHeading
title={"Metrics"}
helpText={"Metrics that are sent inside this ping."}
/>
<ItemList
itemType="metrics"
items={ping.metrics}
appName={params.app}
tagDescriptions={ping.tag_descriptions}
/>
{:catch}
<NotFound pageName={params.ping} itemType="ping" />
{/await}
<style lang="scss">
@import "../main.scss";
@include metadata-table;
.stmo {
display: flex;
}
</style>