grafana / beyla

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

Java auto-instrumentation #801

Closed arnitolog closed 1 month ago

arnitolog commented 1 month ago

Hello,

I'm trying to auto-instrument Java application (Opensearch process) with Beyla. And for some reason I don't see any traces: Here is my Beyla config:

    print_traces: true
    attributes:
      kubernetes:
        enable : true
    routes:
      unmatched: heuristic
    discovery:
      services:
        - open_ports: 9200
    log_level: INFO
    otel_traces_export:
      endpoint: http://otlp-collector.otlp.svc.cluster.local:4317

Beyla 1.5.2 is deployed via standard helm chart as a Daemonset. Here is a log snippet from the Beyla pod:

time=2024-05-04T14:50:55.625Z level=INFO msg="Grafana Beyla" Version=72af6c9e Revision=72af6c9e "OpenTelemetry SDK Version"=1.23.1
time=2024-05-04T14:50:55.626Z level=INFO msg="starting Beyla in Application Observability mode"
time=2024-05-04T14:50:55.929Z level=INFO msg="using hostname" component=traces.ReadDecorator function=instance_ID_hostNamePIDDecorator hostname=grafana-beyla-9hcl5
time=2024-05-04T14:50:55.930Z level=INFO msg="Starting main node" component=beyla.Instrumenter
time=2024-05-04T14:50:55.930Z level=INFO msg="opening prometheus scrape endpoint" component=connector.PrometheusManager port=9090 path=/metrics
time=2024-05-04T14:50:56.337Z level=INFO msg="instrumenting process" component=discover.TraceAttacher cmd=/usr/share/opensearch/jdk/bin/java pid=53018
time=2024-05-04T14:50:56.337Z level=INFO msg="new process for already instrumented executable" component=discover.TraceAttacher pid=60857 child=[] exec=/usr/share/opensearch/jdk/bin/java
time=2024-05-04T14:50:56.337Z level=INFO msg="new process for already instrumented executable" component=discover.TraceAttacher pid=70601 child=[] exec=/usr/share/opensearch/jdk/bin/java
time=2024-05-04T14:50:56.338Z level=INFO msg="new process for already instrumented executable" component=discover.TraceAttacher pid=62683 child=[] exec=/usr/share/opensearch/jdk/bin/java
time=2024-05-04T14:50:56.338Z level=INFO msg="new process for already instrumented executable" component=discover.TraceAttacher pid=18898 child=[] exec=/usr/share/opensearch/jdk/bin/java

I've sent several requests to Opensearch cluster via REST API and expected to see something in traces. Did I miss something?

mariomac commented 1 month ago

Hi @arnitolog !

Is the Java process communicating via HTTPS? In that case, Beyla is not able to instrument the Java process, as the TLS implementation is written in pure Java.

If it is communicating via HTTP, could you run Beyla with log_level: DEBUG?

arnitolog commented 1 month ago

Hi @mariomac

Yes, the communication is all over HTTPS. So, it seems that this is a reason why Beyla is not able to get any traces. Anyway thanks for the perfect tool

grcevski commented 1 month ago

I marked this as an enhancement, I really want to be able to track JIT compiled Java methods :).