Skip to content

Commit 1be014e

Browse files
Faro init: support configuring namespace value. Default quickpizza (#226)
Co-authored-by: Seamus Toth <seamus.toth@grafana.com>
1 parent 5b9f099 commit 1be014e

File tree

3 files changed

+24
-9
lines changed

3 files changed

+24
-9
lines changed

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,15 @@ To enable [Grafana Cloud Frontend Observability](https://grafana.com/docs/grafan
188188

189189
1. In Grafana Cloud, create a new Frontend Observability application and set the domain to `http://localhost:3333`.
190190
2. Copy the application's Faro web URL.
191-
3. In your `.env` file, add the `QUICKPIZZA_CONF_FARO_URL` variable and set its value to your Faro web URL:
191+
3. In your `.env` file, add the following environment variables to configure your Faro URL and application name:
192192

193-
```bash
194-
QUICKPIZZA_CONF_FARO_URL=
195-
```
193+
```bash
194+
# FRONTEND OBSERVABILITY URL
195+
QUICKPIZZA_CONF_FARO_URL=
196+
197+
# FRONTEND OBSERVABILITY APPLICATION NAME
198+
QUICKPIZZA_CONF_FARO_APP_NAME=
199+
```
196200

197201
4. Restart the `docker-compose-cloud.yaml` environment:
198202

docker-compose-cloud.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,15 @@ services:
99
QUICKPIZZA_OTLP_ENDPOINT: http://alloy:4318
1010
QUICKPIZZA_TRUST_CLIENT_TRACEID: 1
1111
# must be set with an .env file
12-
QUICKPIZZA_CONF_FARO_URL: "${QUICKPIZZA_CONF_FARO_URL}"
13-
QUICKPIZZA_PYROSCOPE_ENDPOINT: "${QUICKPIZZA_PYROSCOPE_ENDPOINT}"
1412
QUICKPIZZA_GRAFANA_CLOUD_USER: "${QUICKPIZZA_GRAFANA_CLOUD_USER}"
1513
QUICKPIZZA_GRAFANA_CLOUD_PASSWORD: "${QUICKPIZZA_GRAFANA_CLOUD_PASSWORD}"
14+
QUICKPIZZA_PYROSCOPE_ENDPOINT: "${QUICKPIZZA_PYROSCOPE_ENDPOINT}"
15+
QUICKPIZZA_CONF_FARO_URL: "${QUICKPIZZA_CONF_FARO_URL}"
16+
QUICKPIZZA_CONF_FARO_APP_NAME: "${QUICKPIZZA_CONF_FARO_APP_NAME}"
17+
18+
# Namespace label in Faro. Default: quickpizza
19+
# QUICKPIZZA_CONF_FARO_APP_NAMESPACE: quickpizza
20+
1621
# Enable logging. Possible values: error, warn, debug. Default: info
1722
# QUICKPIZZA_LOG_LEVEL: debug
1823
# Service name label in Pyroscope. Default: quickpizza

pkg/web/src/hooks.client.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ function setupFaro() {
77
.then((data) => data.json())
88
.then((config) => {
99
const url = config.faro_url;
10+
const faroAppName = config.faro_app_name || 'QuickPizza';
11+
const faroAppNamespace = config.faro_app_namespace || 'quickpizza';
12+
const faroAppVersion = config.faro_app_version || '1.0.0';
13+
const faroAppEnvironment = config.faro_app_environment || 'production';
14+
1015
if (!url) {
1116
console.warn('Grafana Faro is not configured.');
1217
}
@@ -15,9 +20,10 @@ function setupFaro() {
1520
initializeFaro({
1621
url,
1722
app: {
18-
name: 'QuickPizza',
19-
version: '1.0.0',
20-
environment: 'production'
23+
name: faroAppName,
24+
namespace: faroAppNamespace,
25+
version: faroAppVersion,
26+
environment: faroAppEnvironment
2127
},
2228
instrumentations: [
2329
// Mandatory, overwriting the instrumentations array would cause the default instrumentations to be omitted

0 commit comments

Comments
 (0)