Skip to main content

Crate eyes_subscriber

Crate eyes_subscriber 

Source
Expand description

§Eyes Subscriber

A tracing subscriber for sending structured trace data to Eyes (eyes.coreyja.com).

§Quick Start

use eyes_subscriber::EyesSubscriberBuilder;
use tracing_subscriber::prelude::*;
use uuid::Uuid;

let org_id = Uuid::parse_str("your-org-id")?;
let app_id = Uuid::parse_str("your-app-id")?;

// Simplest: auto-configure from environment variables
let (eyes_layer, shutdown_handle) = EyesSubscriberBuilder::build_from_env(org_id, app_id)?;

tracing_subscriber::registry()
    .with(eyes_layer)
    .init();

// Your application code here
tracing::info!("Application started");

// Graceful shutdown
shutdown_handle.shutdown().await?;

§Configuration

The subscriber can be configured in several ways:

  1. Environment variables (recommended):
    • EYES_URL: Override the default URL (defaults to https://eyes.coreyja.com)
    • EYES_TRANSPORT: Set to “websocket” or “ws” for WebSocket, defaults to HTTP
    • EYES_QUEUE_CAPACITY: Capacity of the bounded event queue (defaults to 65536)
    • EYES_EMIT_ENTER_EXIT: Set to “1” or “true” (case-insensitive) to emit span_enter/span_exit events (disabled by default; see EyesSubscriberBuilder::with_emit_enter_exit)
  2. Default production: Use new_with_default() for https://eyes.coreyja.com
  3. Custom URL: Use new() with any URL for self-hosted instances

§Transports

Three transport methods are available:

  • HTTP (default): Reliable, request/response based
  • BatchingHttp: HTTP with client-side batching for high-volume use cases
  • WebSocket: Lower latency, persistent connection

Structs§

AppManifest
The shape of the application, as reported once at boot.
BatchConfig
Configuration for batching behavior
BatchingHttpTransport
HTTP transport with batching support
CronEntry
A single cron registration: its name and schedule string.
EyesLayer
EyesShutdownHandle
EyesSubscriberBuilder
HttpMonitor
HttpTransport
WebSocketTransport

Enums§

HttpMethod
ManifestError
Error sending a boot manifest.
MonitorTargetError
TransportError
TransportType

Constants§

DEFAULT_QUEUE_CAPACITY
Default capacity of the bounded event queue between the tracing layer and the transport loop. Overridable via EYES_QUEUE_CAPACITY or EyesSubscriberBuilder::with_queue_capacity.
MANIFEST_VERSION
The manifest schema version this crate emits.

Functions§

is_forbidden_monitor_ip
Returns true when an address is not an acceptable monitor egress target. This is shared by declaration validation and the connection-time resolver.
monitor_origin
Return the normalized HTTP origin used for monitor security comparisons.
resolve_monitor_target
Resolve and validate an absolute HTTP(S) URL or a root-relative path.
send_manifest
Send a boot-time manifest to the Eyes server as a one-shot HTTP POST.
send_manifest_from_env
send_manifest, reading the destination from the environment: