Skip to content

vultr/graphyne

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔥 Graphyne

Crates.io Documentation License

A blazingly fast, ergonomic Rust client for sending metrics to Graphite Carbon daemons.

✨ Features

  • 🎯 Simple API - Intuitive builder pattern for easy configuration
  • 🔄 Auto-reconnection - Automatic retry logic with configurable attempts
  • ⚡ Zero-copy writes - Efficient metric transmission with minimal overhead
  • 🛡️ Type-safe - Leverages Rust's type system for compile-time guarantees
  • ⏱️ Configurable timeouts - Fine-grained control over connection behavior
  • 📊 Real-time metrics - Unix timestamp generation for accurate time-series data

🚀 Quick Start

Add Graphyne to your project:

cargo add graphyne

📖 Usage

Basic Example

use graphyne::{GraphiteClient, GraphiteMessage};

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

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

Advanced Configuration

use graphyne::GraphiteClient;
use std::time::Duration;

let mut client = GraphiteClient::builder()
    .address("127.0.0.1")
    .port(2003)
    .retries(5)                       // Optional
    .timeout(Duration::from_secs(10)) // Optional
    .build()?;

Sending Multiple Metrics

use graphyne::{GraphiteClient, GraphiteMessage};

let mut client = GraphiteClient::builder()
    .address("127.0.0.1")
    .port(2003)
    .build()?;

// Send various application metrics
let metrics = vec![
    GraphiteMessage::new("app.cpu.usage", "45.2"),
    GraphiteMessage::new("app.memory.bytes", "1048576"),
    GraphiteMessage::new("app.requests.latency", "125"),
];

for metric in &metrics {
    client.send_message(metric)?;
}

Connection Behavior

  • Automatic reconnection: If a send fails, the client automatically attempts to reconnect
  • Retry logic: Configurable number of retry attempts for both connection and send operations
  • Graceful shutdown: Connections are properly closed when the client is dropped

⚠️ Known Limitations

  • IP addresses only: Currently only supports IP addresses, not DNS hostnames
  • TCP only: Uses TCP plaintext protocol (port 2003 by default)
  • No UDP support: UDP protocol is not yet supported
  • No batching: Each message is sent individually

🤝 Contributing

We welcome contributions! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development

# Run tests
cargo test

# Check formatting
cargo fmt --check

# Run clippy
cargo clippy -- -D warnings

📜 License

Licensed under the Apache License, Version 2.0. See LICENSE for details.

🙏 Acknowledgments

Built with ❤️ by the Vultr Core Cloud Engineering team.

📚 Additional Resources


Made with 🦀 Rust | Maintained by Vultr

About

The only kind of graphite that rusts.

Resources

License

Code of conduct

Stars

Watchers

Forks

Contributors 2

  •  
  •  

Languages