Process Faro telemetry data before sending it to Grafana Cloud
You can process telemetry data collected with the Faro Web SDK using your own OpenTelemetry Collector before sending it to Grafana Cloud. This approach gives you full control over your data processing pipeline, allowing you to:
- Remove sensitive information
- Filter out specific signals
- Apply custom processing rules
How it works
The processing pipeline includes the following steps:
- Receive data in Faro format and convert it into OpenTelemetry Protocol (OTLP) format
- Apply custom processing rules
- Convert back to Faro format and export to the Faro Collector endpoint
Configuration overview
Review the following information for an overview of the configuration:
- Receiver: The Faro receiver accepts telemetry data in Faro format and converts it into OTLP format
- Processors:
- Transform processor: Removes sensitive data, such as security numbers, from logs
- Filter processor: Drops all event signals
- Exporter: The Faro exporter converts processed OTLP data back to Faro format and sends it to the Faro Collector endpoint
- Extensions: The headers setter extension manages the required Grafana Cloud headers
Example configuration
This OpenTelemetry Collector configuration example file:
- Removes sensitive information, in this case, security numbers.
- Filters out specific event signals
# Tested with OpenTelemetry Collector Contrib v0.128.0
receivers:
faro:
include_metadata: true
cors:
allowed_origins:
- '*'
allowed_headers:
- 'X-Faro-Session-Id'
- 'Content-Type'
extensions:
headers_setter:
headers:
- action: insert
key: X-Faro-Session-Id
from_context: X-Faro-Session-Id
processors:
transform:
error_mode: ignore
log_statements:
# The transform processor removes sensitive information by replacing the security number in format QQ123456B from log body
- replace_pattern(log.body, "[A-Za-z]{2}\\d{6}[A-Za-z]", "***")
filter:
error_mode: ignore
logs:
log_record:
# The filter processor drops all events signals
- 'attributes["kind"] == "event"'
exporters:
faro:
endpoint: 'https://faro-collector-prod-eu-west-0.grafana.net/collect/{app-key}'
auth:
authenticator: headers_setter
service:
extensions: [headers_setter]
pipelines:
traces:
receivers:
- faro
exporters:
- faro
logs:
receivers:
- faro
processors:
- transform
- filter
exporters:
- faro
Implement
To use this setup, update your JavaScript initialization code to point to your collector instead of the Faro Collector endpoint.
This example points to the Faro Collector endpoint:
https://faro-collector-prod-eu-west-0.grafana.net/collect/{app-key}
This example represents your own collector:
https://my-collector-host.net/collect
Customize your implementation
The example described in this topic demonstrates basic data processing capabilities. You can extend it using processors from the OpenTelemetry contrib repository to meet your specific requirements.