{"id":20626196,"url":"https://github.com/mmcshane/salp","last_synced_at":"2025-04-15T15:20:25.987Z","repository":{"id":57506443,"uuid":"111782442","full_name":"mmcshane/salp","owner":"mmcshane","description":"USDT probes in Golang on Linux","archived":false,"fork":false,"pushed_at":"2023-08-10T20:05:52.000Z","size":31,"stargazers_count":31,"open_issues_count":3,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T21:42:47.273Z","etag":null,"topics":["cgo","ebpf","go","golang","usdt"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mmcshane.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-23T08:20:57.000Z","updated_at":"2024-05-23T18:44:08.000Z","dependencies_parsed_at":"2024-06-20T02:58:45.987Z","dependency_job_id":null,"html_url":"https://github.com/mmcshane/salp","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmcshane%2Fsalp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmcshane%2Fsalp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmcshane%2Fsalp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmcshane%2Fsalp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mmcshane","download_url":"https://codeload.github.com/mmcshane/salp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249094939,"owners_count":21211837,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cgo","ebpf","go","golang","usdt"],"created_at":"2024-11-16T13:12:16.916Z","updated_at":"2025-04-15T15:20:25.967Z","avatar_url":"https://github.com/mmcshane.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Salp\n\nSalp is a library that enables Go programs to create and fire USDT probes at\nruntime. Such probes allow API-stable (i.e. not dependent on function names) \ntracing of executables written in Go - especially important since function\ntracing of Go code requires some unappealing (though not unimpressive)\n[hacks](http://www.brendangregg.com/blog/2017-01-31/golang-bcc-bpf-function-tracing.html).\nSalp uses the [libstapsdt](https://github.com/sthima/libstapsdt) library to create\nand fire these probes.\n\n[![GoDoc](https://godoc.org/github.com/mmcshane/salp?status.svg)](https://godoc.org/github.com/mmcshane/salp)\n\n## Build\n\n### Dependencies\n\nSalp depends on `libstapsdt` which in turn depends on `libelf` and `libdl`.\n`libstapsdt` can be built from source or (for debian based distros) installed\nvia an Ubuntu PPA. Full instructions are available in the [docs for\nlibstapsdt](http://libstapsdt.readthedocs.io/en/latest/getting-started/getting-started.html)\n\n### Build and Test\n\nIf `libstdapsdt` is installed globally (e.g. from the PPA above or via `make\ninstall`), you should be able to simply `go build` or `go test`. However if you\nhave built `libstapsdt` from source then you will need to tell the `cgo` tool\nhow to find the headers and .so files for `libstapsdt` using the `CGO_CFLAGS`,\n`CGO_LDFLAGS`, and `LD_LIBRARY_PATH` environment variables.\n\n```bash\nexport CGO_CFLAGS=\"-I/path/to/libstapsdt/src\"\nexport CGO_LDFLAGS=\"-L/path/to/libstapsdt/out\"\nexport LD_LIBRARY_PATH=\"/path/to/libstapsdt/out\"\n```\n\n## Demo\n\nThis repository contains a demo executable that will fire two different probes\nevery second. The demo can be observed using the `trace` and `tplist` tools from\nthe [bcc](https://github.com/iovisor/bcc) project. Use two terminals to run the\ndemo - one to execute the tracable salpdemo go program and one to run the bcc\ntools and see their output. In the first window run\n\n```bash\ngo run internal/salpdemo.go\n```\n\nThis program will print out how to monitor itself but then won't print out\nanything after that. In the second window run the bcc trace program on the\n`salpdemo` process, monitoring probes `p1` and `p2`.\n\n```bash\nsudo trace -p \"$(pgrep -n salpdemo)\"                    \\\n    'u::p1 \"i=%d err='%s' date='%s'\", arg1, arg2, arg3' \\\n    'u::p2 \"j=%d flag=%d\", arg1, arg2'\n```\n\nor alternatively the same thing with `bpftrace`\n\n```bash\nsudo bpftrace -p \"$(pgrep -n salpdemo)\" /dev/stdin \u003c\u003cEOF\n  usdt:p1 { printf(\"i=%d err='%s' date='%s'\\n\", arg0, str(arg1), str(arg2)); }\n  usdt:p2 { printf(\"j=%d flag=%d\\n\", arg0, arg1); }\nEOF\n```\n\nEither trace invocations will output the values of the three args to probe 1 and\nthe two args to probe 2.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmmcshane%2Fsalp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmmcshane%2Fsalp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmmcshane%2Fsalp/lists"}