grafana / faro-web-sdk

The Grafana Faro Web SDK, part of the Grafana Faro project, is a highly configurable web SDK for real user monitoring (RUM) that instruments browser frontend applications to capture observability signals. Frontend telemetry can then be correlated with backend and infrastructure data for full-stack observability.
https://grafana.com/oss/faro/
Apache License 2.0
688 stars 62 forks source link

Is the API open source? #487

Closed veeral-patel closed 4 months ago

veeral-patel commented 4 months ago

Great work with Faro - I'm a huge fan.

However, I'm not sure how to go about using Faro's web SDK without Grafana Cloud - is this possible?

Let's say I can't use Grafana Cloud, is there any way I can get value out of Faro?

codecapitano commented 4 months ago

Hi @veeral-patel

Great work with Faro - I'm a huge fan.

Awesome that's wonderful feedback, will share it with the team 🙏

However, I'm not sure how to go about using Faro's web SDK without Grafana Cloud - is this possible?

Yes it is, the Grafana Agent supports Faro as well. Good to know: Main focus is on the Faro cloud receiver. Also the Agent has a different release schedule. This means sometimes new features are not available at the same time.

Faro also provides a transport which converts the Faro protocol to Open Telemetry protocol so you can use Otel collectors as well. We even have users which use Faro to send data to other vendors products using otlp.

Let's say I can't use Grafana Cloud, is there any way I can get value out of Faro? Yes :)

A good place to get started is to have a look at the Faro demo which uses the Grafana Agent. I's also worth it to have a look at the Faro community Slack channnel. There are a lot of people using the Grafana Agent.

Cheers, Marco

cc @cedricziel

veeral-patel commented 4 months ago

@codecapitano Thanks for your fast reply! Yes, if Faro is able to send data in OpenTelemetry format, then I can send the data to Loki or another log management service and analyze and graph the logs as I would like.

How does the Faro > OTLP package work, if you know? I'm guessing it converts logs to OLTP logs and traces to OLTP traces?

  1. Would we have a log for each event like a page view or HTTP request? That's what I'd like. (Don't care as much about console logs)
  2. What's the difference between using Faro > OLTP and just using Faro's built in tracing library (which is built on opentelemetry-js AFAIK)?
codecapitano commented 4 months ago

Would we have a log for each event like a page view or HTTP request? That's what I'd like. (Don't care as much about console logs)

Mostly yes, to get insight into HTTP requests you can either use our own fetch and xhr instrumentation or the web-tracing package, which uses otel under the hood, to instrument fetch and xhr.

Note: our own instrumentations are in development and will be move from experimental to stable in the next 3 month.

Here are some of the things Faro captures automatically:

How does the Faro > OTLP package work

Faro has its own protocol so it can produce very small payloads (we are constantly working on reducing the size). These payloads can be read and understand by the Faro cloud receiver and the Grafana agent but not by otel collectors.

So, to be able to ingest data with an otel collector, the Faro otlp-http-transport simply transforms a Faro payload to an otlp compatible payload before sending it.

What's the difference between using Faro > OLTP and just using Faro's built in tracing library

using Faro's built in tracing library Faro doesn't have a built-in tracing library. To get tracing, the web-tracing package has to be added.

The web-tracing package aims to make the setup and usage of otel a bit easier and to get a useful set of default instrumentations.

Data emitted by that instrumentation is wrapped in a standard Faro payload. Means Faro keeps sending Faro beacons, even if they contain otel traces and spans.

using Faro > OLTP When using the otlp transport Faro transforms all payloads to otlp before sending it.

Cheers, Marco