Watch
0
0
Fork
You've already forked hyperhive
0

every hive runs its otel collector, and agents export to it by default

This commit is contained in:
atlas 2026-10-18 23:17:28 +02:00 • committed by mara
commit 13daf4c7dc
28 changed files with 245 additions and 303 deletions

View file

@ -1,5 +1,5 @@
# OpenTelemetry wiring for an agent container: the per-agent options the
# meta flake injects (host-driven from `services.hyperhive.otel.*`) plus
# OpenTelemetry wiring for an agent container: the per-agent options (on by
# default, exporting to the hive's collector by name) plus
# `debug`, which the agent's own config sets, the
# environment every OTLP producer inside the container reads, and the
# collector that forwards this container's journal to the hive.
@ -71,35 +71,35 @@ let
logExporter = if cfg.protocol == "grpc" then "otlp" else "otlphttp";
in
{
# OTEL stats export is configured ONCE at host level via
# `services.hyperhive.otel.*` (see nix/host-modules/otel.nix) and
# injected into every agent's build by the meta-flake renderer
# (`hive-c0re/src/meta.rs::otel_config`). These per-agent options are
# the build-time implementation surface that injection writes into;
# they are not meant to be set directly in an agent.nix. Marked
# `internal` so the host option is the only documented operator knob.
# On by default: every hive runs a collector and answers
# `hive-collector.hive` with its own bridge address, so the endpoint below
# is the same string in every agent on every hive and nothing is rendered
# into the meta flake. The port is the literal the host fixes at
# `services.hyperhive.swarm.hiveOtel.collectorPort` (read-only there).
# Marked `internal`: these are not meant to be set in an agent.nix, except
# `debug`.
options.services.hyperhive.agent.otel = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
default = true;
internal = true;
description = ''
Export this agent's telemetry — Claude Code's stats (token
usage, cost, tool calls) and anything pushed with
`hive-metric` — to an OTLP endpoint. Each agent exports
directly to the hive's collector, so it keeps working even when
hive-c0re is down. Host-driven: set
`services.hyperhive.otel.enable` instead.
`hive-metric` — to the hive's collector. Each agent exports
directly to it, so it keeps working even when hive-c0re is
down.
'';
};
endpoint = lib.mkOption {
type = lib.types.str;
default = "";
default = "http://hive-collector.hive:4318";
internal = true;
description = ''
OTLP collector endpoint, set as `OTEL_EXPORTER_OTLP_ENDPOINT`.
Host-driven via `services.hyperhive.otel.endpoint`.
The name is the one `services.hyperhive.otel.collector.host`
holds, which the hive's resolver answers.
'';
};
@ -113,7 +113,8 @@ in
internal = true;
description = ''
OTLP wire protocol, set as `OTEL_EXPORTER_OTLP_PROTOCOL`.
Host-driven via `services.hyperhive.otel.protocol`.
The hive collector's receiver speaks OTLP/HTTP protobuf, so
the default is the only value that reaches it.
'';
};