diff options
| author | Dave Henderson <dhenderson@gmail.com> | 2023-05-07 12:21:51 -0400 |
|---|---|---|
| committer | Dave Henderson <dhenderson@gmail.com> | 2023-05-07 12:21:51 -0400 |
| commit | 0aea3b0b4c66ffb4e6d06e6389951781a10de49e (patch) | |
| tree | 85bd00248a26d149892b7030b1e9d94333a7e074 /docs | |
| parent | 4120d90b4184f7a930f8515289aaf88d121ffd86 (diff) | |
Add Faro observability to docs site
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/config.toml | 3 | ||||
| -rw-r--r-- | docs/static/js/faro.js | 35 | ||||
| -rw-r--r-- | docs/static/js/search.js | 2 |
3 files changed, 38 insertions, 2 deletions
diff --git a/docs/config.toml b/docs/config.toml index c577f104..80ab8349 100644 --- a/docs/config.toml +++ b/docs/config.toml @@ -20,7 +20,8 @@ googleAnalytics = "UA-82637990-3" "https://code.jquery.com/jquery-3.3.1.min.js", "https://cdnjs.cloudflare.com/ajax/libs/fuse.js/3.4.4/fuse.min.js", "https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/jquery.mark.min.js", - "js/search.js" + "js/search.js", + "js/faro.js" ] [params.palette] diff --git a/docs/static/js/faro.js b/docs/static/js/faro.js new file mode 100644 index 00000000..662961a0 --- /dev/null +++ b/docs/static/js/faro.js @@ -0,0 +1,35 @@ +(function () { + var webSdkScript = document.createElement("script"); + + webSdkScript.src = "https://unpkg.com/@grafana/faro-web-sdk@^1.0.0/dist/bundle/faro-web-sdk.iife.js"; + + webSdkScript.onload = () => { + window.GrafanaFaroWebSdk.initializeFaro({ + url: "https://faro-collector-prod-us-central-0.grafana.net/collect/d8b5652f5dd57fb1cfec9a1c32970fe0", + app: { + name: "docs.gomplate.ca", + version: "1.0.0", + environment: "production", + }, + }); + + // Load instrumentations at the onLoad event of the web-SDK and after the above configuration. + // This is important because we need to ensure that the Web-SDK has been loaded and initialized before we add further instruments! + var webTracingScript = document.createElement("script"); + + webTracingScript.src = "https://unpkg.com/@grafana/faro-web-tracing@^1.0.0/dist/bundle/faro-web-tracing.iife.js"; + + // Initialize, configure (if necessary) and add the the new instrumentation to the already loaded and configured Web-SDK. + webTracingScript.onload = () => { + window.GrafanaFaroWebSdk.faro.instrumentations.add( + new window.GrafanaFaroWebTracing.TracingInstrumentation() + ); + }; + + // Append the Web Tracing script script tag to the HTML page + document.head.appendChild(webTracingScript); + }; + + // Append the Web-SDK script script tag to the HTML page + document.head.appendChild(webSdkScript); +})(); diff --git a/docs/static/js/search.js b/docs/static/js/search.js index 8bcea296..4f1bbdd9 100644 --- a/docs/static/js/search.js +++ b/docs/static/js/search.js @@ -63,7 +63,7 @@ function populateResults(result) { } let end = contents.length if (endIdx + summaryInclude < contents.length) { - endIdx + summaryInclude + endIdx + summaryInclude } snippet += contents.substring(start, end) snippetHighlights.push( |
