Module: Portage::Ucp::Observability
- Defined in:
- lib/portage/ucp/observability.rb
Overview
Structured log events (§12), emitted through a consumer-injected logger (defaults to Logger.new($stdout)) so the gem instruments nothing to a specific APM — it just exposes the events. Redacts payment_token, oauth_token, and Authorization by default, plus the PII fields that actually appear on Portage::Ucp::Identity (email) and Portage::Ucp::PostalAddress (name/address/contact) — §23 step 4 resolving §12's "Money-adjacent PII" phrase, which named no real key: Money/Total carry amounts and currency only, no PII; the PII that flows through the gem is on identity-linking results and fulfillment destinations instead.
Constant Summary collapse
- REDACTED_KEYS =
%w[ payment_token oauth_token authorization email first_name last_name phone_number street_address extended_address address_locality address_region address_country postal_code ].freeze
- REDACTED =
"[REDACTED]".freeze
Class Method Summary collapse
Class Method Details
.log(logger, event, **fields) ⇒ Object
24 25 26 |
# File 'lib/portage/ucp/observability.rb', line 24 def self.log(logger, event, **fields) logger.info(JSON.generate({ event: event }.merge(redact(fields)))) end |
.redact(value) ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/portage/ucp/observability.rb', line 28 def self.redact(value) case value when Hash value.to_h { |key, val| [key, REDACTED_KEYS.include?(key.to_s.downcase) ? REDACTED : redact(val)] } when Array value.map { |val| redact(val) } else value end end |