chore: bump @grafana/create-plugin configuration to 5.26.4 (#2082)
Bumps [`@grafana/create-plugin`](https://github.com/grafana/plugin-tools/tree/main/packages/create-plugin) configuration from 4.2.1 to 5.26.4. **Notes for reviewer:** This is an auto-generated PR which ran `@grafana/create-plugin update`. Please consult the create-plugin [CHANGELOG.md](https://github.com/grafana/plugin-tools/blob/main/packages/create-plugin/CHANGELOG.md) to understand what may have changed. Please review the changes thoroughly before merging. --------- Co-authored-by: grafana-plugins-platform-bot[bot] <144369747+grafana-plugins-platform-bot[bot]@users.noreply.github.com> Co-authored-by: Zoltán Bedi <zoltan.bedi@gmail.com>
This commit is contained in:
committed by
GitHub
parent
e76741b453
commit
b13d567eee
@@ -33,7 +33,11 @@ func (ds *ZabbixDatasource) ZabbixAPIHandler(rw http.ResponseWriter, req *http.R
|
||||
}
|
||||
|
||||
body, err := io.ReadAll(req.Body)
|
||||
defer req.Body.Close()
|
||||
defer func() {
|
||||
if err := req.Body.Close(); err != nil {
|
||||
log.DefaultLogger.Warn("Error closing request body", "error", err)
|
||||
}
|
||||
}()
|
||||
if err != nil || len(body) == 0 {
|
||||
writeError(rw, http.StatusBadRequest, err)
|
||||
return
|
||||
@@ -74,7 +78,11 @@ func (ds *ZabbixDatasource) DBConnectionPostProcessingHandler(rw http.ResponseWr
|
||||
}
|
||||
|
||||
body, err := io.ReadAll(req.Body)
|
||||
defer req.Body.Close()
|
||||
defer func() {
|
||||
if err := req.Body.Close(); err != nil {
|
||||
log.DefaultLogger.Warn("Error closing request body", "error", err)
|
||||
}
|
||||
}()
|
||||
if err != nil || len(body) == 0 {
|
||||
writeError(rw, http.StatusBadRequest, err)
|
||||
return
|
||||
|
||||
@@ -142,7 +142,8 @@ func convertTrendToHistory(trend zabbix.Trend, valueType string) (zabbix.History
|
||||
}
|
||||
|
||||
func getTrendPointValue(point zabbix.TrendPoint, valueType string) (float64, error) {
|
||||
if valueType == "avg" || valueType == "min" || valueType == "max" || valueType == "count" {
|
||||
switch valueType {
|
||||
case "avg", "min", "max", "count":
|
||||
valueStr := point.ValueAvg
|
||||
switch valueType {
|
||||
case "min":
|
||||
@@ -158,7 +159,7 @@ func getTrendPointValue(point zabbix.TrendPoint, valueType string) (float64, err
|
||||
return 0, backend.DownstreamError(fmt.Errorf("error parsing trend value: %s", err))
|
||||
}
|
||||
return value, nil
|
||||
} else if valueType == "sum" {
|
||||
case "sum":
|
||||
avgStr := point.ValueAvg
|
||||
avg, err := strconv.ParseFloat(avgStr, 64)
|
||||
if err != nil {
|
||||
|
||||
@@ -40,7 +40,7 @@ func (ts TimeSeries) Align(interval time.Duration) TimeSeries {
|
||||
}
|
||||
}
|
||||
|
||||
if len(alignedTs) > 0 && alignedTs[len(alignedTs)-1].Time == pointFrameTs {
|
||||
if len(alignedTs) > 0 && alignedTs[len(alignedTs)-1].Time.Equal(pointFrameTs) {
|
||||
// Do not append points with the same timestamp
|
||||
alignedTs[len(alignedTs)-1] = TimePoint{Time: pointFrameTs, Value: point.Value}
|
||||
} else {
|
||||
|
||||
@@ -46,7 +46,7 @@ func (ts TimeSeries) GroupBy(interval time.Duration, aggFunc AggFunc) TimeSeries
|
||||
pointFrameTs = point.GetTimeFrame(interval)
|
||||
|
||||
// Iterate over points and push it into the frame if point time stamp fit the frame
|
||||
if pointFrameTs == frameTS {
|
||||
if pointFrameTs.Equal(frameTS) {
|
||||
frame = append(frame, point)
|
||||
} else if pointFrameTs.After(frameTS) {
|
||||
// If point outside frame, then we've done with current frame
|
||||
@@ -137,9 +137,10 @@ func Filter(series []*TimeSeriesData, n int, order string, aggFunc AggFunc) []*T
|
||||
maxN := int(math.Min(float64(n), float64(len(series))))
|
||||
filteredSeries := make([]*TimeSeriesData, maxN)
|
||||
for i := 0; i < maxN; i++ {
|
||||
if order == "top" {
|
||||
switch order {
|
||||
case "top":
|
||||
filteredSeries[i] = series[len(series)-1-i]
|
||||
} else if order == "bottom" {
|
||||
case "bottom":
|
||||
filteredSeries[i] = series[i]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -383,9 +383,10 @@ func (ds *Zabbix) GetAllItems(ctx context.Context, hostids []string, appids []st
|
||||
}
|
||||
|
||||
filter := params["filter"].(map[string]interface{})
|
||||
if itemtype == "num" {
|
||||
switch itemtype {
|
||||
case "num":
|
||||
filter["value_type"] = []int{0, 3}
|
||||
} else if itemtype == "text" {
|
||||
case "text":
|
||||
filter["value_type"] = []int{1, 2, 4}
|
||||
}
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ func (api *ZabbixAPI) request(ctx context.Context, method string, params ZabbixA
|
||||
|
||||
if auth != "" && version >= 72 {
|
||||
if api.dsSettings.BasicAuthEnabled {
|
||||
return nil, backend.DownstreamError(errors.New("Basic Auth is not supported for Zabbix v7.2 and later"))
|
||||
return nil, backend.DownstreamErrorf("basic auth is not supported for Zabbix v7.2 and later")
|
||||
}
|
||||
req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", auth))
|
||||
}
|
||||
@@ -223,7 +223,11 @@ func makeHTTPRequest(ctx context.Context, httpClient *http.Client, req *http.Req
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
defer res.Body.Close()
|
||||
defer func() {
|
||||
if err := res.Body.Close(); err != nil {
|
||||
log.DefaultLogger.Warn("Error closing response body", "error", err)
|
||||
}
|
||||
}()
|
||||
|
||||
if res.StatusCode != http.StatusOK {
|
||||
err = fmt.Errorf("request failed, status: %v", res.Status)
|
||||
|
||||
@@ -155,7 +155,7 @@ func TestIntegrationZabbixAPI72(t *testing.T) {
|
||||
// Try to authenticate
|
||||
_, err = apiWithBasicAuth.Request(context.Background(), "hostgroup.get", params, zabbixVersion)
|
||||
require.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "Basic Auth is not supported for Zabbix v7.2 and later")
|
||||
assert.Contains(t, err.Error(), "basic auth is not supported for Zabbix v7.2 and later")
|
||||
assert.True(t, backend.IsDownstreamError(err))
|
||||
})
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ func TestIntegrationZabbixAPI74(t *testing.T) {
|
||||
// Try to authenticate
|
||||
_, err = apiWithBasicAuth.Request(context.Background(), "hostgroup.get", params, zabbixVersion)
|
||||
require.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "Basic Auth is not supported for Zabbix v7.2 and later")
|
||||
assert.Contains(t, err.Error(), "basic auth is not supported for Zabbix v7.2 and later")
|
||||
assert.True(t, backend.IsDownstreamError(err))
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user