mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
Do not indent API JSON responses.
In one example response, this reduced the uncompressed size by 25% and the gzipped size by 11%. Change-Id: Ie80d44253124b9f8601b8ef9fc978e92dacff523
This commit is contained in:
parent
b3901827ee
commit
6297a405f2
|
@ -125,7 +125,7 @@ func ErrorToJSON(err error) string {
|
||||||
Value: err.Error(),
|
Value: err.Error(),
|
||||||
}
|
}
|
||||||
|
|
||||||
errorJSON, err := json.MarshalIndent(errorStruct, "", "\t")
|
errorJSON, err := json.Marshal(errorStruct)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ func TypedValueToJSON(data interface{}, typeStr string) string {
|
||||||
Type: typeStr,
|
Type: typeStr,
|
||||||
Value: data,
|
Value: data,
|
||||||
}
|
}
|
||||||
dataJSON, err := json.MarshalIndent(dataStruct, "", "\t")
|
dataJSON, err := json.Marshal(dataStruct)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ErrorToJSON(err)
|
return ErrorToJSON(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue