{"id":25524822,"url":"https://github.com/performancecopilot/speed","last_synced_at":"2026-03-07T22:32:34.826Z","repository":{"id":48512221,"uuid":"61606887","full_name":"performancecopilot/speed","owner":"performancecopilot","description":"A Go implementation of the PCP instrumentation API","archived":false,"fork":false,"pushed_at":"2021-07-22T03:12:04.000Z","size":2283,"stargazers_count":36,"open_issues_count":10,"forks_count":6,"subscribers_count":5,"default_branch":"main","last_synced_at":"2026-02-12T06:58:24.473Z","etag":null,"topics":["go","go-kit","metrics","monitoring","observability","pcp","performance","vector"],"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/performancecopilot.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"open_collective":"pcp"}},"created_at":"2016-06-21T06:10:54.000Z","updated_at":"2025-04-11T08:57:49.000Z","dependencies_parsed_at":"2022-09-17T04:51:39.171Z","dependency_job_id":null,"html_url":"https://github.com/performancecopilot/speed","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/performancecopilot/speed","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/performancecopilot%2Fspeed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/performancecopilot%2Fspeed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/performancecopilot%2Fspeed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/performancecopilot%2Fspeed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/performancecopilot","download_url":"https://codeload.github.com/performancecopilot/speed/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/performancecopilot%2Fspeed/sbom","scorecard":{"id":727857,"data":{"date":"2025-08-11","repo":{"name":"github.com/performancecopilot/speed","commit":"680d7c7921789aa5ab2d37fc67a7fb64f0b5ba96"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.4,"checks":[{"name":"Code-Review","score":6,"reason":"Found 17/28 approved changesets -- score normalized to 6","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yaml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:51: update your workflow using https://app.stepsecurity.io/secureworkflow/performancecopilot/speed/ci.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:56: update your workflow using https://app.stepsecurity.io/secureworkflow/performancecopilot/speed/ci.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yaml:59: update your workflow using https://app.stepsecurity.io/secureworkflow/performancecopilot/speed/ci.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/performancecopilot/speed/ci.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/performancecopilot/speed/ci.yaml/main?enable=pin","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 20 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-22T13:24:56.579Z","repository_id":48512221,"created_at":"2025-08-22T13:24:56.579Z","updated_at":"2025-08-22T13:24:56.579Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30234629,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T19:01:10.287Z","status":"ssl_error","status_checked_at":"2026-03-07T18:59:58.103Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["go","go-kit","metrics","monitoring","observability","pcp","performance","vector"],"created_at":"2025-02-19T20:16:24.955Z","updated_at":"2026-03-07T22:32:34.757Z","avatar_url":"https://github.com/performancecopilot.png","language":"Go","readme":"![Speed](images/speed.png)\n\nGolang implementation of the Performance Co-Pilot (PCP) instrumentation API\n\n[![Build Status](https://github.com/performancecopilot/speed/workflows/CI/badge.svg)](https://github.com/performancecopilot/speed/actions/workflows/ci.yaml)\n[![Coverage Status](https://coveralls.io/repos/github/performancecopilot/speed/badge.svg?branch=main)](https://coveralls.io/github/performancecopilot/speed?branch=main)\n[![GoDoc](https://godoc.org/github.com/performancecopilot/speed?status.svg)](https://godoc.org/github.com/performancecopilot/speed)\n[![Go Report Card](https://goreportcard.com/badge/github.com/performancecopilot/speed)](https://goreportcard.com/report/github.com/performancecopilot/speed)\n[![Mailing List](https://img.shields.io/badge/Mailing%20List-pcp-blue.svg)](https://groups.io/g/pcp)\n[![Slack Team](https://img.shields.io/badge/Slack-pcp-blue.svg)](https://h7zo83mvt1.execute-api.us-west-2.amazonaws.com/Express/)\n[![IRC #pcp](https://img.shields.io/badge/IRC-pcp-blue.svg)](https://web.libera.chat/#pcp)\n[![Github Release](https://img.shields.io/github/release/performancecopilot/speed.svg)](https://github.com/performancecopilot/speed/releases/latest)\n\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n\n\n- [Install](#install)\n  - [Prerequisites](#prerequisites)\n    - [PCP](#pcp)\n    - [Go](#go)\n    - [Grafana](#grafana)\n  - [Getting the library](#getting-the-library)\n  - [Getting the examples](#getting-the-examples)\n- [Walkthrough](#walkthrough)\n  - [SingletonMetric](#singletonmetric)\n  - [InstanceMetric](#instancemetric)\n  - [Counter](#counter)\n  - [CounterVector](#countervector)\n  - [Gauge](#gauge)\n  - [GaugeVector](#gaugevector)\n  - [Timer](#timer)\n  - [Histogram](#histogram)\n- [Go Kit](#go-kit)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n## Install\n\n### Prerequisites\n\n#### [PCP](https://pcp.io)\n\nInstall Performance Co-Pilot on your local machine, either using prebuilt archives or by getting and building the source code. For detailed instructions, read the [page from pcp.readthedocs.io](https://pcp.readthedocs.io/en/latest/HowTos/installation/index.html).\n\n#### [Go](https://golang.org)\n\nSet up a go environment on your computer. For more information about these steps, please read [how to write go code](https://golang.org/doc/code.html).\n\n- download and install go 1.6 or above from [https://golang.org/dl](https://golang.org/dl)\n\n- set up `$GOPATH` to the root folder where you want to keep your go code\n\n- add `$GOPATH/bin` to your `$PATH` by adding `export PATH=$GOPATH/bin:$PATH` to your shell configuration file, such as to your `.bashrc`, if using a Bourne shell variant.\n\n#### [Grafana](https://grafana-pcp.readthedocs.io/)\n\nThe grafana-pcp plugin provides PCP metrics in the popular Grafana visualization tool.  It includes [PCP Vector](https://grafana-pcp.readthedocs.io/en/latest/screenshots.html#pcp-vector), a live datasource for metrics exposed using Performance Co-Pilot. Metrics you create with Speed are immediately visible in Grafana using this datasource.\n\n### Getting the library\n\n```sh\ngo get github.com/performancecopilot/speed\n```\n\n### Getting the examples\n\nAll examples are executable go programs. Simply doing\n\n```sh\ngo get github.com/performancecopilot/speed/examples/\u003cexample name\u003e\n```\n\nwill get the example and add an executable to `$GOPATH/bin`. If it is on your path, simply doing\n\n```sh\n\u003cexample name\u003e\n```\n\nwill run the binary, running the example\n\n## Walkthrough\n\nThere are 3 main components defined in the library, a [__Client__](https://godoc.org/github.com/performancecopilot/speed#Client), a [__Registry__](https://godoc.org/github.com/performancecopilot/speed#Registry) and a [__Metric__](https://godoc.org/github.com/performancecopilot/speed#Metric). A client is created using an application name, and the same name is used to create a memory mapped file in `PCP_TMP_DIR`. Each client contains a registry of metrics that it holds, and will publish on being activated. It also has a `SetFlag` method allowing you to set a mmv flag while a mapping is not active, to one of three values, [`NoPrefixFlag`, `ProcessFlag` and `SentinelFlag`](https://godoc.org/github.com/performancecopilot/speed#MMVFlag). The ProcessFlag is the default and reports metrics prefixed with the application name (i.e. like `mmv.app_name.metric.name`). Setting it to `NoPrefixFlag` will report metrics without being prefixed with the application name (i.e. like `mmv.metric.name`) which can lead to namespace collisions, so be sure of what you're doing.\n\nA client can register metrics to report through 2 interfaces, the first is the `Register` method, that takes a raw metric object. The other is using `RegisterString`, that can take a string with metrics and instances to register similar to the interface in parfait, along with type, semantics and unit, in that order. A client can be activated by calling the `Start` method, deactivated by the `Stop` method. While a client is active, no new metrics can be registered but it is possible to stop existing client for metric registration.\n\nEach client contains an instance of the `Registry` interface, which can give different information like the number of registered metrics and instance domains. It also exports methods to register metrics and instance domains.\n\nFinally, metrics are defined as implementations of different metric interfaces, but they all implement the `Metric` interface, the different metric types defined are\n\n### [SingletonMetric](https://godoc.org/github.com/performancecopilot/speed#SingletonMetric)\n\nThis type defines a metric with no instance domain and only one value. It __requires__ type, semantics and unit for construction, and optionally takes a couple of description strings. A simple construction\n\n```go\nmetric, err := speed.NewPCPSingletonMetric(\n\t42,                                                             // initial value\n\t\"simple.counter\",                                               // name\n\tspeed.Int32Type,                                                // type\n\tspeed.CounterSemantics,                                         // semantics\n\tspeed.OneUnit,                                                  // unit\n\t\"A Simple Metric\",                                              // short description\n\t\"This is a simple counter metric to demonstrate the speed API\", // long description\n)\n```\n\nA SingletonMetric supports a `Val` method that returns the metric value and a `Set(interface{})` method that sets the metric value.\n\n### [InstanceMetric](https://godoc.org/github.com/performancecopilot/speed#InstanceMetric)\n\nAn `InstanceMetric` is a single metric object containing multiple values of the same type for multiple instances. It also __requires__ an instance domain along with type, semantics and unit for construction, and optionally takes a couple of description strings. A simple construction\n\n```go\nindom, err := speed.NewPCPInstanceDomain(\n\t\"Acme Products\",                                          // name\n\t[]string{\"Anvils\", \"Rockets\", \"Giant_Rubber_Bands\"},      // instances\n\t\"Acme products\",                                          // short description\n\t\"Most popular products produced by the Acme Corporation\", // long description\n)\n\n...\n\ncountmetric, err := speed.NewPCPInstanceMetric(\n\tspeed.Instances{\n\t\t\"Anvils\":             0,\n\t\t\"Rockets\":            0,\n\t\t\"Giant_Rubber_Bands\": 0,\n\t},\n\t\"products.count\",\n\tindom,\n\tspeed.Uint64Type,\n\tspeed.CounterSemantics,\n\tspeed.OneUnit,\n\t\"Acme factory product throughput\",\n\t`Monotonic increasing counter of products produced in the Acme Corporation\n\tfactory since starting the Acme production application.  Quality guaranteed.`,\n)\n```\n\nAn instance metric supports a `ValInstance(string)` method that returns the value as well as a `SetInstance(interface{}, string)` that sets the value of a particular instance.\n\n### [Counter](https://godoc.org/github.com/performancecopilot/speed#Counter)\n\nA counter is simply a PCPSingletonMetric with `Int64Type`, `CounterSemantics` and `OneUnit`.\nIt can optionally take a short and a long description.\n\nA simple example\n\n```go\nc, err := speed.NewPCPCounter(0, \"a.simple.counter\")\n```\n\na counter supports `Set(int64)` to set a value, `Inc(int64)` to increment by a custom delta and `Up()` to increment by 1.\n\n### [CounterVector](https://godoc.org/github.com/performancecopilot/speed#CounterVector)\n\nA CounterVector is a PCPInstanceMetric , with `Int64Type`, `CounterSemantics` and `OneUnit` and an instance domain created and registered on initialization, with the name `metric_name.indom`.\n\nA simple example\n\n```go\nc, err := speed.NewPCPCounterVector(\n\tmap[string]uint64{\n\t\t\"instance1\": 0,\n\t\t\"instance2\": 1,\n\t}, \"another.simple.counter\"\n)\n```\n\nIt supports `Val(string)`, `Set(uint64, string)`, `Inc(uint64, string)` and `Up(string)` amongst other things.\n\n### [Gauge](https://godoc.org/github.com/performancecopilot/speed#Gauge)\n\nA Gauge is a simple SingletonMetric storing float64 values, i.e. a PCP Singleton Metric with `DoubleType`, `InstantSemantics` and `OneUnit`.\n\nA simple example\n\n```go\ng, err := speed.NewPCPGauge(0, \"a.sample.gauge\")\n```\n\nsupports `Val()`, `Set(float64)`, `Inc(float64)` and `Dec(float64)`\n\n### [GaugeVector](https://godoc.org/github.com/performancecopilot/speed#GaugeVector)\n\nA Gauge Vector is a PCP instance metric with `DoubleType`, `InstantSemantics` and `OneUnit` and an autogenerated instance domain. A simple example\n\n```go\ng, err := NewPCPGaugeVector(map[string]float64{\n\t\"instance1\": 1.2,\n\t\"instance2\": 2.4,\n}, \"met\")\n```\n\nsupports `Val(string)`, `Set(float64, string)`, `Inc(float64, string)` and `Dec(float64, string)`\n\n### [Timer](https://godoc.org/github.com/performancecopilot/speed#Timer)\n\nA timer stores the time elapsed for different operations. __It is not compatible with PCP's elapsed type metrics__. It takes a name and a `TimeUnit` for construction.\n\n```go\ntimer, err := speed.NewPCPTimer(\"test\", speed.NanosecondUnit)\n```\n\ncalling `timer.Start()` signals the start of an operation\n\ncalling `timer.Stop()` signals end of an operation and will return the total elapsed time calculated by the metric so far.\n\n### [Histogram](https://godoc.org/github.com/performancecopilot/speed#Histogram)\n\nA histogram implements a PCP Instance Metric that reports the `mean`, `variance` and `standard_deviation` while using a histogram backed by [codahale's hdrhistogram implementation in golang](https://github.com/HdrHistogram/hdrhistogram-go). Other than these, it also returns a custom percentile and buckets for plotting graphs. It requires a low and a high value and the number of significant figures used at the time of construction.\n\n```\nm, err := speed.NewPCPHistogram(\"hist\", 0, 1000, 5)\n```\n\n## [Go Kit](https://gokit.io)\n\nGo kit provides [a wrapper package](https://godoc.org/github.com/go-kit/kit/metrics/pcp) over speed that can be used for building microservices that expose metrics using PCP.\n\nFor modified versions of the examples in go-kit that use pcp to report metrics, see [suyash/kit-pcp-examples](https://github.com/suyash/kit-pcp-examples)\n","funding_links":["https://opencollective.com/pcp"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperformancecopilot%2Fspeed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fperformancecopilot%2Fspeed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperformancecopilot%2Fspeed/lists"}