From 33a897e1ce22d4139487bc872358300d84ed144a Mon Sep 17 00:00:00 2001 From: nullswan Date: Tue, 17 Sep 2024 23:04:21 +0200 Subject: [PATCH 1/3] chore(dependencies): update Docker tag and Go module dependencies --- Makefile | 2 +- go.mod | 8 ++--- go.sum | 94 ++++++++++++-------------------------------------------- 3 files changed, 24 insertions(+), 80 deletions(-) diff --git a/Makefile b/Makefile index c99c975..9c230c0 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ build-docker: build-docker-multiarch: docker buildx build \ --platform linux/amd64,linux/arm64,linux/arm/v7 \ - -t nullswan/bpfsnitch:latest \ + -t nullswan/bpfsnitch-dev:latest \ --push \ . -f deployments/Dockerfile diff --git a/go.mod b/go.mod index fcf347e..7bbc3c7 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,8 @@ toolchain go1.22.4 require ( github.com/cilium/ebpf v0.16.0 - github.com/prometheus/client_golang v1.20.3 + github.com/grafana/pyroscope-go v1.2.0 + github.com/prometheus/client_golang v1.20.4 google.golang.org/grpc v1.66.2 k8s.io/cri-api v0.31.1 ) @@ -14,9 +15,8 @@ require ( require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/hashicorp/golang-lru v1.0.2 // indirect + github.com/grafana/pyroscope-go/godeltaprof v0.1.8 // indirect github.com/klauspost/compress v1.17.9 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/prometheus/client_model v0.6.1 // indirect @@ -28,6 +28,4 @@ require ( golang.org/x/text v0.18.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect google.golang.org/protobuf v1.34.2 // indirect - k8s.io/apimachinery v0.31.0 // indirect - sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect ) diff --git a/go.sum b/go.sum index 82d418b..ff6803d 100644 --- a/go.sum +++ b/go.sum @@ -1,47 +1,21 @@ -buf.build/gen/go/wharfapp/core/connectrpc/go v1.16.2-20240804083033-0a80ec627ccc.1 h1:v+N4AsTSnK6bfz5dMRQA0LH2DoVbliuQqUEqOf5gzp0= -buf.build/gen/go/wharfapp/core/connectrpc/go v1.16.2-20240804083033-0a80ec627ccc.1/go.mod h1:tvIjkK2IKzemcHZbDDzhH+2Xa044QpGWAgGjtW8lFLU= -buf.build/gen/go/wharfapp/core/connectrpc/go v1.16.2-20240808221017-6482ebe73994.1 h1:2ep7l+zP9gddab6tdkEu7M0+jvTwlAeZdsa99ssrz5Y= -buf.build/gen/go/wharfapp/core/connectrpc/go v1.16.2-20240808221017-6482ebe73994.1/go.mod h1:glNSOV9XJ2MPB4rbxfu4MSyPS7Poot5AnBlSdH43TcE= -buf.build/gen/go/wharfapp/core/connectrpc/go v1.16.2-20240809123956-14f7063a0428.1 h1:LL5kzeHxTQ566KyvRiG7ADZiw1CQn0vupABccRRPzdg= -buf.build/gen/go/wharfapp/core/connectrpc/go v1.16.2-20240809123956-14f7063a0428.1/go.mod h1:UBbWnFBrdxY4mtaf5fC6oGXEFPIbO/DHzSQoDiNAz0k= -buf.build/gen/go/wharfapp/core/connectrpc/go v1.16.2-20240812084634-0b4d085d1a31.1 h1:tfSskzt3w16Iuzl428UGsYqouLC8ouCVFUprY7LEbvc= -buf.build/gen/go/wharfapp/core/connectrpc/go v1.16.2-20240812084634-0b4d085d1a31.1/go.mod h1:Wp88LlJ6twZGd+5WYijrJAGJSMISkSLLl+g18ZfGvZo= -buf.build/gen/go/wharfapp/core/connectrpc/go v1.16.2-20240812141250-601c8e473123.1 h1:XBuJp+9iSfUXklLG4aGKb8gs3u2AnIVi7z5Z6Rq42rQ= -buf.build/gen/go/wharfapp/core/connectrpc/go v1.16.2-20240812141250-601c8e473123.1/go.mod h1:/XquTIpEZSX+NFA4baVlZ/EnHqWy3jCZbfm0yrikCGw= -buf.build/gen/go/wharfapp/core/connectrpc/go v1.16.2-20240812141558-29fe36911288.1 h1:Jh9LEhlg75TiEjm/miKCnIs2tk11DQeO8BDIOOYzTPw= -buf.build/gen/go/wharfapp/core/connectrpc/go v1.16.2-20240812141558-29fe36911288.1/go.mod h1:lQVRC/i1L5NK88DgEYCi4zMM1rFBZqv9gUYFL5bAMFk= -buf.build/gen/go/wharfapp/core/protocolbuffers/go v1.34.2-20240804083033-0a80ec627ccc.2 h1:exefNXILOn7D8LWAuw46W47p/E1K99LLdAV8d6eht/0= -buf.build/gen/go/wharfapp/core/protocolbuffers/go v1.34.2-20240804083033-0a80ec627ccc.2/go.mod h1:3rLkbJSHFHnB5CIGqI8sqV60Cw3EpzatTFmEwPXzXro= -buf.build/gen/go/wharfapp/core/protocolbuffers/go v1.34.2-20240808221017-6482ebe73994.2 h1:Q88PTb+xylFuR1LAV5gViLt4NbIT/iT7mJwbnwhwTOI= -buf.build/gen/go/wharfapp/core/protocolbuffers/go v1.34.2-20240808221017-6482ebe73994.2/go.mod h1:3rLkbJSHFHnB5CIGqI8sqV60Cw3EpzatTFmEwPXzXro= -buf.build/gen/go/wharfapp/core/protocolbuffers/go v1.34.2-20240809123956-14f7063a0428.2 h1:Zu0pp9M03xemxymgPVXYVpqGXsiopY/x1VIaUCupkz8= -buf.build/gen/go/wharfapp/core/protocolbuffers/go v1.34.2-20240809123956-14f7063a0428.2/go.mod h1:3rLkbJSHFHnB5CIGqI8sqV60Cw3EpzatTFmEwPXzXro= -buf.build/gen/go/wharfapp/core/protocolbuffers/go v1.34.2-20240812084634-0b4d085d1a31.2 h1:IU+4kzujWCQRbadwj1kYpqWnnjyvjkRnjXKT3TtBVI4= -buf.build/gen/go/wharfapp/core/protocolbuffers/go v1.34.2-20240812084634-0b4d085d1a31.2/go.mod h1:3rLkbJSHFHnB5CIGqI8sqV60Cw3EpzatTFmEwPXzXro= -buf.build/gen/go/wharfapp/core/protocolbuffers/go v1.34.2-20240812141250-601c8e473123.2 h1:UIwt79/5GvhLFXrcpOWDTXYsTpJf6knyeH7XSxrC9mQ= -buf.build/gen/go/wharfapp/core/protocolbuffers/go v1.34.2-20240812141250-601c8e473123.2/go.mod h1:3rLkbJSHFHnB5CIGqI8sqV60Cw3EpzatTFmEwPXzXro= -buf.build/gen/go/wharfapp/core/protocolbuffers/go v1.34.2-20240812141558-29fe36911288.2 h1:Xr2SFzHPkDiUi5N25Y6fy5MvoQf8c2SFQ8dcmzriGlU= -buf.build/gen/go/wharfapp/core/protocolbuffers/go v1.34.2-20240812141558-29fe36911288.2/go.mod h1:3rLkbJSHFHnB5CIGqI8sqV60Cw3EpzatTFmEwPXzXro= -connectrpc.com/connect v1.16.2 h1:ybd6y+ls7GOlb7Bh5C8+ghA6SvCBajHwxssO2CGFjqE= -connectrpc.com/connect v1.16.2/go.mod h1:n2kgwskMHXC+lVqb18wngEpF95ldBHXjZYJussz5FRc= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cilium/ebpf v0.16.0 h1:+BiEnHL6Z7lXnlGUsXQPPAE7+kenAd4ES8MQ5min0Ok= github.com/cilium/ebpf v0.16.0/go.mod h1:L7u2Blt2jMM/vLAVgjxluxtBKlz3/GWjB0dMOEngfwE= -github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= -github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-quicktest/qt v1.101.0 h1:O1K29Txy5P2OK0dGo59b7b0LR6wKfIhttaAhHUyn7eI= github.com/go-quicktest/qt v1.101.0/go.mod h1:14Bz/f7NwaXPtdYEgzsx46kqSxVwTbzVZsDC26tQJow= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= -github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/grafana/pyroscope-go v1.2.0 h1:aILLKjTj8CS8f/24OPMGPewQSYlhmdQMBmol1d3KGj8= +github.com/grafana/pyroscope-go v1.2.0/go.mod h1:2GHr28Nr05bg2pElS+dDsc98f3JTUh2f6Fz1hWXrqwk= +github.com/grafana/pyroscope-go/godeltaprof v0.1.8 h1:iwOtYXeeVSAeYefJNaxDytgjKtUuKQbJqgAIjlnicKg= +github.com/grafana/pyroscope-go/godeltaprof v0.1.8/go.mod h1:2+l7K7twW49Ct4wFluZD3tZ6e0SjanjcUUBPVD/UuGU= github.com/josharian/native v1.1.0 h1:uuaP0hAbW7Y4l0ZRQ6C9zfb7Mg1mbFKry/xzDAfmtLA= github.com/josharian/native v1.1.0/go.mod h1:7X/raswPFr05uY3HiLlYeyQntB6OO7E/d2Cu7qoaN2w= github.com/jsimonetti/rtnetlink/v2 v2.0.1 h1:xda7qaHDSVOsADNouv7ukSuicKZO7GgVUCXxpaIEIlM= @@ -54,38 +28,35 @@ github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/mdlayher/netlink v1.7.2 h1:/UtM3ofJap7Vl4QWCPDGXY8d3GIY2UGSDbK+QWmY8/g= github.com/mdlayher/netlink v1.7.2/go.mod h1:xraEF7uJbxLhc5fpHL4cPe221LI2bdttWlU+ZGLfQSw= github.com/mdlayher/socket v0.4.1 h1:eM9y2/jlbs1M615oshPQOHZzj6R6wMT7bX5NPiQvn2U= github.com/mdlayher/socket v0.4.1/go.mod h1:cAqeGjoufqdxWkD7DkpyS+wcefOtmu5OQ8KuoJGIReA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg= -github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= -github.com/prometheus/client_golang v1.20.3 h1:oPksm4K8B+Vt35tUhw6GbSNSgVlVSBH0qELP/7u83l4= -github.com/prometheus/client_golang v1.20.3/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= +github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= github.com/prometheus/common v0.59.1 h1:LXb1quJHWm1P6wq/U824uxYi4Sg0oGvNeUm1z5dJoX0= github.com/prometheus/common v0.59.1/go.mod h1:GpWM7dewqmVYcd7SmRaiWVe9SSqjf0UrwnYnpEZNuT0= github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= -github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= -github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8= -golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY= -golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa h1:ELnwvuAXPNtPk1TJRuGkI9fDTwym6AYBu0qzT8AcHdI= -golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ= -golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 h1:kx6Ds3MlpiUHKj7syVnbp57++8WpuKPcR5yjLBjvLEA= -golang.org/x/exp v0.0.0-20240823005443-9b4947da3948/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ= golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -94,33 +65,20 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= -golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= -golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= -golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= -golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -131,25 +89,13 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 h1:BwIjyKYGsK9dMCBOorzRri8MQwmi7mT9rGHsCEinZkA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= -google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= -google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= -k8s.io/apimachinery v0.31.0 h1:m9jOiSr3FoSSL5WO9bjm1n6B9KROYYgNZOb4tyZ1lBc= -k8s.io/apimachinery v0.31.0/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= -k8s.io/apimachinery v0.31.1 h1:mhcUBbj7KUjaVhyXILglcVjuS4nYXiwC+KKFBgIVy7U= -k8s.io/apimachinery v0.31.1/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= -k8s.io/cri-api v0.31.0 h1:6o0XrhWlc1/zseGCh+aMScdXCg5nT6KCGdyx7HQkSKo= -k8s.io/cri-api v0.31.0/go.mod h1:Po3TMAYH/+KrZabi7QiwQI4a692oZcUOUThd/rqwxrI= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= k8s.io/cri-api v0.31.1 h1:x0aI8yTI7Ho4c8tpuig8NwI/MRe+VhjiYyyebC2xphQ= k8s.io/cri-api v0.31.1/go.mod h1:Po3TMAYH/+KrZabi7QiwQI4a692oZcUOUThd/rqwxrI= -sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= -sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= From fe830d6c62becb5185415eb2f5aec9f457c4c518 Mon Sep 17 00:00:00 2001 From: nullswan Date: Tue, 17 Sep 2024 23:04:22 +0200 Subject: [PATCH 2/3] feat(app): add profiling support using Pyroscope --- internal/app/app.go | 11 ++++++++ internal/profile/pyroscope.go | 49 +++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 internal/profile/pyroscope.go diff --git a/internal/app/app.go b/internal/app/app.go index cec854a..6208b29 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -31,6 +31,9 @@ func Run() error { var enablePprof bool flag.BoolVar(&enablePprof, "pprof", false, "Enable pprof") + var enableProfiling bool + flag.BoolVar(&enableProfiling, "profiling", false, "Enable profiling") + var prometheusPort uint64 flag.Uint64Var( &prometheusPort, @@ -43,6 +46,14 @@ func Run() error { log := logger.Init() + if enableProfiling { + log.Info("Profiling enabled") + err := profile.SetupProfiling(log) + if err != nil { + return fmt.Errorf("failed to setup profiling: %w", err) + } + } + if kubernetesMode { if !workload.IsSocketPresent() { return errors.New("runtime socket not found") diff --git a/internal/profile/pyroscope.go b/internal/profile/pyroscope.go new file mode 100644 index 0000000..50211e8 --- /dev/null +++ b/internal/profile/pyroscope.go @@ -0,0 +1,49 @@ +package profile + +import ( + "fmt" + "log/slog" + "os" + + "github.com/grafana/pyroscope-go" +) + +func SetupProfiling(log *slog.Logger) error { + serverAddress := os.Getenv("PYROSCOPE_SERVER") + if serverAddress == "" { + return fmt.Errorf("PYROSCOPE_SERVER is not set") + } + + user := os.Getenv("PYROSCOPE_USER") + if user == "" { + log.Warn("PYROSCOPE_USER is not set") + } + + password := os.Getenv("PYROSCOPE_PASSWORD") + if password == "" { + log.Warn("PYROSCOPE_PASSWORD is not set") + } + + pyroscope.Start(pyroscope.Config{ + ApplicationName: "bpfsnitch", + ServerAddress: serverAddress, + BasicAuthUser: user, + BasicAuthPassword: password, + Logger: pyroscope.StandardLogger, + Tags: map[string]string{"hostname": os.Getenv("HOSTNAME")}, + ProfileTypes: []pyroscope.ProfileType{ + pyroscope.ProfileCPU, + pyroscope.ProfileAllocObjects, + pyroscope.ProfileAllocSpace, + pyroscope.ProfileInuseObjects, + pyroscope.ProfileInuseSpace, + pyroscope.ProfileGoroutines, + pyroscope.ProfileMutexCount, + pyroscope.ProfileMutexDuration, + pyroscope.ProfileBlockCount, + pyroscope.ProfileBlockDuration, + }, + }) + + return nil +} From 19b52b26302d89c16953a0cadbf7e4fad9d3fabb Mon Sep 17 00:00:00 2001 From: nullswan Date: Tue, 17 Sep 2024 23:43:20 +0200 Subject: [PATCH 3/3] refactor(profile): use errors package and handle pyroscope start error --- internal/profile/pyroscope.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/profile/pyroscope.go b/internal/profile/pyroscope.go index 50211e8..58e7ad9 100644 --- a/internal/profile/pyroscope.go +++ b/internal/profile/pyroscope.go @@ -1,6 +1,7 @@ package profile import ( + "errors" "fmt" "log/slog" "os" @@ -11,7 +12,7 @@ import ( func SetupProfiling(log *slog.Logger) error { serverAddress := os.Getenv("PYROSCOPE_SERVER") if serverAddress == "" { - return fmt.Errorf("PYROSCOPE_SERVER is not set") + return errors.New("PYROSCOPE_SERVER is not set") } user := os.Getenv("PYROSCOPE_USER") @@ -24,7 +25,7 @@ func SetupProfiling(log *slog.Logger) error { log.Warn("PYROSCOPE_PASSWORD is not set") } - pyroscope.Start(pyroscope.Config{ + _, err := pyroscope.Start(pyroscope.Config{ ApplicationName: "bpfsnitch", ServerAddress: serverAddress, BasicAuthUser: user, @@ -44,6 +45,9 @@ func SetupProfiling(log *slog.Logger) error { pyroscope.ProfileBlockDuration, }, }) + if err != nil { + return fmt.Errorf("failed to start pyroscope: %w", err) + } return nil }