github.com/grafana/pyroscope@v1.18.0/examples/grafana-alloy-auto-instrumentation/java/docker/config.alloy (about) 1 logging { 2 level = "debug" 3 format = "logfmt" 4 } 5 6 discovery.process "all" { 7 // join kubernetes targets with process targets on container_id to have k8s labels 8 // join = discovery.kubernetes.containers.targets 9 } 10 11 discovery.relabel "java" { 12 targets = discovery.process.all.targets 13 rule { 14 source_labels = ["__meta_process_exe"] 15 action = "keep" 16 regex = ".*/java$" 17 } 18 rule { 19 source_labels = ["__meta_process_commandline"] 20 regex = "java FastSlow" 21 action = "keep" 22 } 23 rule { 24 action = "replace" 25 target_label = "service_name" 26 replacement = "java-fast-slow-fibonacci" 27 } 28 } 29 30 pyroscope.java "java" { 31 profiling_config { 32 interval = "15s" 33 alloc = "512k" 34 cpu = true 35 lock = "10ms" 36 sample_rate = 100 37 } 38 forward_to = [pyroscope.write.example.receiver] 39 targets = discovery.relabel.java.output 40 } 41 42 pyroscope.write "example" { 43 // Send metrics to a locally running Pyroscope instance. 44 endpoint { 45 url = "http://pyroscope:4040" 46 47 // To send data to Grafana Cloud you'll need to provide username and password. 48 // basic_auth { 49 // username = "myuser" 50 // password = "mypassword" 51 // } 52 } 53 external_labels = { 54 "env" = "example", 55 } 56 }