grafana / beyla

eBPF-based autoinstrumentation of web applications and network metrics
https://grafana.com/oss/beyla-ebpf/
Apache License 2.0
1.33k stars 94 forks source link

Spans does not joined into a single trace #521

Open evheniyt opened 8 months ago

evheniyt commented 8 months ago

Hi, team

I'm trying to instrument a very simple python application like this

from flask import Flask
import requests

app = Flask(__name__)

@app.route("/")
def external_call():
    r = requests.get("https://example.com")
    return "200"

I'm expecting that making a request to / will produce a single trace with 2 spans: 1) span for / request 2) span for https://example.com request

But, what I see is that Beyla is creating 2 different traces with a single span, not joining spans into the single traceid

autoinstrument 2023-12-27 16:08:12.12274812 (394.575796ms[394.575796ms]) 200 GET / [127.0.0.1]->[127.0.0.1:8080] size:78B svc=[{test-python-app  python test-python-app-65db949f66-rj7jq-22598}] traceparent=[00-1c8
e1418c47119770773b7c1c09c265f-0000000000000000-01]                                                                                                                                                                  
autoinstrument 2023-12-27 16:08:12.12274812 (96.470011ms[96.470011ms]) 200 GET / [10.51.124.38]->[93.184.216.34:443] size:142B svc=[{test-python-app  python test-python-app-65db949f66-rj7jq-22598}] traceparent=[0
0-f272621c2e871d9eb17d581c30d11666-0000000000000000-01]

Beyla is configured with these env variables

        - name: BEYLA_PRINT_TRACES
          value: "true"
        - name: BEYLA_EXECUTABLE_NAME
          value: python
        - name: OTEL_SERVICE_NAME
          value: test-python-app
        - name: OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
          value: http://monitoring-tempo.monitoring.svc.cluster.local:4318/v1/traces
grcevski commented 8 months ago

Hi @evheniyt,

Yes you are correct, this is a current limitation. We just added code in main to support automatic context propagation for Go applications, we are working on providing the same for Python, NodeJS and Ruby next.

CoderPoet commented 8 months ago

The go implementation will look up the parent span in the map based on the goroutine pointer address

image