Skip to main content

Crate graphyne

Crate graphyne 

Source
Expand description

§Graphyne

A simple, reliable Rust client for sending metrics to Graphite Carbon daemons.

Graphyne provides a straightforward API for sending time-series metrics to Graphite using either the plaintext TCP or UDP protocol. It features automatic reconnection (TCP), configurable retry logic, and an ergonomic builder pattern for easy configuration.

§Quick Start

use graphyne::{GraphiteClient, GraphiteMessage, Protocol};
use std::time::Duration;

// Create a TCP client (default)
let mut client = GraphiteClient::builder()
    .address("127.0.0.1")
    .port(2003)
    .build()?;

// Or create a UDP client
let mut udp_client = GraphiteClient::builder()
    .address("127.0.0.1")
    .port(2003)
    .protocol(Protocol::Udp)
    .build()?;

// Send a metric
let message = GraphiteMessage::new("my.metric.path", "42");
client.send_message(&message)?;

§Features

  • Builder Pattern: Intuitive, type-safe configuration
  • TCP & UDP Support: Choose between reliable TCP or high-performance UDP
  • Auto-reconnection: Automatic retry and reconnection on failure (TCP)
  • Zero-copy Writes: Efficient metric transmission
  • Timestamp Generation: Automatic Unix timestamp creation

§Protocol

Graphyne uses the Graphite plaintext protocol over TCP or UDP. Each metric is formatted as:

metric.path.name value timestamp\n

For example:

servers.web01.cpu.usage 45.2 1609459200\n

Structs§

GraphiteClient
A client for sending metrics to a Graphite Carbon daemon.
GraphiteClientBuilder
Use builder syntax to set the inputs and finish with build().
GraphiteError
Error type for Graphite client operations.
GraphiteMessage
A metric message to be sent to Graphite.

Enums§

Protocol
Protocol to use for sending metrics to Graphite.