{"id":13529632,"url":"https://github.com/influxdata/grade","last_synced_at":"2025-10-07T23:58:55.056Z","repository":{"id":74459591,"uuid":"62092921","full_name":"influxdata/grade","owner":"influxdata","description":"Track Go benchmark performance over time by storing results in InfluxDB","archived":false,"fork":false,"pushed_at":"2020-01-20T01:57:12.000Z","size":16,"stargazers_count":44,"open_issues_count":0,"forks_count":3,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-24T22:42:02.374Z","etag":null,"topics":["benchmark","golang","influxdb"],"latest_commit_sha":null,"homepage":null,"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/influxdata.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-06-27T22:35:27.000Z","updated_at":"2024-07-04T15:08:45.000Z","dependencies_parsed_at":"2024-01-02T23:41:45.599Z","dependency_job_id":"2deeec5a-d452-422f-8d4a-9825b8549b36","html_url":"https://github.com/influxdata/grade","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/influxdata%2Fgrade","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/influxdata%2Fgrade/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/influxdata%2Fgrade/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/influxdata%2Fgrade/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/influxdata","download_url":"https://codeload.github.com/influxdata/grade/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248325296,"owners_count":21084902,"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":["benchmark","golang","influxdb"],"created_at":"2024-08-01T07:00:38.059Z","updated_at":"2025-10-07T23:58:50.034Z","avatar_url":"https://github.com/influxdata.png","language":"Go","funding_links":[],"categories":["Collecting data into InfluxDB"],"sub_categories":["Projects"],"readme":"# grade\n\ngrade ingests Go benchmark data into InfluxDB so that you can track performance over time.\n\n## Installation\n\nTo download and install the `grade` executable into your `$GOPATH/bin`:\n\n```sh\ngo get github.com/influxdata/grade/cmd/grade\n```\n\n## Usage\n\n### Initial database configuration\n\nThe data from Go benchmarks tends to be very time-sparse (up to perhaps dozens of commits per day),\nso we recommend creating your database with an infinite retention and a large shard duration.\nIssue this command to your InfluxDB instance:\n\n```\nCREATE DATABASE benchmarks WITH DURATION INF SHARD DURATION 90d\n```\n\n### Running the command\n\nAlthough you can pipe the output of `go test` directly into `grade`,\nfor now we recommend placing the output of `go test` in a file first so that if something goes wrong,\nyou don't have to wait again to run all the benchmarks.\n\nFor example, to run all the benchmarks in your current Go project:\n\n```sh\ngo test -run=^$ -bench=. -benchmem ./... \u003e bench.txt\n```\n\nThen, assuming you are in the directory of your Go project and\ngit has checked out the same commit corresponding with the tests that have run,\nthis is the bare set of options to load the benchmark results into InfluxDB via `grade`:\n\n```sh\ngrade \\\n  -hardwareid=\"my dev machine\" \\\n  -goversion=\"$(go version | cut -d' ' -f3-)\" \\\n  -revision=\"$(git log -1 --format=%H)\" \\\n  -timestamp=\"$(git log -1 --format=%ct)\" \\\n  -branch=\"$(git rev-parse --abbrev-ref HEAD)\" \\\n  \u003c bench.txt\n```\n\nNotes on this style of invocation:\n\n* `-influxurl` is not provided but defaults to `http://localhost:8086`.\nBasic auth credentials can be embedded in the URL if needed.\nHTTPS is supported; supply `-insecure` if you need to skip SSL verification.\nIf you set it to an empty string, `grade` will print line protocol to stdout.\n* `-database` is not provided but defaults to `benchmarks`.\n* `-measurement` is not provided but defaults to `go`.\n* The hardware ID is a string that you specify to identify the hardware on which the benchmarks were run.\n* The Go version subcommand will produce a string like `go1.6.2 darwin/amd64`, but you can use any string you'd like.\n* The revision subcommand is the full SHA of the commit, but feel free to use a git tag name or any other string.\n* The timestamp is a Unix epoch timestamp in seconds.\nThe above subcommand produces the Unix timestamp for the committer of the most recent commit.\nThis assumes that the commits whose benchmarks are being run, all are ascending in time;\ngit does not enforce that commits' timestamps are ascending, so if this assumption is broken,\nyour data may look strange when you visualize it.\n* The branch subcommand is the name of the current branch. The `-branch` flag is optional.\n\n\n## Schema\n\nFor each benchmark result from a run of `go test -bench`:\n\n* Tags:\n\t* `goversion` is the same string as passed in to the `-goversion` flag.\n\t* `hwid` is the same string as passed in to the `-hardwareid` flag.\n\t* `name` is the name of the benchmark function, stripped of the `Benchmark` prefix.\n\t* `pkg` is the name of Go package containing the benchmark, e.g. `github.com/influxdata/influxdb/services/httpd`.\n\t* `procs` is the number of CPUs used to run the benchmark. This is a tag because you are more likely to group by `procs` rather than chart them over time.\n\t* `branch` is the same string as passed in to the `-branch` flag.\n\tSince the `-branch` flag is optional and can be omited, the tag will be present only if the flag is set.\n* Fields:\n\t* `alloced_bytes_per_op` is the allocated bytes per iteration of the benchmark.\n\t* `allocs_per_op` is how many allocations occurred per iteration of the benchmark.\n\t* `mb_per_s` is how many megabytes processed per second when running the benchmark.\n\t* `n` is the number of iterations in the benchmark.\n\t* `ns_per_op` is the number of wall nanoseconds taken per iteration of the benchmark.\n\t* `revision` is the git revision specified in the `-revision` flag.\n\tThis was chosen to be a field so that the information is quickly available but not at the cost of a growing series cardinality per benchmark run.\n\n## Sample\n\nFor a benchmark like this:\n\n```\nPASS\nBenchmarkMarshal-2                  \t  500000\t      2901 ns/op\t     560 B/op\t      13 allocs/op\nBenchmarkParsePointNoTags-2         \t 2000000\t       733 ns/op\t  31.36 MB/s\t     208 B/op\t       4 allocs/op\nBenchmarkParsePointWithPrecisionN-2 \t 2000000\t       627 ns/op\t  36.68 MB/s\t     208 B/op\t       4 allocs/op\nBenchmarkParsePointWithPrecisionU-2 \t 2000000\t       636 ns/op\t  36.15 MB/s\t     208 B/op\t       4 allocs/op\nBenchmarkParsePointsTagsSorted2-2   \t 2000000\t       947 ns/op\t  53.85 MB/s\t     240 B/op\t       4 allocs/op\nBenchmarkParsePointsTagsSorted5-2   \t 1000000\t      1189 ns/op\t  69.75 MB/s\t     272 B/op\t       4 allocs/op\nBenchmarkParsePointsTagsSorted10-2  \t 1000000\t      1624 ns/op\t  88.05 MB/s\t     320 B/op\t       4 allocs/op\nBenchmarkParsePointsTagsUnSorted2-2 \t 1000000\t      1167 ns/op\t  43.69 MB/s\t     272 B/op\t       5 allocs/op\nBenchmarkParsePointsTagsUnSorted5-2 \t 1000000\t      1627 ns/op\t  50.99 MB/s\t     336 B/op\t       5 allocs/op\nBenchmarkParsePointsTagsUnSorted10-2\t  500000\t      2733 ns/op\t  52.32 MB/s\t     448 B/op\t       5 allocs/op\nBenchmarkParseKey-2                 \t 1000000\t      2361 ns/op\t    1030 B/op\t      24 allocs/op\nok  \tgithub.com/influxdata/influxdb/models\t19.809s\n```\n\nWhich is passed to `grade` like this:\n\n```\ngrade \\\n  -influxurl '' \\\n  -goversion \"$(go version | cut -d' ' -f3-)\" \\\n  -hardwareid c4.large \\\n  -revision v1.0.2 \\\n  -timestamp \"$(cd $GOPATH/src/github.com/influxdata/influxdb \u0026\u0026 git log v1.0.2 -1 --format=%ct)\" \\\n  -branch=\"$(git rev-parse --abbrev-ref HEAD)\" \\\n  \u003c models-1.0.2.txt\n```\n\nYou will see output like:\n```\ngo,branch=master,goversion=go1.6.2\\ linux/amd64,hwid=c4.large,name=Marshal,pkg=github.com/influxdata/influxdb/models,procs=2 alloced_bytes_per_op=560i,allocs_per_op=13i,n=500000i,ns_per_op=2901,revision=\"v1.0.2\" 1475695157000000000\ngo,branch=master,goversion=go1.6.2\\ linux/amd64,hwid=c4.large,name=ParsePointNoTags,pkg=github.com/influxdata/influxdb/models,procs=2 alloced_bytes_per_op=208i,allocs_per_op=4i,mb_per_s=31.36,n=2000000i,ns_per_op=733,revision=\"v1.0.2\" 1475695157000000000\ngo,branch=master,goversion=go1.6.2\\ linux/amd64,hwid=c4.large,name=ParsePointWithPrecisionN,pkg=github.com/influxdata/influxdb/models,procs=2 alloced_bytes_per_op=208i,allocs_per_op=4i,mb_per_s=36.68,n=2000000i,ns_per_op=627,revision=\"v1.0.2\" 1475695157000000000\ngo,branch=master,goversion=go1.6.2\\ linux/amd64,hwid=c4.large,name=ParsePointWithPrecisionU,pkg=github.com/influxdata/influxdb/models,procs=2 alloced_bytes_per_op=208i,allocs_per_op=4i,mb_per_s=36.15,n=2000000i,ns_per_op=636,revision=\"v1.0.2\" 1475695157000000000\ngo,branch=master,goversion=go1.6.2\\ linux/amd64,hwid=c4.large,name=ParsePointsTagsSorted2,pkg=github.com/influxdata/influxdb/models,procs=2 alloced_bytes_per_op=240i,allocs_per_op=4i,mb_per_s=53.85,n=2000000i,ns_per_op=947,revision=\"v1.0.2\" 1475695157000000000\ngo,branch=master,goversion=go1.6.2\\ linux/amd64,hwid=c4.large,name=ParsePointsTagsSorted5,pkg=github.com/influxdata/influxdb/models,procs=2 alloced_bytes_per_op=272i,allocs_per_op=4i,mb_per_s=69.75,n=1000000i,ns_per_op=1189,revision=\"v1.0.2\" 1475695157000000000\ngo,branch=master,goversion=go1.6.2\\ linux/amd64,hwid=c4.large,name=ParsePointsTagsSorted10,pkg=github.com/influxdata/influxdb/models,procs=2 alloced_bytes_per_op=320i,allocs_per_op=4i,mb_per_s=88.05,n=1000000i,ns_per_op=1624,revision=\"v1.0.2\" 1475695157000000000\ngo,branch=master,goversion=go1.6.2\\ linux/amd64,hwid=c4.large,name=ParsePointsTagsUnSorted2,pkg=github.com/influxdata/influxdb/models,procs=2 alloced_bytes_per_op=272i,allocs_per_op=5i,mb_per_s=43.69,n=1000000i,ns_per_op=1167,revision=\"v1.0.2\" 1475695157000000000\ngo,branch=master,goversion=go1.6.2\\ linux/amd64,hwid=c4.large,name=ParsePointsTagsUnSorted5,pkg=github.com/influxdata/influxdb/models,procs=2 alloced_bytes_per_op=336i,allocs_per_op=5i,mb_per_s=50.99,n=1000000i,ns_per_op=1627,revision=\"v1.0.2\" 1475695157000000000\ngo,branch=master,goversion=go1.6.2\\ linux/amd64,hwid=c4.large,name=ParsePointsTagsUnSorted10,pkg=github.com/influxdata/influxdb/models,procs=2 alloced_bytes_per_op=448i,allocs_per_op=5i,mb_per_s=52.32,n=500000i,ns_per_op=2733,revision=\"v1.0.2\" 1475695157000000000\ngo,branch=master,goversion=go1.6.2\\ linux/amd64,hwid=c4.large,name=ParseKey,pkg=github.com/influxdata/influxdb/models,procs=2 alloced_bytes_per_op=1030i,allocs_per_op=24i,n=1000000i,ns_per_op=2361,revision=\"v1.0.2\" 1475695157000000000\n```\n\n\nOr without the `-branch` flag:\n```\ngrade \\\n  -influxurl '' \\\n  -goversion \"$(go version | cut -d' ' -f3-)\" \\\n  -hardwareid c4.large \\\n  -revision v1.0.2 \\\n  -timestamp \"$(cd $GOPATH/src/github.com/influxdata/influxdb \u0026\u0026 git log v1.0.2 -1 --format=%ct)\" \\\n  \u003c models-1.0.2.txt\n```\n\nYou will see output like:\n```\ngo,goversion=go1.6.2\\ linux/amd64,hwid=c4.large,name=Marshal,pkg=github.com/influxdata/influxdb/models,procs=2 alloced_bytes_per_op=560i,allocs_per_op=13i,n=500000i,ns_per_op=2901,revision=\"v1.0.2\" 1475695157000000000\ngo,goversion=go1.6.2\\ linux/amd64,hwid=c4.large,name=ParsePointNoTags,pkg=github.com/influxdata/influxdb/models,procs=2 alloced_bytes_per_op=208i,allocs_per_op=4i,mb_per_s=31.36,n=2000000i,ns_per_op=733,revision=\"v1.0.2\" 1475695157000000000\ngo,goversion=go1.6.2\\ linux/amd64,hwid=c4.large,name=ParsePointWithPrecisionN,pkg=github.com/influxdata/influxdb/models,procs=2 alloced_bytes_per_op=208i,allocs_per_op=4i,mb_per_s=36.68,n=2000000i,ns_per_op=627,revision=\"v1.0.2\" 1475695157000000000\ngo,goversion=go1.6.2\\ linux/amd64,hwid=c4.large,name=ParsePointWithPrecisionU,pkg=github.com/influxdata/influxdb/models,procs=2 alloced_bytes_per_op=208i,allocs_per_op=4i,mb_per_s=36.15,n=2000000i,ns_per_op=636,revision=\"v1.0.2\" 1475695157000000000\ngo,goversion=go1.6.2\\ linux/amd64,hwid=c4.large,name=ParsePointsTagsSorted2,pkg=github.com/influxdata/influxdb/models,procs=2 alloced_bytes_per_op=240i,allocs_per_op=4i,mb_per_s=53.85,n=2000000i,ns_per_op=947,revision=\"v1.0.2\" 1475695157000000000\ngo,goversion=go1.6.2\\ linux/amd64,hwid=c4.large,name=ParsePointsTagsSorted5,pkg=github.com/influxdata/influxdb/models,procs=2 alloced_bytes_per_op=272i,allocs_per_op=4i,mb_per_s=69.75,n=1000000i,ns_per_op=1189,revision=\"v1.0.2\" 1475695157000000000\ngo,goversion=go1.6.2\\ linux/amd64,hwid=c4.large,name=ParsePointsTagsSorted10,pkg=github.com/influxdata/influxdb/models,procs=2 alloced_bytes_per_op=320i,allocs_per_op=4i,mb_per_s=88.05,n=1000000i,ns_per_op=1624,revision=\"v1.0.2\" 1475695157000000000\ngo,goversion=go1.6.2\\ linux/amd64,hwid=c4.large,name=ParsePointsTagsUnSorted2,pkg=github.com/influxdata/influxdb/models,procs=2 alloced_bytes_per_op=272i,allocs_per_op=5i,mb_per_s=43.69,n=1000000i,ns_per_op=1167,revision=\"v1.0.2\" 1475695157000000000\ngo,goversion=go1.6.2\\ linux/amd64,hwid=c4.large,name=ParsePointsTagsUnSorted5,pkg=github.com/influxdata/influxdb/models,procs=2 alloced_bytes_per_op=336i,allocs_per_op=5i,mb_per_s=50.99,n=1000000i,ns_per_op=1627,revision=\"v1.0.2\" 1475695157000000000\ngo,goversion=go1.6.2\\ linux/amd64,hwid=c4.large,name=ParsePointsTagsUnSorted10,pkg=github.com/influxdata/influxdb/models,procs=2 alloced_bytes_per_op=448i,allocs_per_op=5i,mb_per_s=52.32,n=500000i,ns_per_op=2733,revision=\"v1.0.2\" 1475695157000000000\ngo,goversion=go1.6.2\\ linux/amd64,hwid=c4.large,name=ParseKey,pkg=github.com/influxdata/influxdb/models,procs=2 alloced_bytes_per_op=1030i,allocs_per_op=24i,n=1000000i,ns_per_op=2361,revision=\"v1.0.2\" 1475695157000000000\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfluxdata%2Fgrade","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finfluxdata%2Fgrade","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfluxdata%2Fgrade/lists"}