Commit graph

10 commits

Author SHA1 Message Date
AVejahat 56fd8a1e4a
bugfix: add missing comma in vector/matrix array (#14047)
* bugfix: Add missing comma when encoding JSON results in web API

---------

Signed-off-by: Amir Vejahat <amir.vejahat.av@gmail.com>
Co-authored-by: Arthur Silva Sens <arthur.sens@coralogix.com>
2024-05-03 14:07:49 -03:00
Bryan Boreham 5c8ffaa77c bugfix: API: encode empty Vector/Matrix as []
If the underlying data is `nil` the default encoding
will render `"null"` which is not accepted by
(some) Prometheus client libraries.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-04-29 19:08:10 +01:00
Bryan Boreham e0a00f45db refactor: API: separate typed and unsafe marshalling
The typed versions are used when we call from one marshaller to another.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-04-29 19:08:10 +01:00
Bryan Boreham 66a1c3daad refactor: API: be explicit that we marshal empty objects
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-04-29 19:08:10 +01:00
Bryan Boreham dcadb32eb1 web/api: use stream encoder for embedded labels
This is much more efficient.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-07-24 20:42:36 +01:00
Bryan Boreham bb528d4a55 Add jsoniter encoder for Labels
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-07-24 20:13:34 +01:00
Charles Korn 097faf33c6
Merge branch 'main' into api-response-format-extension-point
# Conflicts:
#	web/api/v1/api.go
#	web/api/v1/api_test.go
2023-07-04 13:26:13 +10:00
Charles Korn 46a28899a0
Implement fully-featured content negotiation for API requests, and allow overriding the default API codec.
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2023-03-09 12:02:45 +11:00
Charles Korn a0dd1468be
Move custom jsoniter code into json_codec.go.
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2023-02-02 13:10:20 +11:00
Charles Korn 3e94dd8c8f
Add extension point for returning different content types from API endpoints
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2023-02-02 13:10:19 +11:00