A standalone gRPC microservice that consumes audit events from the network-observability plugin and performs 3 side-effects:
- Update transaction cache in Redis (sync, part of the gRPC call)
- Send logs to NO (async, best-effort)
- Save payload to DB (async, best-effort)
This mirrors the behavior that previously lived in the TypeScript API service route wrapper.
Environment variables:
RECORDER_LISTEN_ADDR(default:8089)RECORDER_HTTP_LISTEN_ADDR(default:8090)REDIS_ADDR(default127.0.0.1:6379)REDIS_PASSWORD(optional)
Feature flags:
RECORDER_SKIP_CACHE_UPDATE(defaultfalse)RECORDER_SKIP_NO_PUSH(defaultfalse)RECORDER_SKIP_DB_SAVE(defaultfalse)
Async worker settings (applies to NO + DB tasks):
RECORDER_ASYNC_QUEUE_SIZE(default1000)RECORDER_ASYNC_WORKERS(default2)RECORDER_ASYNC_DROP_ON_FULL(defaulttrue)
General:
RECORDER_ENV(defaultdev)
Cache defaults (used if additionalData does not provide values):
RECORDER_API_TTL_SECONDS_DEFAULT(default30)RECORDER_CACHE_TTL_SECONDS_DEFAULT(default0)
NO settings:
RECORDER_NO_URL(default empty = disabled)RECORDER_NO_BEARER_TOKEN(optional)RECORDER_NO_TIMEOUT_MS(default5000)RECORDER_NO_ENABLED_ENVS(optional CSV, e.g.staging,prod; empty means enabled in all envs)
DB settings:
RECORDER_DB_BASE_URL(default empty = disabled)RECORDER_DB_API_KEY(optional)RECORDER_DB_TIMEOUT_MS(default5000)RECORDER_DB_ENABLED_ENVS(optional CSV; empty means enabled in all envs)
Service name: beckn.audit.v1.AuditService
Method:
LogEvent(google.protobuf.BytesValue) returns (google.protobuf.Empty)
The request is raw JSON bytes.
{
"requestBody": {},
"responseBody": {},
"additionalData": {
"payload_id": "...",
"transaction_id": "t1",
"subscriber_url": "https://buyer.example.com",
"action": "on_search",
"timestamp": "2026-01-07T00:00:00Z",
"api_name": "search",
"ttl_seconds": 30,
"cache_ttl_seconds": 600,
"status_code": 200,
"is_mock": false,
"session_id": "optional"
}
}Notes:
requestBodyandresponseBodymust be JSON objects.additionalData.transaction_idandadditionalData.subscriber_urlare required.- Transaction must already exist in Redis. If missing, the server returns
NOT_FOUND(same behavior as the TS cache update). - Redis key format:
transaction_id + "::" + subscriber_urlafter trimming spaces and trimming a trailing/. cache_ttl_secondscontrols Redis key expiry.0means no expiry.
This service also exposes a small HTTP endpoint used by the form workflow.
- Listen address:
RECORDER_HTTP_LISTEN_ADDR(default:8090)
This mirrors the TypeScript API service route POST /html-form and only appends a FORM entry into the existing transaction cache in Redis.
Request body JSON:
{
"transaction_id": "t1",
"subscriber_url": "https://buyer.example.com",
"form_action_id": "form-123",
"form_type": "HTML_FORM",
"submissionId": "optional",
"error": { "optional": true }
}Notes:
transaction_id,subscriber_url,form_action_idare required and must be strings.submissionIdis optional (camelCase, matching the TS controller).submission_idis also accepted.- The transaction must already exist in Redis (same key format as gRPC).
Responses:
200:Form submitted successfully400: Invalid/missing fields500: Cache update failed
From this folder:
go test ./...go run .
To point at Redis:
REDIS_ADDR=127.0.0.1:6379 RECORDER_LISTEN_ADDR=:8089 go run .
To enable the HTTP form endpoint on a custom port:
REDIS_ADDR=127.0.0.1:6379 RECORDER_LISTEN_ADDR=:8089 RECORDER_HTTP_LISTEN_ADDR=:8090 go run .