Feat: configure audit fields and metrics for onix adapter and add local configuration for onix adapterZ

This commit is contained in:
Manendra Pal Singh
2026-02-23 16:08:44 +05:30
parent 2745047b27
commit ab89102711
29 changed files with 2167 additions and 441 deletions

View File

@@ -14,6 +14,7 @@ import (
"github.com/beckn-one/beckn-onix/pkg/model"
"github.com/rs/zerolog"
"go.opentelemetry.io/otel/trace"
"gopkg.in/natefinch/lumberjack.v2"
)
@@ -273,6 +274,11 @@ func Request(ctx context.Context, r *http.Request, body []byte) {
// addCtx adds context values to the log event based on configured context keys.
func addCtx(ctx context.Context, event *zerolog.Event) {
span := trace.SpanFromContext(ctx)
if span.SpanContext().IsValid() {
event.Str("trace_id", span.SpanContext().TraceID().String())
event.Str("span_id", span.SpanContext().SpanID().String())
}
for _, key := range cfg.ContextKeys {
val, ok := ctx.Value(key).(string)
if !ok {