You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Values set via `OTEL_RESOURCE_ATTRIBUTES` take precedence over programmatically set values. This is useful for setting deployment-specific identifiers like `service.instance.id` without modifying code.
72
+
73
+
**Feature Flag Behavior:**
74
+
75
+
-**`metrics` only**: Metrics are served on `:9091/metrics` endpoint using OpenTelemetry PrometheusExporter. No traces or logs sent to OTLP.
76
+
-**`otel` only**: Metrics, traces, and logs are pushed to OTLP endpoint. No `/metrics` endpoint is exposed.
77
+
78
+
> ![NOTE]
79
+
> The `metrics` and `otel` feature flags are **mutually exclusive**. Enabling both will cause the server to exit with an error. Choose one observability mode.
80
+
81
+
**Disabling OpenTelemetry SDK:**
82
+
83
+
To disable OpenTelemetry SDK and prevent telemetry emission while keeping the `otel` feature flag enabled, set the following environment variable:
84
+
```bash
85
+
OTEL_SDK_DISABLED=true
86
+
```
87
+
88
+
This is useful for local development where you want to use Pino stdout logging instead of sending telemetry to an OTLP endpoint.
89
+
44
90
## Start the node
45
91
46
92
### Local Development
@@ -53,15 +99,22 @@ docker compose -f local/docker-compose.yaml up -d
53
99
```
54
100
55
101
This stack includes:
56
-
-**nilDB**: The main API service (port 40080)
102
+
-**nilDB**: The main API service (port 40080, metrics port 40091)
57
103
-**MongoDB**: Database backend (port 40017)
58
104
-**nilauth**: Authentication service for NUC tokens (port 40921)
59
105
-**nilchain**: Local blockchain for testing payments (JSON-RPC port 40648)
60
106
-**PostgreSQL**: Database for nilauth (port 40432)
61
107
-**token-price-api**: Mock token pricing service (port 40923)
108
+
-**otel-collector**: OpenTelemetry collector with debug exporter (OTLP port 40318)
62
109
63
110
The nilDB API will be available at `http://localhost:40080`.
64
111
112
+
The local stack is configured with `APP_ENABLED_FEATURES=openapi,otel,migrations`, which means:
113
+
- Metrics, traces, and logs are sent to the OTel Collector (visible in `docker compose logs otel-collector`)
114
+
- No `/metrics` endpoint is exposed (OTLP push only)
115
+
116
+
To switch to metrics-only mode (serve metrics on `:40091/metrics`), change `otel` to `metrics` in the docker-compose.yaml file.
117
+
65
118
### Production Deployment
66
119
67
120
A nilDB node consists of a MongoDB instance and a RESTful API service. Below is a basic Docker Compose configuration:
@@ -105,10 +158,14 @@ The following endpoints provide operational information:
-`GET :9091/metrics` - Prometheus metrics (internal access only, available when `metrics` feature flag is enabled without `otel`)
109
162
110
163
> ![NOTE]
111
-
> `/metrics` shouldn't be exposed publicly.
164
+
> The `/metrics` endpoint behavior depends on feature flags:
165
+
> -**`metrics` only**: Serves metrics at `:9091/metrics` using OpenTelemetry PrometheusExporter
166
+
> -**`otel` enabled**: No `/metrics` endpoint; all telemetry pushed to OTLP collector
167
+
>
168
+
> The `/metrics` endpoint should never be exposed publicly - use firewall rules or network policies to restrict access to internal monitoring systems only.
0 commit comments