Connecting telemetry services to PhariaAssistant

In PhariaAssistant, you often need to monitor application performance, errors, and user interactions. This guide describes how to connect OpenTelemetry (OTel) and Grafana Faro to gain insights into your apps' performance.


Supported telemetry providers

Choose your telemetry approach

You can use one or both of two telemetry approaches:

Option 1: Grafana Faro for frontend and OTel for backend

# values.yaml
pharia-assistant:
  faroTelemetryUrl: "https://your-faro-endpoint.com/collect"
  faroPublicApiKey: "your-faro-api-key"

pharia-assistant-api:
  otlp:
    endpoint: "https://your-otel-collector.com/v1/traces"
    sampleRate: 0.1  # Captures 10% of requests for monitoring

Option 2: OpenTelemetry

# values.yaml
pharia-assistant:
  otelCollectorUrl: "https://your-otel-collector.com/v1/traces"

pharia-assistant-api:
  otlp:
    endpoint: "https://your-otel-collector.com/v1/traces"
    sampleRate: 0.1  # Captures 10% of requests for monitoring

Option 3: Both Faro and OTel

# values.yaml
pharia-assistant:
  faroTelemetryUrl: "https://your-faro-endpoint.com/collect"
  faroPublicApiKey: "your-faro-api-key"
  otelCollectorUrl: "https://your-otel-collector.com/v1/traces"

pharia-assistant-api:
  otlp:
    endpoint: "https://your-otel-collector.com/v1/traces"
    sampleRate: 0.1  # Captures 10% of requests for monitoring

Backend monitoring (OpenTelemetry)

You use backend monitoring to monitor API performance, track errors, and debug distributed requests.

To use this approach, find the collector URL from your infrastructure team or managed service. Then, add the following to your values.yaml file:

   pharia-assistant-api:
    otlp:
      endpoint: "https://your-otel-collector.com/v1/traces"
      sampleRate: 0.1  # Captures 10% of requests for monitoring

Frontend monitoring

You use frontend monitoring to capture client-side errors and correlate them with backend errors and traces.

Option 1: Grafana Faro (OTel-based)

With this approach, Grafana Faro sends traces to OpenTelemetry with its own collector.

To use this, find the Grafana Faro endpoint and key from Grafana Cloud. Add the following to your values.yaml file:

   pharia-assistant:
     faroTelemetryUrl: "https://your-faro-endpoint.com/collect"
     faroPublicApiKey: "your-faro-api-key"
     instrumentationAppIdentifier: "my-assistant" # Optional

Optionally, you can specify an app identifier for collected telemetry.

Option 2: OpenTelemetry RUM (Direct)

You can also use direct Real User Monitoring (RUM) with OpenTelemetry.

To use this, find the OTLP endpoint from your collector. Add the following to your values.yaml file:

   pharia-assistant:
     otelCollectorUrl: "https://your-otel-collector.com/v1/traces"
     instrumentationAppIdentifier: "my-assistant" # Optional

Optionally, you can specify an app identifier for collected telemetry.

CORS Configuration

Your telemetry collector must enable CORS support for your PhariaAssistant domain.

For OpenTelemetry collector

Add CORS configuration to your collector:

receivers:
  otlp:
    protocols:
      http:
        cors:
          allowed_origins:
            - "https://your-assistant-domain.com"
            - "https://*.your-domain.com"
          allowed_headers:
            - "*"

For Grafana Faro

Ensure your Grafana Faro backend allows requests from your PhariaAssistant domain in its CORS settings.