platform

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 1, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package platform is the single bootstrap entrypoint. One call to Setup wires Azugo's telemetry + the project glue identically across every service: logging with PII/secret redaction, metric conventions, OpenTelemetry tracing, the correlation middleware, and the error taxonomy.

A service calls it from its App.init(), right after server.New(...):

func (a *App) init() error {
 if err := platform.Setup(a.App, platform.Options{
 Config: a.config.BaseConfiguration,
 }); err != nil {
 return err
 }
 // …service-specific wiring (stores, routes, go-authbyte, audit emitters)…
 return nil
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Setup

func Setup(app *azugo.App, opts Options) error

Setup wires the cross-cutting concerns onto app, in the order they must run:

1. Tracing — enables azugo.io/opentelemetry (registers the trace middleware and instrumentation). Done first so the correlation middleware can read the active trace_id. Inert when no OTLP endpoint is configured. 2. Redaction — wraps the application logger so no log line can leak a secret or PII. Must be installed before any request is served. 3. Correlation — installs the middleware that binds correlation_id and the trace ids to each request and to every log line.

After Setup the service has standardized logging+redaction, metrics, tracing, and correlation installed — without copy-paste. The error taxonomy (package errors) is then available for handlers to map domain/data errors to consistent HTTP responses.

Types

type Options

type Options struct {
	// Config is the service's embedded go-platform-kit base configuration. It
	// must be loaded (the service's server.New / config Load has run) before
	// Setup is called. Required.
	Config *config.BaseConfiguration

	// Redaction overrides the log redaction policy. When nil, the fleet-standard
	// observability.DefaultRedactionPolicy is used. Redaction is always enabled.
	Redaction *observability.RedactionPolicy

	// PublicErrors installs the error renderer in public-boundary mode: every
	// error response is projected to the public envelope — the internal source
	// and hop chain are stripped and the detail is withheld unless marked
	// public-safe. Set it only on the single public-facing service (the BFF);
	// internal services leave it false so service-to-service errors carry the
	// full envelope for relay and logging.
	PublicErrors bool
}

Options configures Setup.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL