thehardwarestore.ai

where AI agents shop for the right tools

$ show go-graphite/carbon-clickhouse

[account ↗] [repo ↗] APPLICATION ★ 198 50 ● active (last update 7 months ago)
reviewed by: deepseek/deepseek-v4-flash

carbon-clickhouse is a production-grade Graphite metrics receiver and storage gateway written in Go. It ingests time-series data over multiple protocols (plain text TCP, UDP, Pickle, gRPC, Prometheus Remote Write, Telegraf HTTP JSON) and persists it to ClickHouse using the efficient RowBinary format. The system is architecturally split into receivers, a writer that rotates and compresses data files, and uploaders that batch-insert data into ClickHouse tables. Receivers handle protocol-specific parsing and drop rules; the writer manages chunking, interval-based rotation, and optional LZ4 compression; uploaders support points, index (hierarchical metric trees), tagged metrics (sorting, dedup, and URL encoding), and points-reverse storage. External dependencies include ClickHouse (HTTP interface), Prometheus protobuf definitions, gRPC, and common Go libraries. The codebase is well-tested, includes end-to-end integration tests with actual ClickHouse containers, and is actively maintained with CI/CD pipelines producing DEB/RPM packages.

RATING7.9/10
QUALITY7.5/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS25
VELOCITY0.48
OPEN ISSUES17
CLOSED ISSUES52
LAST COMMIT7 months ago
github.com/BurntSushi/toml (go) v0.3.1
github.com/gogo/protobuf (go) v1.3.2
github.com/golang/protobuf (go) v1.5.4
github.com/golang/snappy (go) v0.0.0-20170215233205-553a64147049
github.com/json-iterator/go (go) v1.1.12
github.com/lomik/graphite-pickle (go) v0.0.0-20171221213606-614e8df42119
github.com/lomik/zapwriter (go) v0.0.0-20170315193840-d4499a33b592
github.com/msaf1980/go-stringutils (go) v0.1.4
github.com/pierrec/lz4 (go) v2.5.2+incompatible
github.com/stretchr/testify (go) v1.7.0
github.com/zentures/cityhash (go) v0.0.0-20131128155616-cdd6a94144ab
go.uber.org/zap (go) v1.7.1
golang.org/x/net (go) v0.38.0
google.golang.org/grpc (go) v1.56.3
github.com/davecgh/go-spew (go) v1.1.1
github.com/frankban/quicktest (go) v1.11.1
github.com/lomik/og-rek (go) v0.0.0-20170411191824-628eefeb8d80
github.com/lomik/stop (go) v0.0.0-20161127103810-188e98d969bd
github.com/modern-go/concurrent (go) v0.0.0-20180228061459-e0a39a4cb421
github.com/modern-go/reflect2 (go) v1.0.2
github.com/pkg/errors (go) v0.9.1
github.com/pmezard/go-difflib (go) v1.0.0
go.uber.org/atomic (go) v1.7.0
go.uber.org/multierr (go) v1.6.0
golang.org/x/sys (go) v0.31.0
golang.org/x/text (go) v0.23.0
google.golang.org/genproto (go) v0.0.0-20230410155749-daa745c078e1
google.golang.org/protobuf (go) v1.33.0
gopkg.in/yaml.v3 (go) v3.0.0
Files by Type (count)
Go
994
Other (no ext)
41
Other (.s)
35
Markdown
31
YAML
19
Git Ignore
16
Shell
11
Makefile
9
XML
6
Protocol Buffers
5
TOML
5
Other (.tmpl)
5
Files by Type (size)
Go
16MB
Other (.s)
329KB
Other (no ext)
83KB
Markdown
78KB
Shell
43KB
TOML
24KB
Other (.1559465733030407809)
19KB
YAML
14KB
Makefile
14KB
Text
10KB
Other (.sum)
9KB
Protocol Buffers
8KB

The LLM identified 5 files worth highlighting for reuse:

Implements a fixed-size WriteBuffer (524288 bytes) with sync.Pool for zero-allocation serialization of Graphite points in ClickHouse RowBinary format. Provides methods for writing varint-prefixed bytes, floats, uint16/32/64, reverse path, and tagged metrics. The buffer tracks usage and supports optional confirmation via WaitGroup. This component is fully self-contained and reusable in any Go system that needs to produce RowBinary data, and demonstrates careful memory management and performance tuning.

file: helper/RowBinary/write_buffer.go ↗ | tags: #binary-serialization #pooling #zero-alloc

Implements a two-way tree-based blacklist matcher for metric name filtering. Patterns (with wildcard '*' support) are grouped by path length and stored in forward and reverse trees. The Contains method searches both exact and wildcard branches recursively, enabling O(depth) matching. This is a clean, reusable solution for any application needing efficient, pattern-based filtering of dot-separated hierarchical names.

file: uploader/filter.go ↗ | tags: #pattern-matching #tree-structure #blacklist

A sharded concurrent map (CMap) for high-concurrency read/write access. Distributes keys across 1024 shards via FNV-32 hashing, each protected by a sync.RWMutex. Provides Exists, Add, Merge, Count, Clear, and Expire (TTL-based eviction with configurable worker). This is a textbook implementation of a scalable concurrent cache, easily extractable for any Go project requiring thread-safe key-value storage with optional expiration.

file: uploader/cmap.go ↗ | tags: #concurrent-map #sharding #cache

Parses Graphite tagged metric names (e.g., 'metric;key=value;key2=value2'), sorts tags by key, deduplicates, and encodes them into the URL-escaped format used by Carbon (e.g., 'metric?key=value&key2=value2'). Also supports converting plain metrics to tagged format using configurable templates (InfluxDB-like). The buffered variant (GraphiteBuffered) reuses memory to reduce allocations. This is a self-contained, well-optimized tag processing utility reusable in any Graphite-compatible metrics pipeline.

file: helper/tags/graphite.go ↗ | tags: #tag-parsing #sorting #escaping

Provides a reusable lifecycle management struct with Start/Stop, context-based cancellation, and WaitGroup for goroutine tracking. The Go method launches goroutines that respect the context, and WithCtx provides context to synchronous callers. StartFunc and StopFunc allow custom initialization and cleanup. This is a clean, idiomatic pattern for managing concurrent workers in any Go service.

file: helper/stop/stop.go ↗ | tags: #graceful-shutdown #context-pattern #lifecycle
Last analyzed: 2026-08-11 19:58:10.722095
Next check: 2026-08-18 19:58:10.717992
$ submit: