update
This commit is contained in:
1 parent
0ed2935f04
commit
c8cc0fb28a
11 files changed
+602
-21
No files matched your search
@@ -142,6 +142,13 @@
|
||||
var trackSpaRoutes = config.trackSpaRoutes !== false;
|
||||
var reportHttpFailures = config.reportHttpFailures !== false;
|
||||
var captureWebVitals = config.captureWebVitals !== false;
|
||||
// The todo widget (otel-todo.js) is loaded automatically unless excluded:
|
||||
// init({ excludeTodo: true }) or data-exclude-todo="true".
|
||||
var excludeTodo = config.excludeTodo === true || (scriptEl && scriptEl.getAttribute('data-exclude-todo') === 'true');
|
||||
var todoLibUrl =
|
||||
config.todoLibUrl ||
|
||||
(scriptEl && scriptEl.getAttribute('data-todo-lib')) ||
|
||||
(scriptEl && scriptEl.src ? scriptEl.src.replace(/[^\/]*$/, '') + 'otel-todo.js' : baseUrl + '/static/otel-todo.js');
|
||||
var injectTraceHeaders = config.injectTraceHeaders !== false;
|
||||
var traceHeaderOrigins = config.traceHeaderOrigins; // optional array; defaults to same-origin only
|
||||
// Client-side rate limiting: max events per rolling minute.
|
||||
@@ -406,6 +413,31 @@
|
||||
global.document.head.appendChild(script);
|
||||
}
|
||||
|
||||
function loadTodoWidget() {
|
||||
var todo = config.todo || {};
|
||||
function start() {
|
||||
if (!global.OtelTodo) return;
|
||||
global.OtelTodo.init({
|
||||
baseUrl: baseUrl,
|
||||
serviceName: serviceName,
|
||||
ingestKey: ingestKey,
|
||||
components: todo.components || ((scriptEl && scriptEl.getAttribute('data-components')) || '').split(','),
|
||||
shortcut: todo.shortcut || (scriptEl && scriptEl.getAttribute('data-shortcut')) || '',
|
||||
hideButton: todo.hideButton === true || (scriptEl && scriptEl.getAttribute('data-hide-button') === 'true')
|
||||
});
|
||||
}
|
||||
if (global.OtelTodo) return start();
|
||||
var s = global.document.createElement('script');
|
||||
s.async = true;
|
||||
s.src = todoLibUrl;
|
||||
s.onload = start;
|
||||
global.document.head.appendChild(s);
|
||||
}
|
||||
if (!excludeTodo && global.document) {
|
||||
if (global.document.body) loadTodoWidget();
|
||||
else global.document.addEventListener('DOMContentLoaded', loadTodoWidget);
|
||||
}
|
||||
|
||||
// traceHeaders returns a headers object carrying a fresh (or
|
||||
// continued) W3C traceparent, ready to spread into any HTTP client's
|
||||
// request headers - fetch, XHR, axios, etc.
|
||||
|
||||
Reference in new issue
Block a user