Skip to content

Commit 019307e

Browse files
integrated grafana faro in codebase
1 parent 63f1386 commit 019307e

File tree

3 files changed

+61
-22
lines changed

3 files changed

+61
-22
lines changed

Docs/Production/GrafanaFaro.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Grafana Faro with Grafana Alloy Setup Guide
2+
3+
This guide covers setting up Grafana Alloy for monitoring your systems.
4+
5+
## Step 1: Access Grafana
6+
1. Visit [Grafana's website](https://grafana.com/).
7+
2. Sign up using your preferred method (Email, Google, or GitHub).
8+
9+
## Step 2: Create a Grafana Cloud account
10+
1. Upon logging in, create a Grafana cloud account and then give a name to the grafan stack offered in the free trial.
11+
2. Accept the default URL or customize it. This URL will serve as your monitoring domain.
12+
13+
## Step 3: Configure Monitoring Platform
14+
1. Select the platform you want to monitor (e.g., Linux for Ubuntu).
15+
16+
## Step 4: Run Grafana Alloy
17+
1. Install the Grafana Alloy agent on your machine following Grafana’s instructions.
18+
19+
## Step 5: Generate an API Token
20+
1. Create a new API token to authenticate data from the Alloy agent.
21+
2. Name your token for easy reference.
22+
23+
## Step 6: Install and Verify Connection
24+
1. Run the provided installation commands in your terminal.
25+
2. Verify the connection in Grafana to ensure the agent is successfully sending data.
26+
27+
For a step-by-step walkthrough, visit [Scribe Guide](https://scribehow.com/shared/Creating_an_Account_and_Setting_Up_Grafana_Alloy__9EpUweIMRDyyjbSSgOKYCw).

src/main.tsx

+29-17
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,29 @@ import React from "react";
22
import ReactDOM from "react-dom/client";
33
import App from "./App.tsx";
44
import "./index.css";
5-
import { createRoutesFromChildren, matchRoutes, Routes, useLocation, useNavigationType} from 'react-router-dom';
6-
import { getWebInstrumentations, initializeFaro, ReactIntegration, ReactRouterVersion } from '@grafana/faro-react';
7-
import { TracingInstrumentation } from '@grafana/faro-web-tracing';
5+
import {
6+
createRoutesFromChildren,
7+
matchRoutes,
8+
Routes,
9+
useLocation,
10+
useNavigationType,
11+
} from "react-router-dom";
12+
import {
13+
getWebInstrumentations,
14+
initializeFaro,
15+
ReactIntegration,
16+
ReactRouterVersion,
17+
} from "@grafana/faro-react";
18+
import { TracingInstrumentation } from "@grafana/faro-web-tracing";
819

920
initializeFaro({
10-
url: 'https://faro-collector-prod-us-east-0.grafana.net/collect/44231aee736ba596035f91e852090587',
21+
// Replace with ADORSYS' grafana cloud webank-userapp collector url
22+
url: "URL",
1123
app: {
12-
name: 'webank-userapp',
13-
version: '1.0.0',
14-
environment: 'production'
15-
},
24+
name: "webank-userapp",
25+
version: "1.0.0",
26+
environment: "production",
27+
},
1628
instrumentations: [
1729
// Mandatory, omits default instrumentations otherwise.
1830
...getWebInstrumentations(),
@@ -24,15 +36,15 @@ initializeFaro({
2436
router: {
2537
version: ReactRouterVersion.V6,
2638
dependencies: {
27-
createRoutesFromChildren,
28-
matchRoutes,
29-
Routes,
30-
useLocation,
31-
useNavigationType
32-
}
33-
}
34-
})
35-
]
39+
createRoutesFromChildren,
40+
matchRoutes,
41+
Routes,
42+
useLocation,
43+
useNavigationType,
44+
},
45+
},
46+
}),
47+
],
3648
});
3749
ReactDOM.createRoot(document.getElementById("root")!).render(
3850
<React.StrictMode>

vite.config.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ import faroUploader from '@grafana/faro-rollup-plugin';
66
// https://vitejs.dev/config/
77
export default defineConfig({
88
plugins: [
9-
9+
// Replace with the endpoint, stack id, app id and api key of ADORSYS' grafana cloud
1010
faroUploader({
1111
appName: 'webank-userapp',
12-
endpoint: 'https://faro-api-prod-us-east-0.grafana.net/faro/api/v1',
13-
appId: '2403',
14-
stackId: '1085430',
15-
apiKey: 'glc_eyJvIjoiMTI2Njk5OSIsIm4iOiJ1c2VyLWFwcC11cGxvYWQta2V5LWFwcHRva2VuIiwiayI6IjkyMzJSVjlOVzk4eG14NUpyQzIwVXFjcCIsIm0iOnsiciI6InVzIn19',
12+
endpoint: 'END POINT',
13+
appId: 'APP ID',
14+
stackId: 'STACK ID',
15+
apiKey: 'API KEY',
1616
}),
1717

1818
react(),

0 commit comments

Comments
 (0)