mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -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 (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/gorilla/websocket"
|
"github.com/gorilla/websocket"
|
||||||
liveDto "github.com/grafana/grafana-plugin-sdk-go/live"
|
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() }()
|
defer func() { _ = conn.Close() }()
|
||||||
setupWSConn(r.Context(), conn, s.config)
|
setupWSConn(r.Context(), conn, s.config)
|
||||||
|
|
||||||
|
started := time.Now()
|
||||||
|
|
||||||
for {
|
for {
|
||||||
_, body, err := conn.ReadMessage()
|
_, body, err := conn.ReadMessage()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -78,10 +81,11 @@ func (s *Handler) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
|||||||
frameFormat := pushurl.FrameFormatFromValues(urlValues)
|
frameFormat := pushurl.FrameFormatFromValues(urlValues)
|
||||||
|
|
||||||
logger.Debug("Live Push request",
|
logger.Debug("Live Push request",
|
||||||
"protocol", "http",
|
"protocol", "ws",
|
||||||
"streamId", streamID,
|
"streamId", streamID,
|
||||||
"bodyLength", len(body),
|
"bodyLength", len(body),
|
||||||
"frameFormat", frameFormat,
|
"frameFormat", frameFormat,
|
||||||
|
"duration", time.Since(started).String(),
|
||||||
)
|
)
|
||||||
|
|
||||||
metricFrames, err := s.converter.Convert(body, frameFormat)
|
metricFrames, err := s.converter.Convert(body, frameFormat)
|
||||||
|
@ -171,14 +171,14 @@ export class LiveDataStream<T = unknown> {
|
|||||||
|
|
||||||
const liveChannelStatusEvent = isLiveChannelStatusEvent(evt);
|
const liveChannelStatusEvent = isLiveChannelStatusEvent(evt);
|
||||||
if (liveChannelStatusEvent && evt.error) {
|
if (liveChannelStatusEvent && evt.error) {
|
||||||
|
const err = toDataQueryError(evt.error);
|
||||||
this.stream.next({
|
this.stream.next({
|
||||||
type: InternalStreamMessageType.Error,
|
type: InternalStreamMessageType.Error,
|
||||||
error: {
|
error: {
|
||||||
...toDataQueryError(evt.error),
|
...err,
|
||||||
message: `Streaming channel error: ${evt.error.message}`,
|
message: `Streaming channel error: ${err.message}`,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
Loading…
Reference in New Issue
Block a user