feat: improve metadata observability#3463
Conversation
|
| package servicediscovery | ||
|
|
||
| import ( | ||
| stderrors "errors" |
There was a problem hiding this comment.
| stderrors "errors" | |
| "errors" |
Alanxtl
left a comment
There was a problem hiding this comment.
the new metadata.MetadataError currently feels over-wrapped.
MetadataError carries Kind/Source/App/Revision/RegistryID/StorageType, but Error() only returns the wrapped error string. The production paths also mostly log or wrap the error with %v, so those new fields are not visible in logs or final error messages. At the moment, the fields are only consumed by tests via errors.As, which makes this look like type-level categorization without real observability value. Either those fields should be emitted in logs/metrics/error text, or the PR should keep simpler wrapping at the call sites instead of introducing a public error type.
| var ch = make(chan metrics.MetricsEvent, 10) | ||
| metrics.Subscribe(constant.MetricsMetadata, ch) | ||
| defer close(ch) |
There was a problem hiding this comment.
、metadata/report_instance_test.go:127, :173, :218
The tests call metrics.Subscribe(constant.MetricsMetadata, ch) and then defer close(ch). But metrics.Publish keeps sending to the channel stored in the global listener map. Closing the channel manually does not unsubscribe it, so any later metadata metric publish can panic with send on closed channel. These tests should clean up with metrics.Unsubscribe(constant.MetricsMetadata) or use a safer cancellable subscription pattern.、
|
Sure @Alanxtl will work on it, Thanks for the review |



Summary
Verification
Relates to #3356