Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aos
GitHub Repository: aos/grafana-agent
Path: blob/main/pkg/integrations/v2/app_agent_receiver/testdata/foo.js
5318 views
1
function throwError() {
2
throw new Error('This is a thrown error');
3
}
4
function callUndefined() {
5
// eslint-disable-next-line no-eval
6
eval('test();');
7
}
8
function callConsole(method) {
9
// eslint-disable-next-line no-console
10
console[method](`This is a console ${method} message`);
11
}
12
function fetchError() {
13
fetch('http://localhost:12345', {
14
method: 'POST'
15
});
16
}
17
function promiseReject() {
18
new Promise((_accept, reject)=>{
19
reject('This is a rejected promise');
20
});
21
}
22
function fetchSuccess() {
23
fetch('http://localhost:1234');
24
}
25
function sendCustomMetric() {
26
window.grafanaJavaScriptAgent.api.pushMeasurement({
27
type: 'custom',
28
values: {
29
my_custom_metric: Math.random()
30
}
31
});
32
}
33
window.addEventListener('load', ()=>{
34
window.grafanaJavaScriptAgent.api.pushLog([
35
'Manual event from Home'
36
]);
37
});
38
39
//# sourceMappingURL=foo.js.map
40
41