Skip to content

Deploy the collector

The ctxflow collector is an OpenTelemetry Collector distribution built from upstream core and contrib components. No fork and no processor of its own. You do not need it to use ctxflow: the SDK can send directly (Where to send). It is the recommended topology for production, because the API key lives in the collector only and the apps know just its address; for a first test or a single app, sending directly gives the same data. Run it when you want:

  • the API key in one place: apps only know the collector address;
  • one place for your own rules: the upstream transform, attributes and filter processors are built in (Processors), and apps in any language can send OTLP to it.

Text passes through unchanged: the collector does not remove or change it.

app (SDK or any OTLP) ──OTLP──► collector :4317 gRPC / :4318 HTTP ──OTLP/HTTP + key──► ctxflow /v1/traces

Images for linux/amd64 and linux/arm64, distroless and non-root. Pin the version tag (see Install sources):

Terminal window
docker pull ghcr.io/ctxflow-sh/ctxflow-collector:0.2.2
docker run -d --name ctxflow-collector --memory 512m \
-p 4317:4317 -p 4318:4318 -p 13133:13133 \
-e CTXFLOW_CORE_ENDPOINT=https://app.ctxflow.sh \
-e CTXFLOW_API_KEY=<your key> \
ghcr.io/ctxflow-sh/ctxflow-collector:0.2.2

The image is public: docker pull needs no login. It holds /etc/ctxflow/config.yaml, the default config, loaded when you pass no --config.

  • --memory is needed: the memory limiter works on a percentage of the container limit.
  • No shell in the image: check that no variable is empty before docker run. Every variable a config reads must be set.
  • Release binaries are not published: use the image.
  • Upgrading from an earlier version: a config of your own that lists the usage processor does not start with the new image. Remove it first: Processors.
services:
collector:
image: ghcr.io/ctxflow-sh/ctxflow-collector:${CTXFLOW_TAG:-0.2.2}
command: [--config=/etc/ctxflow/config.yaml]
environment:
CTXFLOW_CORE_ENDPOINT: ${CTXFLOW_CORE_ENDPOINT:?set the core URL}
CTXFLOW_API_KEY: ${CTXFLOW_API_KEY:?set the environment API key}
ports: ["127.0.0.1:4317:4317", "127.0.0.1:4318:4318", "127.0.0.1:13133:13133"]
mem_limit: 512m
restart: unless-stopped

Save it as docker-compose.yml, then:

Terminal window
export CTXFLOW_CORE_ENDPOINT=https://app.ctxflow.sh CTXFLOW_API_KEY=<your key>
docker compose up -d

Set CTXFLOW_TAG to use another image tag (default 0.2.2).

Variable Meaning
CTXFLOW_CORE_ENDPOINT Base URL of ctxflow: https://app.ctxflow.sh. The collector sends to <endpoint>/v1/traces. Use https:// (TLS verification is on).
CTXFLOW_API_KEY API key of the environment, sent as Authorization: Bearer <key>.
Port Use
4317 OTLP gRPC
4318 OTLP HTTP (/v1/traces)
13133 Health check

Run it in a private network. The OTLP receivers have no authentication or TLS. Only your own apps should reach it.

Terminal window
export OTEL_SERVICE_NAME=my-agent
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 # or http://<collector-host>:4318

No API key in the app: the collector adds it.

Terminal window
curl -s localhost:13133 # {"status":"Server available", ...}

The health check only says the process is up. It stays green when ctxflow is unreachable or rejects the key: the exporter drops the batch and logs it. The image has no shell, so it cannot run a probe either. Run ctxflow-otel check with the collector’s CTXFLOW_CORE_ENDPOINT and CTXFLOW_API_KEY on any host that reaches ctxflow (Verify your setup), and look in the collector log for 401 or context deadline exceeded. In the app, a rejected key shows on the key list (“Rejected 2 min ago · revoked”).

The collector in Docker must reach CTXFLOW_CORE_ENDPOINT. With the hosted app (https://app.ctxflow.sh) there is nothing to do. For a ctxflow server on the Docker host, pick the address by where it runs:

ctxflow runs Use
On the Docker host, default bridge network http://host.docker.internal:<port> plus --add-host=host.docker.internal:host-gateway (needed on Linux)
On the Docker host, with a user-defined network (compose, docker network create) host.docker.internal may not be reachable from there. Put ctxflow in the same network and use its service name, or on Linux run the collector with --network host and use http://localhost:<port> (-p is then ignored)

For local tests only, add a second config file that turns off certificate verification of the exporter:

config.local.yaml
exporters:
otlp_http/core:
tls:
insecure_skip_verify: true
Terminal window
docker run -d --name ctxflow-collector --memory 512m \
--add-host=host.docker.internal:host-gateway \
-p 4317:4317 -p 4318:4318 -p 13133:13133 \
-v "$PWD/config.local.yaml:/etc/ctxflow/config.local.yaml:ro" \
-e CTXFLOW_CORE_ENDPOINT=https://host.docker.internal:3443 \
-e CTXFLOW_API_KEY=<your key> \
ghcr.io/ctxflow-sh/ctxflow-collector:0.2.2 \
--config=/etc/ctxflow/config.yaml --config=/etc/ctxflow/config.local.yaml

A core on plain http:// (for example http://localhost:3000) works with the default config as it is; the key then travels in clear text, so local only.