Skip to content

🔧 telemetry: make CONNITO_TELEMETRY_PORT actually configurable - #202

Merged
george-connito merged 1 commit into
masterfrom
fix/configurable-telemetry-port
Jul 31, 2026
Merged

🔧 telemetry: make CONNITO_TELEMETRY_PORT actually configurable#202
george-connito merged 1 commit into
masterfrom
fix/configurable-telemetry-port

Conversation

@george-connito

Copy link
Copy Markdown
Collaborator

CONNITO_TELEMETRY_PORT shipped in the validator image but was never read by any code — the exporter port was hardcoded to 8200 + rank. An operator whose host already had 8200 occupied would set the variable, see no effect, and end up with a validator that runs fine on chain while the exporter fails to bind ("Address already in use") and serves nothing. The failure is caught and logged, so the only symptom is silence. This is what took validator slot 5 off the dashboard.

Wiring the code alone would NOT have fixed it — three further pieces were needed, each of which would have reproduced the same "setting does nothing" bug on its own:

  • run.py: new resolve_telemetry_port(rank, env). The var is a base port, not absolute: effective port is base + rank, preserving the semantics of the 8200 default it replaces so a multi-rank host stays collision-free (an absolute override would point every rank at one port and all but one would fail to bind — the very bug being fixed). Invalid input warns and falls back rather than raising: a typo in an operator's .env must not take a validator off chain over a telemetry setting.
  • docker-compose.yml: pass CONNITO_TELEMETRY_PORT into the container. A value in .env only interpolates into the compose file; without an explicit environment: entry it never reaches the process.
  • docker-compose.yml: healthcheck now follows the same variable, so overriding the port doesn't leave the container permanently unhealthy probing a port nothing binds.
  • Dockerfile: comment now documents the real behaviour.

Also removes two decorations that were the same class of trap:

  • CONNITO_DHT_PORT — deliberately NOT wired. The DHT port is already configured by dht.port in validator.yaml, and it is announced to peers; a second competing source of truth could make a validator advertise one port while listening on another, which is a worse failure than the one being fixed. Removed, with a comment pointing at the real knob.
  • CONNITO_STATE_API_PORT + the 8300/tcp EXPOSE — the /v1/state.json API they referenced no longer exists.

Operators overriding the port must open the new port in their firewall.

Tests: 12 new covering default, rank offset, override-as-base, whitespace, non-numeric / out-of-range / float / hostile input fallbacks, and base+rank overflow. Verified in the stable image that the env var now takes effect end to end, and that docker compose config interpolates both the container env and the healthcheck for default and override.

`CONNITO_TELEMETRY_PORT` shipped in the validator image but was never read
by any code — the exporter port was hardcoded to `8200 + rank`. An operator
whose host already had 8200 occupied would set the variable, see no effect,
and end up with a validator that runs fine on chain while the exporter
fails to bind ("Address already in use") and serves nothing. The failure is
caught and logged, so the only symptom is silence. This is what took
validator slot 5 off the dashboard.

Wiring the code alone would NOT have fixed it — three further pieces were
needed, each of which would have reproduced the same "setting does nothing"
bug on its own:

- `run.py`: new `resolve_telemetry_port(rank, env)`. The var is a **base**
  port, not absolute: effective port is `base + rank`, preserving the
  semantics of the 8200 default it replaces so a multi-rank host stays
  collision-free (an absolute override would point every rank at one port
  and all but one would fail to bind — the very bug being fixed). Invalid
  input warns and falls back rather than raising: a typo in an operator's
  `.env` must not take a validator off chain over a telemetry setting.
- `docker-compose.yml`: pass `CONNITO_TELEMETRY_PORT` into the container.
  A value in `.env` only interpolates into the compose file; without an
  explicit `environment:` entry it never reaches the process.
- `docker-compose.yml`: healthcheck now follows the same variable, so
  overriding the port doesn't leave the container permanently unhealthy
  probing a port nothing binds.
- `Dockerfile`: comment now documents the real behaviour.

Also removes two decorations that were the same class of trap:
- `CONNITO_DHT_PORT` — deliberately NOT wired. The DHT port is already
  configured by `dht.port` in validator.yaml, and it is announced to peers;
  a second competing source of truth could make a validator advertise one
  port while listening on another, which is a worse failure than the one
  being fixed. Removed, with a comment pointing at the real knob.
- `CONNITO_STATE_API_PORT` + the `8300/tcp` EXPOSE — the /v1/state.json API
  they referenced no longer exists.

Operators overriding the port must open the new port in their firewall.

Tests: 12 new covering default, rank offset, override-as-base, whitespace,
non-numeric / out-of-range / float / hostile input fallbacks, and
base+rank overflow. Verified in the stable image that the env var now takes
effect end to end, and that `docker compose config` interpolates both the
container env and the healthcheck for default and override.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@george-connito
george-connito merged commit 3425d0d into master Jul 31, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants