github.com/grafana/pyroscope@v1.18.0/examples/grafana-alloy-auto-instrumentation/ebpf/local/config.alloy (about)

     1  
     2  // discovery.process produces targets with the following labels:`
     3  // "__process_pid__"
     4  // "__meta_process_exe"
     5  // "__meta_process_cwd"
     6  // "__meta_process_commandline"
     7  // "__meta_process_username"
     8  // "__meta_process_uid"
     9  // "__container_id__"
    10  // See reference doc for more info https://grafana.com/docs/alloy/next/reference/components/discovery/discovery.process/
    11  
    12  discovery.process "all" {
    13  
    14  }
    15  
    16  discovery.relabel "alloy" {
    17      targets = discovery.process.all.targets
    18      // Filter needed processes
    19      rule {
    20          source_labels = ["__meta_process_exe"]
    21          regex = ".*/alloy"
    22          action = "keep"
    23      }
    24       // provide arbitrary service_name label, otherwise it will be "unspecified"
    25      rule {
    26          source_labels = ["__meta_process_exe"]
    27          target_label = "service_name"
    28          regex = ".*/alloy"
    29          action = "replace"
    30          replacement = "ebpf/local/alloy"
    31      }
    32  }
    33  
    34  
    35  pyroscope.ebpf "instance" {
    36    forward_to = [pyroscope.write.endpoint.receiver]
    37    targets = concat(
    38      discovery.relabel.alloy.output,
    39      [{"__process_pid__" = "1", "service_name" = "ebpf/local/init"}],
    40    )
    41  }
    42  
    43  
    44  pyroscope.write "endpoint" {
    45    endpoint {
    46      url = "http://pyroscope:4040"
    47      // url = "<Grafana Cloud URL>"
    48      // basic_auth {
    49      //  username = "<Grafana Cloud User>"
    50      //  password = "<Grafana Cloud Password>"
    51      // }
    52    }
    53  }
    54