mirror of
https://github.com/grafana/grafana.git
synced 2024-11-23 09:26:43 -06:00
Chore: Add additional debug info to live websocket pushes (#75131)
This commit is contained in:
parent
9dc0c8be11
commit
4f06d362df
@ -2,6 +2,7 @@ package pushws
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/gorilla/websocket"
|
||||
liveDto "github.com/grafana/grafana-plugin-sdk-go/live"
|
||||
@ -60,6 +61,8 @@ func (s *Handler) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
defer func() { _ = conn.Close() }()
|
||||
setupWSConn(r.Context(), conn, s.config)
|
||||
|
||||
started := time.Now()
|
||||
|
||||
for {
|
||||
_, body, err := conn.ReadMessage()
|
||||
if err != nil {
|
||||
@ -78,10 +81,11 @@ func (s *Handler) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
frameFormat := pushurl.FrameFormatFromValues(urlValues)
|
||||
|
||||
logger.Debug("Live Push request",
|
||||
"protocol", "http",
|
||||
"protocol", "ws",
|
||||
"streamId", streamID,
|
||||
"bodyLength", len(body),
|
||||
"frameFormat", frameFormat,
|
||||
"duration", time.Since(started).String(),
|
||||
)
|
||||
|
||||
metricFrames, err := s.converter.Convert(body, frameFormat)
|
||||
|
@ -171,14 +171,14 @@ export class LiveDataStream<T = unknown> {
|
||||
|
||||
const liveChannelStatusEvent = isLiveChannelStatusEvent(evt);
|
||||
if (liveChannelStatusEvent && evt.error) {
|
||||
const err = toDataQueryError(evt.error);
|
||||
this.stream.next({
|
||||
type: InternalStreamMessageType.Error,
|
||||
error: {
|
||||
...toDataQueryError(evt.error),
|
||||
message: `Streaming channel error: ${evt.error.message}`,
|
||||
...err,
|
||||
message: `Streaming channel error: ${err.message}`,
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
|
Loading…
Reference in New Issue
Block a user