# Observability — magento-shippingfields

> **Last verified:** 2026-02-26 (Europe/London)
> **Owner:** Engineering
> **Related:** [BOUNDARIES.md](BOUNDARIES.md)

---

## Summary

| Capability | Status | Notes |
|------------|--------|-------|
| Logging | PRESENT — verbose | PSR-3 logger injected throughout; emoji-prefixed messages |
| Metrics | ABSENT | No metrics instrumentation |
| Tracing | ABSENT | No distributed tracing |
| Correlation IDs | ABSENT | No correlation ID in REST API calls |

---

## Logging

### Log Style

All major operations are logged via PSR-3 `LoggerInterface`. Log messages use emoji prefixes for visual scanning (e.g., `📤`, `✅`, `❌`, `🚢`, `📝`). This is non-standard for enterprise environments and may not be searchable in all log aggregation tools.

### Logged Events

| Event | Level | Location | Contains PII? | Notes |
|-------|-------|----------|--------------|-------|
| Shipping fields save start | INFO | `ShippingFieldsManagement` | Potentially (cart ID, field values) | `shipping_message` may contain personal data |
| Shipping fields saved successfully | INFO | `ShippingFieldsManagement` | No | |
| Shipping fields save failed | ERROR | `ShippingFieldsManagement` | No | Exception message logged |
| Quote submit — fields read from quote | INFO | `QuoteSubmitBefore` | Potentially (field values) | |
| Quote submit — fields set on order | INFO | `QuoteSubmitBefore` | Potentially (field values) | |
| Plugin intercept — shipping info | DEBUG | `ShippingInformationManagementPlugin` | Potentially (request JSON) | Full request JSON may be logged |
| Plugin intercept — payment info | DEBUG | `PaymentInformationManagementPlugin` | Potentially | Debug only |
| Quote/Cart/Order repository sync | DEBUG | `QuoteRepositoryPlugin`, `CartRepositoryPlugin`, `OrderRepositoryPlugin` | Potentially | Extension attribute sync |

`UNKNOWN — Requires Clarification`: Which log file(s) does the PSR-3 logger write to? (`var/log/system.log`, `var/log/debug.log`, or a dedicated channel?)

---

## PII in Logs

| Risk | Detail |
|------|--------|
| `shipping_message` in logs | Free-text field may contain customer personal data (address details, names). Logged at INFO level in `ShippingFieldsManagement` and `QuoteSubmitBefore`. |
| `shipping_date` in logs | Date of birth not applicable here, but date logged alongside customer context |
| Request JSON in plugin logs | `ShippingInformationManagementPlugin` logs incoming request — may include full customer data from Magento checkout |

---

## Failure Handling

| Failure Type | Detection | Handling |
|--------------|-----------|----------|
| REST API save failure | Try/catch in `ShippingFieldsManagement` | Error logged; returns `false` |
| Observer exception | `UNKNOWN — Requires Clarification` | Not confirmed from source |
| `DisabledDates` collection read failure | `UNKNOWN — Requires Clarification` | May throw or return empty |
| Plugin exception | `UNKNOWN — Requires Clarification` | Not confirmed from source |
| Frontend API call failure | `UNKNOWN — Requires Clarification` | May block or allow checkout to continue |

---

## Metrics

No custom metrics are emitted. No StatsD, Prometheus, or similar instrumentation.

---

## Confirmed Facts

- PSR-3 logging is present throughout PHP classes.
- Logging is verbose — every major operation logged.
- Emoji prefixes used in log messages (may not be grep/aggregation-friendly).
- No structured logging (no JSON log context arrays observed).
- No distributed tracing or correlation IDs.

---

## Unknowns

1. `UNKNOWN — Requires Clarification`: Which log file does the logger write to?
2. `UNKNOWN — Requires Clarification`: Are logs aggregated in any log management tool?
3. `UNKNOWN — Requires Clarification`: Does `QuoteSubmitBefore` observer wrap execution in try/catch?
4. `UNKNOWN — Requires Clarification`: What happens if `ShippingInformationManagementPlugin` throws? Does checkout fail?
5. `UNKNOWN — Requires Clarification`: Is the `shipping_message` content redacted before logging?

---

## Evidence

- `/modules/magento-shippingfields/src/Model/ShippingFieldsManagement.php`
- `/modules/magento-shippingfields/src/Observer/QuoteSubmitBefore.php`
- `/modules/magento-shippingfields/src/Plugin/ShippingInformationManagementPlugin.php`
- `/modules/magento-shippingfields/src/Plugin/PaymentInformationManagementPlugin.php`
- `/modules/magento-shippingfields/src/Plugin/QuoteRepositoryPlugin.php`
- `/modules/magento-shippingfields/src/Plugin/CartRepositoryPlugin.php`
- `/modules/magento-shippingfields/src/Plugin/OrderRepositoryPlugin.php`
