grafana / alloy

OpenTelemetry Collector distribution with programmable pipelines
https://grafana.com/oss/alloy
Apache License 2.0
1.28k stars 172 forks source link

Faro receiver doesn't forward page and view information #244

Open fnordian opened 6 months ago

fnordian commented 6 months ago

What's wrong?

I've set up grafana agent with faro.receiver and otelcol.exporter.otlphttp to ingest faro traces to tempo.

The traces in tempo do not contain any page or view information. There doesn't seem to be any configuration options to enable forwarding of certain meta data, so it seems broken that the information is just missing.

Steps to reproduce

Set up faro sdk, grafana agent and tempo. Produce traces with faro sdk. Review traces in tempo.

System information

No response

Software version

v0.39.2

Configuration

My agent config:

faro.receiver "faro" {
    server {
      listen_address = "0.0.0.0"
      listen_port = 4300
      cors_allowed_origins = ["*"]
    }

    output {
      traces = [otelcol.exporter.otlphttp.traces.input]
    }
}

otelcol.exporter.otlphttp "traces" {
    client {
        endpoint = "https://tempo:443"

        tls {
            insecure = false
        }
    }
}


### Logs

_No response_
github-actions[bot] commented 5 months ago

This issue has not had any activity in the past 30 days, so the needs-attention label has been added to it. If the opened issue is a bug, check to see if a newer release fixed your issue. If it is no longer relevant, please feel free to close this issue. The needs-attention label signals to maintainers that something has fallen through the cracks. No action is needed by you; your issue will be kept open and you do not have to respond to this comment. The label will be removed the next time this job runs if there is new activity. Thank you for your contributions!

rfratto commented 5 months ago

Hi there :wave:

On April 9, 2024, Grafana Labs announced Grafana Alloy, the spirital successor to Grafana Agent and the final form of Grafana Agent flow mode. As a result, Grafana Agent has been deprecated and will only be receiving bug and security fixes until its end-of-life around November 1, 2025.

To make things easier for maintainers, we're in the process of migrating all issues tagged variant/flow to the Grafana Alloy repository to have a single home for tracking issues. This issue is likely something we'll want to address in both Grafana Alloy and Grafana Agent, so just because it's being moved doesn't mean we won't address the issue in Grafana Agent :)

justinbwood commented 3 weeks ago

I'm not sure exactly what you mean by page and view information, but if you're looking for headers such as cloudfront viewer, you can insert them from the context metadata. If you're looking for web-vitals measurements like page load, the Faro receiver converts measurements to log lines, not traces or metrics.

Example of appending viewer headers and ingesting measurements, using your config above:

faro.receiver "faro" {
  server {
    listen_address = "0.0.0.0"
    listen_port = 4300
    cors_allowed_origins = ["*"]

    // propagate incoming headers to trace metadata
    include_metadata = true
  }

  output {
    logs = [loki.process.faro.receiver]
    traces = [otelcol.processor.attributes.headers.input]
  }
}

loki.process "faro" {
  // add your desired parsing stages for the logs/measurements from Faro
  stage.logfmt { /* ... */ }
  stage.labels { /* ... */ }

  forward_to = [loki.write.logs.receiver]
}

loki.write "logs" {
  endpoint {
    url = "https://loki:443"
  }
}

otelcol.processor.attributes "headers" {
  action {
    key = "http.client.latitude"
    from_context = "metadata.cloudfront-viewer-latitude"
    action = "upsert"
  }

  action {
    key = "http.client.longitude"
    from_context = "metadata.cloudfront-viewer-longitude"
    action = "upsert"
  }

  output {
    traces = [otelcol.exporter.otlphttp.traces.input]
  }
}

otelcol.exporter.otlphttp "traces" {
  client {
    endpoint = "https://tempo:443"
  }
}