{"id":24233206,"url":"https://github.com/memes/gce-metric","last_synced_at":"2026-05-11T00:32:22.452Z","repository":{"id":36985575,"uuid":"270908384","full_name":"memes/gce-metric","owner":"memes","description":"Synthetic metric generator for testing GCP autoscaling","archived":false,"fork":false,"pushed_at":"2025-01-13T01:49:30.000Z","size":1271,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-14T16:15:35.768Z","etag":null,"topics":["gcp","google","metrics","stackdriver"],"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/memes.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2020-06-09T05:09:57.000Z","updated_at":"2024-12-27T19:32:21.000Z","dependencies_parsed_at":"2023-10-02T16:46:46.101Z","dependency_job_id":"46cd67d1-c6d0-44d7-bc46-e6c70bf73cee","html_url":"https://github.com/memes/gce-metric","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/memes%2Fgce-metric","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/memes%2Fgce-metric/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/memes%2Fgce-metric/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/memes%2Fgce-metric/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/memes","download_url":"https://codeload.github.com/memes/gce-metric/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241853915,"owners_count":20031329,"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":["gcp","google","metrics","stackdriver"],"created_at":"2025-01-14T16:00:44.339Z","updated_at":"2026-05-11T00:32:22.441Z","avatar_url":"https://github.com/memes.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GCP custom metric generator\n\n![GitHub release](https://img.shields.io/github/v/release/memes/gce-metric?sort=semver)\n![Maintenance](https://img.shields.io/maintenance/yes/2025)\n[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md)\n[![Go Reference](https://pkg.go.dev/badge/github.com/memes/gce-metric.svg)](https://pkg.go.dev/github.com/memes/gce-metric)\n[![Go Report Card](https://goreportcard.com/badge/github.com/memes/gce-metric)](https://goreportcard.com/report/github.com/memes/gce-metric)\n\nA synthetic metric generator for Google Cloud that will create a time-series of\nartificial metrics that can be consumed by an autoscaler, or other metric-bound\nresource. The application will automatically generate a time-series\nwith labels appropriate for [gce_instance] or [gke_container] metrics, if detected,\nwith fallback to [generic_node] metrics.\n\n## Usage\n\nThe application has three-forms of operation; *generator*, *list*, and *delete*.\n\n### Generator\n\n\u003c!-- spell-checker: disable --\u003e\n```shell\ngce-metric waveform [flags] NAME\n```\n\u003c!-- spell-checker: enable --\u003e\n\n- *waveform* is one of sawtooth, sine, square, or triangle, and sets the pattern\n  for the metrics (see images below)\n- **NAME** is the custom metric type to add to GCP; this name must not conflict\n  with existing metrics provided by GCP, and convention suggests that it be of\n  the form `custom.googleapis.com/name` - see GCP [creating metrics] docs for\n  details.\n\nAll options have a default values which can be overridden through command line\nflags, environment variables, or a configuration file.\n\n- `--floor N` sets the minimum value for the cycles, can be an integer or floating\n  point value\n- `--ceiling N` sets the maximum value for the cycles, can be an integer of\n  floating point value\n- `--period T` sets the duration for one complete cycle from floor to ceiling,\n  must be valid Go duration string (see [time.ParseDuration])\n- `--sample T` sets the interval between sending metrics to Google Monitoring,\n  must be valid Go duration string (see [time.ParseDuration])\n- `--verbose` set the logging levels to include more details\n- `--integer` forces the generated metrics to be integers, making them less smooth\n  and more step-like\n\n\u003e **NOTE:** Custom metric names can be reused as long as the type of the metric\n\u003e doesn't change; i.e. if you created a metric with floating point values, and\n\u003e then try to use `--integer` with the same metric name it will fail.\n\nWhen executed on a GCE VM, or in a container with access to GCE metadata, the\nproject identifier (and other details) will be pulled from the metadata server.\nIf you run the application on a non-GCP system you will need to ensure you are\nauthenticated to GCP and authorised to create metric time-series.\n\n- `--project ID` will set (or override discovered) project ID for the metrics\n\u003c!-- TODO @memes This functionality is missing\n- `--metric-labels key1=value1,key2=value2` and `--resource-labels key1=value1,key2=value2`\n  can be used to populate the metric and resource labels assigned to the time\n  series, respectively.\n--\u003e\n\n#### Example: Sawtooth\n\n![Sawtooth metric in Metrics Explorer](images/sawtooth.png)\n\n\u003c!-- spell-checker: disable --\u003e\n```shell\ngce-metric sawtooth --floor 0 --ceiling 100 --period 20m --sample 30s custom.googleapis.com/gce_metric/sawtooth\n```\n\u003c!-- spell-checker: enable --\u003e\n\n#### Example: Sine\n\n![Sine metric in Metrics Explorer](images/sine.png)\n\n\u003c!-- spell-checker: disable --\u003e\n```shell\ngce-metric sine --floor 0 --ceiling 100 --period 20m --sample 30s custom.googleapis.com/gce_metric/sine\n```\n\u003c!-- spell-checker: enable --\u003e\n\n#### Example: Square\n\n![Square metric in Metrics Explorer](images/square.png)\n\n\u003c!-- spell-checker: disable --\u003e\n```shell\ngce-metric square --floor 0 --ceiling 100 --period 20m --sample 30s custom.googleapis.com/gce_metric/square\n```\n\u003c!-- spell-checker: enable --\u003e\n\n#### Example: Triangle\n\n![Triangle metric in Metrics Explorer](images/triangle.png)\n\n\u003c!-- spell-checker: disable --\u003e\n```shell\ngce-metric triangle --floor 0 --ceiling 100 --period 20m --sample 30s custom.googleapis.com/gce_metric/triangle\n```\n\u003c!-- spell-checker: enable --\u003e\n\n### List\n\nTo list custom metrics\n\n\u003c!-- spell-checker: disable --\u003e\n```shell\ngce-metric list [--verbose] [--project ID --filter FILTER]\n```\n\u003c!-- spell-checker: enable --\u003e\n\n- `--filter` applies a [metric filter] to the list. If omitted, the default filter\n  will limit the results to metrics matching `custom.googleapis.com/*` in the\n  project.\n\n### Delete\n\nTo delete one or more custom metrics use\n\n\u003c!-- spell-checker: disable --\u003e\n```shell\ngce-metric delete [--verbose] [--project ID] NAME...\n```\n\u003c!-- spell-checker: enable --\u003e\n\nor combine with [list](#list) to delete all custom metrics matching a criteria\n\n\u003c!-- spell-checker: disable --\u003e\n```shell\ngce-metric list [--project ID] --filter FILTER | \\\n   xargs gce-metric delete [--project ID]\n```\n\u003c!-- spell-checker: enable --\u003e\n\n## Binaries\n\nBinaries are published on the [Releases] page for Linux, macOS, and Windows. If\nyou have Go installed locally, `go install github.com/memes/gce-metric/cmd/gce-metric`\nwill download and install to *$GOBIN*.\n\nA container image is also published to Docker Hub and GitHub Container Registries\nthat can be used in place of the binary; just append the arguments to the\n`docker run` or `podman run` command.\n\nE.g.\n\n\u003c!-- spell-checker: disable --\u003e\n```shell\npodman run -d --rm --name gce-metric \\\n   ghcr.io/memes/gce-metric:v1.2.3 \\\n   sawtooth -period 1h -sample 2m\n```\n\u003c!-- spell-checker: enable --\u003e\n\n## Verifying releases\n\nFor each tagged release, an tarball of the source and a [syft] SBOM is created,\nalong with SHA256 checksums for all files. [cosign] is used to automatically generate\na signing certificate for download and verification of container images.\n\n### Verify release files\n\n1. Download the checksum, signature, and signing certificate file from GitHub\n\n   \u003c!-- spell-checker: disable --\u003e\n   ```shell\n   curl -sLO https://github.com/memes/gce-metric/releases/download/v1.2.3/gce-metric_1.2.3_SHA256SUMS\n   curl -sLO https://github.com/memes/gce-metric/releases/download/v1.2.3/gce-metric_1.2.3_SHA256SUMS.sig\n   curl -sLO https://github.com/memes/gce-metric/releases/download/v1.2.3/gce-metric_1.2.3_SHA256SUMS.pem\n   ```\n   \u003c!-- spell-checker: enable --\u003e\n\n2. Verify the SHA256SUMS have been signed with [cosign]\n\n   \u003c!-- spell-checker: disable --\u003e\n   ```shell\n   cosign verify-blob \\\n      --cert gce-metric_1.2.3_SHA256SUMS.pem \\\n      --signature gce-metric_1.2.3_SHA256SUMS.sig \\\n      gce-metric_1.2.3_SHA256SUMS\n   ```\n\n   ```text\n   verified OK\n   ```\n   \u003c!-- spell-checker: enable --\u003e\n\n3. Download and verify files\n\n   Now that the checksum file has been verified, any other file can be verified\n   using `sha256sum`.\n\n   For example\n\n   \u003c!-- spell-checker: disable --\u003e\n   ```shell\n   curl -sLO https://github.com/memes/gce-metric/releases/download/v1.2.3/gce-metric-1.2.3.tar.gz.sbom\n   curl -sLO https://github.com/memes/gce-metric/releases/download/v1.2.3/gce-metric_1.2.3_linux_amd64\n   sha256sum --ignore-missing -c gce-metric_1.2.3_SHA256SUMS\n   ```\n\n   ```text\n   gce-metric-1.2.3.tar.gz.sbom: OK\n   gce-metric_1.2.3_linux_amd64: OK\n   ```\n   \u003c!-- spell-checker: enable --\u003e\n\n### Verify container image\n\nUse [cosign]s experimental OCI signature support to validate the container.\n\n\u003c!-- spell-checker: disable --\u003e\n```shell\nCOSIGN_EXPERIMENTAL=1 cosign verify ghcr.io/memes/gce-metric:v1.2.3\n```\n\u003c!-- spell-checker: enable --\u003e\n\n[gce_instance]: https://cloud.google.com/monitoring/api/resources#tag_gce_instance\n[gke_container]: https://cloud.google.com/monitoring/api/resources#tag_gke_container\n[generic_node]: https://cloud.google.com/monitoring/api/resources#tag_generic_node\n[creating metrics]: https://cloud.google.com/monitoring/custom-metrics/creating-metrics#custom_metric_names\n[time.ParseDuration]: https://golang.org/pkg/time/#ParseDuration\n[Releases]: https://github.com/memes/gce-metric/releases\n[cosign]: https://github.com/SigStore/cosign\n[syft]: https://github.com/anchore/syft\n[metric filter]: https://cloud.google.com/monitoring/api/v3/filters#filter_syntax\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmemes%2Fgce-metric","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmemes%2Fgce-metric","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmemes%2Fgce-metric/lists"}