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
Copy file name to clipboardExpand all lines: CONFIG.md
+86-22Lines changed: 86 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -199,9 +199,7 @@ log:
199
199
#### `plugins.otelsetup`
200
200
**Type**: `object`
201
201
**Required**: No
202
-
**Description**: OpenTelemetry configuration controlling whether the Prometheus exporter is enabled.
203
-
204
-
**Important**: This block is optional—omit it to run without telemetry. When present, the `/metrics` endpoint is exposed on a separate port (configurable via `metricsPort`) only if `enableMetrics: true`.
202
+
**Description**: OpenTelemetry (OTLP) configuration for metrics, traces, and logs. When configured, telemetry is exported to an OTLP collector endpoint. Omit this block to run without telemetry.
205
203
206
204
##### Parameters:
207
205
@@ -215,11 +213,10 @@ log:
215
213
**Required**: Yes
216
214
**Description**: Plugin configuration parameters.
217
215
218
-
###### `config.enableMetrics`
219
-
**Type**: `string` (boolean)
220
-
**Required**: No
221
-
**Default**: `"true"`
222
-
**Description**: Enables metrics collection and the `/metrics` endpoint. Must be `"true"` or `"false"` as a string.
216
+
###### `config.otlpEndpoint`
217
+
**Type**: `string`
218
+
**Required**: Yes (when OtelSetup is used)
219
+
**Description**: OTLP gRPC endpoint (host:port) for exporting metrics, traces, and logs. Example: `"localhost:4317"`, `"otel-collector-bap:4317"`.
223
220
224
221
###### `config.serviceName`
225
222
**Type**: `string`
@@ -238,47 +235,114 @@ log:
238
235
**Default**: `"development"`
239
236
**Description**: Sets the `deployment.environment` attribute (e.g., `development`, `staging`, `production`).
240
237
241
-
###### `config.metricsPort`
238
+
###### `config.domain`
242
239
**Type**: `string`
243
240
**Required**: No
244
241
**Default**: `"9090"`
245
242
**Description**: Port on which the metrics HTTP server will listen. The metrics endpoint is hosted on a separate server from the main application.
**Description**: Enables metrics collection and OTLP metric export. Use `"true"` or `"false"` as a string.
249
+
250
+
###### `config.enableTracing`
251
+
**Type**: `string` (boolean)
252
+
**Required**: No
253
+
**Default**: `"false"`
254
+
**Description**: Enables trace export via OTLP. Use `"true"` or `"false"` as a string.
255
+
256
+
###### `config.enableLogs`
257
+
**Type**: `string` (boolean)
258
+
**Required**: No
259
+
**Default**: `"false"`
260
+
**Description**: Enables log export via OTLP (e.g. audit logs). Use `"true"` or `"false"` as a string.
261
+
262
+
###### `config.timeInterval`
263
+
**Type**: `string` (integer)
264
+
**Required**: No
265
+
**Default**: `"5"`
266
+
**Description**: Time interval in seconds used for periodic metric export or batching.
267
+
268
+
###### `config.auditFieldsConfig`
269
+
**Type**: `string`
270
+
**Required**: No
271
+
**Description**: Path to a YAML file that defines which request/response fields are included in audit logs, per action. See [Audit fields configuration](#audit-fields-configuration). Example: `"/app/config/audit-fields.yaml"`.
272
+
273
+
274
+
**Example - OTLP export with audit logs** (e.g. `config/local-beckn-one-bap.yaml`):
When `plugins.otelsetup.config.enableMetrics: "true"`, the metrics endpoint is hosted on a separate HTTP server. Scrape metrics at:
263
295
296
+
### Audit fields configuration
297
+
298
+
When `config.auditFieldsConfig` points to a YAML file, audit logs (emitted via OTLP when `enableLogs: "true"`) include only the fields you list per action. The file format:
299
+
300
+
```yaml
301
+
auditRules:
302
+
default: # Optional: fallback for actions without a specific list
303
+
- context.transaction_id
304
+
- context.message_id
305
+
- context.action
306
+
- context.domain
307
+
- context.bap_id
308
+
- context.bpp_id
309
+
discover:
310
+
- context.transaction_id
311
+
- context.message_id
312
+
- context.action
313
+
- context.timestamp
314
+
- message.filters
315
+
- message.spatial
316
+
select:
317
+
- context.transaction_id
318
+
- context.message_id
319
+
- context.action
320
+
- message.order.beckn:buyer.beckn:id
321
+
# ... more dot-path fields
264
322
```
265
-
http://your-server:9090/metrics
266
-
```
267
323
268
-
**Note**: The metrics server runs on the port specified by `config.metricsPort` (default: `9090`), which is separate from the main application port configured in `http.port`.
324
+
-**Top-level key**: `auditRules`.
325
+
-**Action keys**: Use Beckn action names (e.g. `discover`, `select`, `init`, `confirm`, `update`, `track`, `cancel`, `rating`, `support`). Use `default` for actions that do not have a specific list.
326
+
-**Values**: List of dot-path strings into the request/response JSON (e.g. `context.transaction_id`, `message.order.beckn:id`). Namespaced keys use colons (e.g. `beckn:id`).
327
+
328
+
See `config/audit-fields.yaml` for a full example.
269
329
270
330
### Metrics Collected
271
331
332
+
When OtelSetup is configured with `otlpEndpoint`, metrics and traces are exported via OTLP (no separate metrics HTTP server). Scrape metrics from your OTLP collector
333
+
272
334
Metrics are organized by module for better maintainability and encapsulation:
273
335
274
336
#### OTel Setup (from `otelsetup` plugin)
275
-
- Prometheus exporter & `/metrics` endpoint on separate HTTP server
276
-
- Go runtime instrumentation (`go_*`), resource attributes, and meter provider wiring
337
+
- OTLP export for metrics, traces, and logs (gRPC endpoint).
338
+
- Go runtime instrumentation (`go_*`), resource attributes, and meter/tracer provider wiring.
339
+
- When `enableLogs: "true"` and `auditFieldsConfig` is set, audit logs are emitted via OTLP with fields defined in the audit-fields YAML.
-**ReqMapper**: Middleware to transform payload either between Beckn versions or against other platforms.
135
-
-**OtelSetup**: Observability Setup to make metrics, traces and logs available
135
+
-**OtelSetup**: Observability setup for metrics, traces, and logs (OTLP). Supports optional audit log configuration via `auditFieldsConfig` (YAML mapping actions to fields) . See [CONFIG.md](CONFIG.md) for details.
136
136
137
137
138
138
## Quick Start
@@ -330,10 +330,11 @@ modules:
330
330
### Deployment Modes
331
331
332
332
1. **Combined Mode**: Single instance handling both BAP and BPP (`config/onix/`) - Uses `secretskeymanager` (HashiCorp Vault) for production key management
4. **Local Development Combined Mode**: Simplified configuration (`config/local-simple.yaml`) - Uses `simplekeymanager` with embedded Ed25519 keys, no vault setup needed
336
+
5. **Local Development Combined Mode (Alternative)**: Development configuration (`config/local-dev.yaml`) - Uses `keymanager`, vault setup needed
337
+
6. **Local with Observability (BAP/BPP)**: Configs `config/local-beckn-one-bap.yaml` and `config/local-beckn-one-bpp.yaml` include OtelSetup (metrics, traces, audit logs) for use with an OTLP collector. Audit fields are configured via `config/audit-fields.yaml`. For a full stack (collectors, Grafana, Loki), see `install/network-observability/`
337
338
338
339
## API Endpoints
339
340
@@ -359,14 +360,6 @@ modules:
359
360
| POST | `/bpp/receiver/*` | Receives all BAP requests |
360
361
| POST | `/bpp/caller/on_*` | Sends responses back to BAP |
361
362
362
-
### Observability Endpoints
363
-
364
-
| Method | Endpoint | Description |
365
-
|--------|----------|-------------|
366
-
| GET | `/health` | Health check endpoint |
367
-
| GET | `/metrics` | Prometheus metrics endpoint (when telemetry is enabled) |
368
-
369
-
**Note**: The `/metrics` endpoint is available when `telemetry.enableMetrics: true` in the configuration file. It returns metrics in Prometheus format.
0 commit comments