{"id":13581895,"url":"https://github.com/go-graphite/carbonapi","last_synced_at":"2025-05-15T08:07:57.366Z","repository":{"id":19012145,"uuid":"22234992","full_name":"go-graphite/carbonapi","owner":"go-graphite","description":"Implementation of graphite API (graphite-web) in golang","archived":false,"fork":false,"pushed_at":"2025-02-16T14:28:32.000Z","size":47236,"stargazers_count":314,"open_issues_count":91,"forks_count":143,"subscribers_count":25,"default_branch":"main","last_synced_at":"2025-04-14T12:18:05.278Z","etag":null,"topics":["carbon","carbonapi","carbonzipper","go","graphite","graphite-clickhouse","graphite-web","monitoring","prometheus","timeseries","zipper"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/go-graphite.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","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":"2014-07-24T22:46:07.000Z","updated_at":"2025-04-02T07:32:51.000Z","dependencies_parsed_at":"2023-02-16T18:15:40.939Z","dependency_job_id":"487b6150-3987-4224-bcf3-abc6352245b0","html_url":"https://github.com/go-graphite/carbonapi","commit_stats":{"total_commits":2207,"total_committers":112,"mean_commits":"19.705357142857142","dds":0.742183960126869,"last_synced_commit":"cdab347e39e6c2fc231d1ceadb2c0dd2cb36cf34"},"previous_names":["dgryski/carbonapi"],"tags_count":74,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-graphite%2Fcarbonapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-graphite%2Fcarbonapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-graphite%2Fcarbonapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-graphite%2Fcarbonapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/go-graphite","download_url":"https://codeload.github.com/go-graphite/carbonapi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248877967,"owners_count":21176244,"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":["carbon","carbonapi","carbonzipper","go","graphite","graphite-clickhouse","graphite-web","monitoring","prometheus","timeseries","zipper"],"created_at":"2024-08-01T15:02:18.398Z","updated_at":"2025-04-14T12:18:15.541Z","avatar_url":"https://github.com/go-graphite.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"carbonapi: replacement graphite API server\n------------------------------------------\n\n[![Build Status](https://travis-ci.org/go-graphite/carbonapi.svg?branch=master)](https://travis-ci.org/go-graphite/carbonapi)\n[![GoDoc](https://godoc.org/github.com/go-graphite/carbonapi?status.svg)](https://godoc.org/github.com/go-graphite/carbonapi)\n\nWe are using \u003ca href=\"https://packagecloud.io/\"\u003e\u003cimg alt=\"Private Maven, RPM, DEB, PyPi and RubyGem Repository | packagecloud\" height=\"46\" src=\"https://packagecloud.io/images/packagecloud-badge.png\" width=\"158\" /\u003e\u003c/a\u003e to host our packages!\n\nCarbonAPI supports a significant subset of graphite functions [see [COMPATIBILITY](COMPATIBILITY.md)].\nIn our testing it has shown to be 5x-10x faster than requesting data from graphite-web.\n\nFor requirements see **Requirements** section below.\n\nInstallation\n------------\n\nAt this moment we are building packages for CentOS 7, Rockylinux 8 (should be compatible with RHEL 8), Debian 10, Debian 11, Debian 12 (testing), Ubuntu 18.04, Ubuntu 20.04, Ubuntu 22.04. Installation guides are available on packagecloud (see the links below).\n\nStable versions: [Stable repo](https://packagecloud.io/go-graphite/stable/install)\n\nAutobuilds (master, might be unstable): [Autobuild repo](https://packagecloud.io/go-graphite/autobuilds/install)\n\nConfiguration guides: [docs/configuration.md](https://github.com/go-graphite/carbonapi/blob/master/doc/configuration.md) and [example config](https://github.com/go-graphite/carbonapi/blob/master/cmd/carbonapi/carbonapi.example.yaml).\n\nThere are multiple example configurations available for different backends: [prometheus](https://github.com/go-graphite/carbonapi/blob/master/cmd/carbonapi/carbonapi.example.prometheus.yaml), [graphite-clickhouse](https://github.com/go-graphite/carbonapi/blob/master/cmd/carbonapi/carbonapi.example.clickhouse.yaml), [go-carbon](https://github.com/go-graphite/carbonapi/blob/master/cmd/carbonapi/carbonapi.example.yaml), [victoriametrics](https://github.com/go-graphite/carbonapi/blob/master/cmd/carbonapi/carbonapi.example.victoriametrics.yaml), [IRONdb](https://github.com/go-graphite/carbonapi/blob/master/cmd/carbonapi/carbonapi.example.irondb.yaml)\n\nGeneral information\n-------------------\n\nCarbonapi can be configured by environment variables or by config file. For an example see `carbonapi.example.yaml`\n\n`$ ./carbonapi -config /etc/carbonapi.yaml`\n\nRequest metrics will be dumped to graphite if corresponding config options are set,\nor if the GRAPHITEHOST/GRAPHITEPORT environment variables are found.\n\nRequest data will be stored in memory (default) or in memcache.\n\nConfiguration is described in [docs](https://github.com/go-graphite/carbonapi/blob/master/doc/configuration.md)\n\n## Configuration by environment variables\n\nEvery parameter in config file are mapped to environment variable. I.E.\n\n```yaml\nconcurency: 20\ncache:\n   # Type of caching. Valid: \"mem\", \"memcache\", \"null\"\n   type: \"mem\"\nupstreams:\n    backends:\n        - \"http://10.0.0.1:8080\"\n        - \"http://10.0.0.2:8080\"\n```\nThat config can be replaced by\n\n```bash\nCARBONAPI_CONCURENCY=20\nCARBONAPI_CACHE_TYPE=mem\nCARBONAPI_UPSTREAMS_BACKENDS=\"http://10.0.0.1:8080 http://10.0.0.2:8080\"\n```\n\nYou should be only aware of logging: because carbonapi support a list of logger, env variables will replace\nonly first logger.\n\nIf you apply variable `LOGGER_FILE=stdout` to config:\n\n```yaml\nlogger:\n    - logger: \"\"\n      file: \"stderr\"\n      level: \"debug\"\n      encoding: \"console\"\n      encodingTime: \"iso8601\"\n      encodingDuration: \"seconds\"\n    - logger: \"\"\n      file: \"carbonapi.log\"\n      level: \"info\"\n      encoding: \"json\"\n```\n\nit will be equal to config:\n\n```yaml\nlogger:\n    - logger: \"\"\n      file: \"stdout\" # Changed only here\n      level: \"debug\"\n      encoding: \"console\"\n      encodingTime: \"iso8601\"\n      encodingDuration: \"seconds\"\n    - logger: \"\"\n      file: \"carbonapi.log\" # Not changed\n      level: \"info\"\n      encoding: \"json\"\n```\n\nSupported protocols\n-------------------\n\n * `auto` - carbonapi will do it's best to determine backend's protocol. Currently it can identify only `carbonapi_v2_pb` or `carbonapi_v3_pb`\n * `carbonapi_v2_pb`, `pb`, `pb3`, `protobuf` - carbonapi \u003c0.11 style protocol. Supported by [go-carbon](https://github.com/go-graphite/go-carbon) and [graphite-clickhouse](https://github.com/lomik/graphite-clickhouse) older or equal version v0.11.7\n * `carbonapi_v3_pb` - new carbonapi protocol, that supports passing metadata through. Supported by carbonzipper \u003e=1.0.0.alpha.3, [graphite-clickhouse](https://github.com/lomik/graphite-clickhouse) newer then v0.12.0 and go-carbon newer then v0.13.0\n * `carbonapi_v3_grpc` - grpc version of new carbonapi protocol. Currently no known implementation exists.\n * `msgpack` - messagepack based protocol, used in graphite-web 1.1 and metrictank. It's still experimental and might contain bugs.\n * `prometheus` - prometheus HTTP API\n * `victoriametrics` - special version of prometheus backend to use with [VictoriaMetrics](https://github.com/VictoriaMetrics/VictoriaMetrics).\n * `irondb` - supports reading Graphite-compatible metrics from [IRONdb](https://docs.circonus.com/irondb/) from [Circonus](https://www.circonus.com/).\n\n\nRequirements\n------------\n\nGolang compatibility matrix:\n\n| Golang Version | Last supported carbonapi version |\n|----------------|----------------------------------|\n| 1.10           | 0.10.0.1                         |\n| 1.12           | 0.12.6                           |\n| 1.16 / 1.17    | 0.15.6                           |\n| 1.18           | 0.16.0-patch2                    |\n| 1.20           | 0.16.1                           |\n| 1.21           | 0.17.0                           |\n\nOverall rule of thumb is that carbonapi supports last 2 major go versions. E.x. at this moment Go 1.22 and 1.21 are supported.\n\nYou can verify current versions that are being tested in [CI Configuration](https://github.com/go-graphite/carbonapi/blob/main/.github/workflows/tests.yml#L14).\n\nCarbonAPI uses protobuf-based protocol to talk with underlying storages. For current version the compatibility list is:\n\n1. [go-carbon](https://github.com/lomik/go-carbon) \u003e= 0.9.0 (Note: you need to enable carbonserver in go-carbon). Recommended to run latest version, that currently supports `carbonapi_v3_pb`\n2. [graphite-clickhouse](https://github.com/lomik/graphite-clickhouse) any. That's alternative storage that doesn't use Whisper.\n3. [metrictank](https://github.com/grafana/metrictank) - supported via `msgpack` protocol. Support is not very well tested and might contain bugs. Use with cautions. Tags are not supported.\n4. [carbonapi](https://github.com/go-graphite/carbonapi) \u003e= 0.5. Note: starting from carbonapi 1274333ebd1fe50946cb4d51561e3e0f1060bc79 separate binary of carbonzipper is deprecated.\n5. [carbonserver](https://github.com/grobian/carbonserver)@master (Note: you should probably switch to go-carbon in that case).\n6. [carbonzipper](https://github.com/go-graphite/carbonzipper) \u003e= 0.50. **Please note**, carbonzipper functionality was merged to carbonapi and it's no longer needed to run separate zipper.\n\nSupported architectures and OSs\n-------------------------------\n\nCurrently building is tested regularly on amd64 (automated) and arm64 (manual) only. However from time to time, riscv64 is also tested manually.\n\nFor OS support: **Linux** is the only OS that is well tested for production usage. Theoretically nothing prevents from running carbonapi on **\\*BSD**, however its not tested by developers (but bugs will be accepted and eventually fixed). Running on **macos** is supported for testing purposes but it is not tested for any production use case. Other platforms are not tested and not supported.\n\nFor any other OS or Architectures bugs **won't be actively worked on**, but PRs that fixes the OS and doesn't break any other supported platforms are more than welcome.\n\nSome remarks on different backends\n----------------------------------\n\nFor backends that uses proper database (e.x. `graphite-clickhouse`) you should set `maxBatchSize: 0` in your config file for this backend group.\n\nFor other backends (e.x. go-carbon) you should set it to some reasonable value. It increases response speed, but the cost is increased memory consumption.\n\nTag support was only tested with `graphite-clickhouse`, however it should work with any other database.\n\nInternal Metrics\n----------------------------------\nThe internal metrics are configured inside the [graphite](https://github.com/go-graphite/carbonapi/blob/main/doc/configuration.md#graphite) subsection and sent to your destinated host on an specified interval. The metrics are:\n\n| Metric Name | Description |\n| ----------- | ----------- |\n| cache_items | if caching is enabled, this metric will contain many metrics are stored in cache |\n| cache_size | configured query cache size in bytes |\n| request_cache_hits | how many requests were served from cache. (this is for requests to /render endpoint) |\n| request_cache_misses | how many requests were not in cache. (this is for requests to /render endpoint) |\n| request_cache_overhead_ns | how much time in ns it took to talk to cache (that is useful to assess if cache actually helps you in terms of latency) (this is for  |requests to /render endpoint)\n| find_requests | requests server by endpoint /metrics/find |\n| requests | requests served by endpoint /render |\n| requests_in_XX_to_XX | request response times in percentiles |\n| timeouts | number of timeouts while fetching from backend |\n| backend_cache_hits | how many requests were not read from backend |\n| backend_cache_misses | how many requests were not found in the backend |\n\nOSX Build Notes\n---------------\nSome additional steps may be needed to build carbonapi with cairo rendering on MacOSX.\n\nInstall cairo:\n\n```\n$ brew install Caskroom/cask/xquartz\n\n$ brew install cairo --with-x11\n```\n\nAcknowledgement\n---------------\nThis program was originally developed for Booking.com.  With approval\nfrom Booking.com, the code was generalised and published as Open Source\non github, for which the author would like to express his gratitude.\n\nBooking.com's Fork\n------------------\n\nIn summer 2018, Booking.com forked version 0.11 of carbonapi and continued development in their own repo: [github.com/bookingcom/carbonapi](https://github.com/bookingcom/carbonapi).\n\nLicense\n-------\n\nThis code is licensed under the BSD-2 license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-graphite%2Fcarbonapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgo-graphite%2Fcarbonapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-graphite%2Fcarbonapi/lists"}