Skip to content

Verify your setup

Run this before you look for data in the app. It finds a wrong key, a wrong URL or a wrong environment in a few seconds, and it sends no data.

ctxflow-otel check comes with the Python SDK (also python -m ctxflow_otel check). It reads the same variables as your app, so run it in the same shell or container:

Terminal window
export OTEL_EXPORTER_OTLP_ENDPOINT=https://app.ctxflow.sh
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer%20<your key>"
ctxflow-otel check

It prints one line per check, starting with ok:, warn: or FAIL:. The exit code is 0 when nothing failed and 1 otherwise.

ok: config: ok
ok: exporter sends to the ctxflow core at https://app.ctxflow.sh/v1/traces, key accepted
ok: identity: key targets project "Support Bot", environment "Development", last event 3 min ago
warn: identity: key targets environment "Development" (development), not production: data sent with this key shows only there. For production data, create a key in the project's Production environment.
Check What it tells you
config The CTXFLOW_* variables are valid (the same rules as init(), see Configuration).
exporter The traces URL of the SDK. When it is ctxflow, ctxflow must accept the key. When it is your collector, the collector must accept an empty request. 401, 403, a redirect or no answer fail the check.
core Only when CTXFLOW_CORE_ENDPOINT and CTXFLOW_API_KEY are set (the settings of a collector): ctxflow must answer and accept that key.
identity Which project and environment the key sends to, and when data last arrived there.

The identity line is the one to read. If it names Production when you meant Development, you have the wrong key. When the key belongs to a Development or Staging environment, a second identity line warns that the data does not reach Production; it does not change the exit code. An environment you created yourself gets no warning, and neither does an older ctxflow server that does not report the environment kind. no events yet means nothing arrived in that environment so far. If your ctxflow server does not offer the identity request, you get a warn: line and the other checks are unchanged. The identity request (/v1/whoami) is read-only: it stores nothing and does not count as a use of the key.

The environment comes from the key, and only from the key: a key sends to the one environment it was created in (see API keys). Nothing in your app selects it: deployment.environment, OTEL_RESOURCE_ATTRIBUTES and OTEL_SERVICE_NAME do not route data to another environment. The identity line of check is how you see it from the app side.

If it names an environment other than the one you meant (for example Development when you want Production):

  1. In the app, open the project page, find the API keys card of the right environment and create a key there (owners, admins and members can). If you cannot, ask someone who can.
  2. Put the new key in your configuration (OTEL_EXPORTER_OTLP_HEADERS, or CTXFLOW_API_KEY for a collector).
  3. Run ctxflow-otel check again and read the identity line.

Data already sent with the old key stays in the environment it went to.

The command never prints header values, keys or URL query strings. A request that gets no answer within 10 seconds fails, so a full check takes at most about a minute when everything hangs.

On any host that can reach ctxflow, run the check with the variables of the collector:

Terminal window
CTXFLOW_CORE_ENDPOINT=https://app.ctxflow.sh CTXFLOW_API_KEY=<your key> ctxflow-otel check

The collector health check (:13133) only says the collector process is up. It stays green when ctxflow is unreachable or rejects the key, so use this check instead. See Deploy the collector.

An empty OTLP request with a valid key proves the URL and the key:

Terminal window
curl -s -o /dev/null -w '%{http_code}\n' -X POST https://app.ctxflow.sh/v1/traces \
-H "Authorization: Bearer <your key>" -H 'Content-Type: application/json' \
-d '{"resourceSpans":[]}'
# 200 = accepted, 401 = wrong, revoked or missing key

This request counts as a use of the key: the key list shows a new “Last used” time. ctxflow-otel check and the identity request below do not.

The same check for the identity of the key:

Terminal window
curl -s https://app.ctxflow.sh/v1/whoami -H "Authorization: Bearer <your key>"
# {"project":{"name":"..."},"environment":{"name":"..."},"lastEventAt":null}

The answer, its fields and its status codes are described on OTLP endpoint. The request is read-only.

Line What to do
exporter endpoint unreachable ... connection refused Nothing listens at that URL. Check OTEL_EXPORTER_OTLP_ENDPOINT (the default is http://localhost:4318, a collector) and, for a collector, that it runs.
exporter endpoint rejected the key (401) The key is wrong, revoked or missing. Check OTEL_EXPORTER_OTLP_HEADERS (Authorization=Bearer%20<key>, the space is %20).
CTXFLOW_CORE_ENDPOINT rejected the key (401) The key in CTXFLOW_API_KEY is wrong or revoked.
redirect (...) not followed The URL redirects. The key is never sent to another host: use the final URL.
exporter endpoint at ... answered HTTP ... (warn:) An endpoint that is not ctxflow answered with an unexpected status. Check the URL.
TLS certificate not trusted A self-signed certificate: see local core.

More symptoms: Troubleshooting. Next: send a trace (Quickstart) and look at First trace.