Documentation ¶
Overview ¶
Package marshal converts internal objects to loghttp model objects. This package is designed to work with models in pkg/loghttp.
Index ¶
- func EncodeResult(data parser.Value, warnings []string, statistics stats.Result, ...) error
- func EncodeTailResult(data legacy.TailResponse, s *jsoniter.Stream, ...) error
- func NewDroppedStream(s *legacy.DroppedEntry) (loghttp.DroppedStream, error)
- func NewLabelSet(s string) (loghttp.LabelSet, error)
- func NewMatrix(m promql.Matrix) loghttp.Matrix
- func NewMetric(l labels.Labels) model.Metric
- func NewResultValue(v parser.Value) (loghttp.ResultValue, error)
- func NewSample(s promql.Sample) model.Sample
- func NewSampleStream(s promql.Series) model.SampleStream
- func NewScalar(s promql.Scalar) loghttp.Scalar
- func NewStream(s logproto.Stream) (loghttp.Stream, error)
- func NewStreams(s logqlmodel.Streams) (loghttp.Streams, error)
- func NewVector(v promql.Vector) loghttp.Vector
- func NewWebsocketJSONWriter(ws WebsocketWriter) io.Writer
- func WriteDetectedFieldsResponseJSON(r *logproto.DetectedFieldsResponse, w io.Writer) error
- func WriteDetectedLabelsResponseJSON(r *logproto.DetectedLabelsResponse, w io.Writer) error
- func WriteIndexShardsResponseJSON(r *logproto.ShardsResponse, w io.Writer) error
- func WriteIndexStatsResponseJSON(r *indexStats.Stats, w io.Writer) error
- func WriteLabelResponseJSON(data []string, w io.Writer) error
- func WriteQueryPatternsResponseJSON(r *logproto.QueryPatternsResponse, w io.Writer) error
- func WriteQueryResponseJSON(data parser.Value, warnings []string, statistics stats.Result, w io.Writer, ...) error
- func WriteResponseJSON(r *http.Request, v any, w http.ResponseWriter) error
- func WriteSeriesResponseJSON(series []logproto.SeriesIdentifier, w io.Writer) error
- func WriteTailResponseJSON(r legacy.TailResponse, w io.Writer, encodeFlags httpreq.EncodingFlags) error
- func WriteVolumeResponseJSON(r *logproto.VolumeResponse, w io.Writer) error
- type WebsocketWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeResult ¶
func EncodeTailResult ¶
func EncodeTailResult(data legacy.TailResponse, s *jsoniter.Stream, encodeFlags httpreq.EncodingFlags) error
func NewDroppedStream ¶
func NewDroppedStream(s *legacy.DroppedEntry) (loghttp.DroppedStream, error)
NewDroppedStream constructs a DroppedStream from a legacy.DroppedEntry
func NewLabelSet ¶
NewLabelSet constructs a Labelset from a promql metric list as a string
func NewResultValue ¶
func NewResultValue(v parser.Value) (loghttp.ResultValue, error)
NewResultValue constructs a ResultValue from a promql.Value
func NewSampleStream ¶
func NewSampleStream(s promql.Series) model.SampleStream
NewSampleStream constructs a model.SampleStream from a promql.Series
func NewStreams ¶
func NewStreams(s logqlmodel.Streams) (loghttp.Streams, error)
NewStreams constructs a Streams from a logql.Streams
func NewWebsocketJSONWriter ¶
func NewWebsocketJSONWriter(ws WebsocketWriter) io.Writer
func WriteDetectedFieldsResponseJSON ¶
func WriteDetectedFieldsResponseJSON(r *logproto.DetectedFieldsResponse, w io.Writer) error
WriteDetectedFieldsResponseJSON marshals a logproto.DetectedFieldsResponse to JSON and then writes it to the provided io.Writer.
func WriteDetectedLabelsResponseJSON ¶
func WriteDetectedLabelsResponseJSON(r *logproto.DetectedLabelsResponse, w io.Writer) error
WriteDetectedLabelsResponseJSON marshals a logproto.DetectedLabelsResponse to JSON and then writes it to the provided io.Writer.
func WriteIndexShardsResponseJSON ¶
func WriteIndexShardsResponseJSON(r *logproto.ShardsResponse, w io.Writer) error
WriteIndexShardsResponseJSON marshals a indexgatewaypb.ShardsResponse to JSON and then writes it to the provided io.Writer.
func WriteIndexStatsResponseJSON ¶
func WriteIndexStatsResponseJSON(r *indexStats.Stats, w io.Writer) error
WriteIndexStatsResponseJSON marshals a gatewaypb.Stats to JSON and then writes it to the provided io.Writer.
func WriteLabelResponseJSON ¶
WriteLabelResponseJSON marshals a logproto.LabelResponse to v1 loghttp JSON and then writes it to the provided io.Writer.
func WriteQueryPatternsResponseJSON ¶
func WriteQueryPatternsResponseJSON(r *logproto.QueryPatternsResponse, w io.Writer) error
WriteQueryPatternsResponseJSON marshals a logproto.QueryPatternsResponse to JSON and then writes it to the provided io.Writer.
func WriteQueryResponseJSON ¶
func WriteQueryResponseJSON(data parser.Value, warnings []string, statistics stats.Result, w io.Writer, encodeFlags httpreq.EncodingFlags) error
WriteQueryResponseJSON marshals the promql.Value to v1 loghttp JSON and then writes it to the provided io.Writer.
func WriteResponseJSON ¶
func WriteSeriesResponseJSON ¶
func WriteSeriesResponseJSON(series []logproto.SeriesIdentifier, w io.Writer) error
WriteSeriesResponseJSON marshals a logproto.SeriesResponse to v1 loghttp JSON and then writes it to the provided io.Writer.
func WriteTailResponseJSON ¶
func WriteTailResponseJSON(r legacy.TailResponse, w io.Writer, encodeFlags httpreq.EncodingFlags) error
WriteTailResponseJSON marshals the legacy.TailResponse to v1 loghttp JSON and then writes it to the provided writer.
func WriteVolumeResponseJSON ¶
func WriteVolumeResponseJSON(r *logproto.VolumeResponse, w io.Writer) error
WriteVolumeResponseJSON marshals a logproto.VolumeResponse to JSON and then writes it to the provided io.Writer.
Types ¶
type WebsocketWriter ¶
WebsocketWriter knows how to write message to a websocket connection.