-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
1,191 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export function setupConsoleLog(element, log, text) { | ||
const execute = () => { | ||
log(text); | ||
} | ||
element.addEventListener('click', () => execute()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export function setupError(element) { | ||
const raiseError = () => { | ||
throw new Error('Throw new error with random data'); | ||
} | ||
element.addEventListener('click', () => raiseError()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
export function setupFetch(element) { | ||
const faro = window.faro; | ||
const { trace, context } = faro.api.getOTEL(); | ||
const tracer = trace.getTracer('default'); | ||
|
||
let resultElement = document.querySelector('#request-result') | ||
|
||
const makeRequest = () => { | ||
const span = tracer.startSpan('request-to-backend-app'); | ||
context.with(trace.setSpan(context.active(), span), () => { | ||
resultElement.innerHTML = 'loading...' | ||
fetch("https://gabelstapler-observability-app-1.apps.baloise.dev/endpoint").then(result => { | ||
result.text().then(text => { | ||
resultElement.innerHTML = text | ||
span.end() | ||
}); | ||
}).catch(err => { | ||
resultElement.innerHTML = err | ||
}); | ||
}); | ||
} | ||
element.addEventListener('click', () => makeRequest()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.