Don't align IT services data
This commit is contained in:
@@ -70,6 +70,7 @@ type ZabbixAPIResourceResponse struct {
|
|||||||
type QueryModel struct {
|
type QueryModel struct {
|
||||||
// Deprecated `mode` field, use QueryType instead
|
// Deprecated `mode` field, use QueryType instead
|
||||||
Mode int64 `json:"mode"`
|
Mode int64 `json:"mode"`
|
||||||
|
QueryType string `json:"queryType"`
|
||||||
|
|
||||||
Group QueryFilter `json:"group"`
|
Group QueryFilter `json:"group"`
|
||||||
Host QueryFilter `json:"host"`
|
Host QueryFilter `json:"host"`
|
||||||
@@ -84,7 +85,6 @@ type QueryModel struct {
|
|||||||
|
|
||||||
// Direct from the gRPC interfaces
|
// Direct from the gRPC interfaces
|
||||||
RefID string `json:"-"`
|
RefID string `json:"-"`
|
||||||
QueryType string `json:"-"`
|
|
||||||
TimeRange backend.TimeRange `json:"-"`
|
TimeRange backend.TimeRange `json:"-"`
|
||||||
MaxDataPoints int64 `json:"-"`
|
MaxDataPoints int64 `json:"-"`
|
||||||
Interval time.Duration `json:"-"`
|
Interval time.Duration `json:"-"`
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ func (ds *ZabbixDatasourceInstance) applyDataProcessing(ctx context.Context, que
|
|||||||
|
|
||||||
// Align time series data if possible
|
// Align time series data if possible
|
||||||
useTrend := ds.isUseTrend(query.TimeRange)
|
useTrend := ds.isUseTrend(query.TimeRange)
|
||||||
disableDataAlignment := query.Options.DisableDataAlignment || ds.Settings.DisableDataAlignment
|
disableDataAlignment := query.Options.DisableDataAlignment || ds.Settings.DisableDataAlignment || query.QueryType == MODE_ITSERVICE
|
||||||
if !disableDataAlignment {
|
if !disableDataAlignment {
|
||||||
if useTrend {
|
if useTrend {
|
||||||
for _, s := range series {
|
for _, s := range series {
|
||||||
|
|||||||
@@ -220,16 +220,17 @@ export function itServiceResponseToTimeSeries(response: any, interval) {
|
|||||||
ts.push({ time: dp[i][1] / 1000, value: dp[i][0] });
|
ts.push({ time: dp[i][1] / 1000, value: dp[i][0] });
|
||||||
}
|
}
|
||||||
|
|
||||||
let intervalS = utils.parseItemInterval(interval);
|
// Convert interval to nanoseconds in order to unmarshall it on the backend to time.Duration
|
||||||
if (intervalS === 0) {
|
let intervalNS = utils.parseItemInterval(interval) * 1000000;
|
||||||
intervalS = null;
|
if (intervalNS === 0) {
|
||||||
|
intervalNS = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const timeSeriesData = {
|
const timeSeriesData = {
|
||||||
ts: ts,
|
ts: ts,
|
||||||
meta: {
|
meta: {
|
||||||
name: s.target,
|
name: s.target,
|
||||||
interval: intervalS,
|
interval: null,
|
||||||
item: {},
|
item: {},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user