Skip to content

[docseng-32] read synthetics metadata #30422

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 14, 2025
Merged
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
40 changes: 40 additions & 0 deletions layouts/shortcodes/get-metrics-from-git.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,44 @@
{{- $int_name := (.Get 0 ) -}}
{{- $metric_namespaces := (.Get 1 ) -}}
{{- if and $metric_namespaces (not (reflect.IsSlice $metric_namespaces)) -}}
{{- $metric_namespaces = slice $metric_namespaces -}}
{{- end -}}

{{- if $int_name -}}
<!-- Some edge cases the metadata is from a non-integration source, we get the JSON from websites-sources -->
<!-- The datafile in sources needs to follow the convention to match: appid_metadata.json -->
{{- $exceptions := slice "synthetics" "cloud-foundry" -}}
{{- if in $exceptions $int_name -}}
{{- $data := index .Site.Data (print $int_name "_metadata") -}}
{{- if $data -}}
<table>
{{- range $data -}}
{{- $metric := . -}}
{{- $shouldRender := false -}}
{{- if not $metric_namespaces -}}
{{- $shouldRender = true -}}
{{- else -}}
{{- range $metric_namespaces -}}
{{- if hasPrefix $metric.metric_name . -}}
{{- $shouldRender = true -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{- if $shouldRender -}}
<tr>
<td><strong>{{ .metric_name }}</strong> <br>({{ .metric_type }})</td>
<td>{{ .description }} {{ with .unit_name }}<br><em>Shown as {{ . }}{{ end }}</em></td>
</tr>
{{- end -}}
{{- end -}}
</table>
{{- else -}}
{{ warnf "%s_metadata.json datafile not found for %s integration." $int_name $int_name }}
{{- end -}}
{{- else -}}

<!-- For integrations we get the metrics from the integration page -->
<!-- if the page is a draft we can skip -->
{{- if not .Page.Draft -}}
<!-- if non english page load from english integration -->
Expand All @@ -25,4 +64,5 @@
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
Loading