feat(natsrpc): propagate trace context across NATS and into task runs
This commit is contained in:
1 parent
4a889991bd
commit
0880e6a01c
37 files changed
+245
-117
No files matched your search
@@ -35,8 +35,8 @@ type ChannelView struct {
|
||||
// the fields this derives from.
|
||||
func (s *Server) handleChannels(w http.ResponseWriter, r *http.Request) {
|
||||
if s.Channels != nil {
|
||||
views := make([]ChannelView, 0, len(s.Channels.Snapshot()))
|
||||
for _, status := range s.Channels.Snapshot() {
|
||||
views := make([]ChannelView, 0, len(s.Channels.Snapshot(r.Context())))
|
||||
for _, status := range s.Channels.Snapshot(r.Context()) {
|
||||
views = append(views, channelViewFromStatus(status))
|
||||
}
|
||||
writeJSON(w, map[string]any{"channels": views})
|
||||
@@ -55,7 +55,7 @@ func (s *Server) handleChannelReload(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
var status *status.Status
|
||||
for _, candidate := range s.Channels.Snapshot() {
|
||||
for _, candidate := range s.Channels.Snapshot(r.Context()) {
|
||||
if candidate.ID == id {
|
||||
status = &candidate
|
||||
break
|
||||
@@ -244,7 +244,7 @@ func chatChannelConfigured(chat config.ChatConfig) bool {
|
||||
// told so rather than offering a control that would 503.
|
||||
// ChannelStatusSource reports the live state of each configured channel.
|
||||
type ChannelStatusSource interface {
|
||||
Snapshot() []status.Status
|
||||
Snapshot(ctx context.Context) []status.Status
|
||||
}
|
||||
|
||||
// RemoteChannelStatus reads channel state from the State Store; unreachable
|
||||
@@ -257,11 +257,11 @@ type remoteChannelStatus struct {
|
||||
channels storecontract.ChannelStatusStore
|
||||
}
|
||||
|
||||
func (r remoteChannelStatus) Snapshot() []status.Status {
|
||||
func (r remoteChannelStatus) Snapshot(ctx context.Context) []status.Status {
|
||||
// The handler has no error to return, so a failed read is an empty report.
|
||||
// That is the honest answer: the dashboard must not show a stale "running"
|
||||
// for a channel it cannot currently ask about.
|
||||
rows, err := r.channels.ChannelStatus(context.Background())
|
||||
rows, err := r.channels.ChannelStatus(ctx)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user