From 0fe9c30ef972292f511921bc1b6f4b9b6969abe0 Mon Sep 17 00:00:00 2001 From: Kevin Yu Date: Wed, 18 Sep 2024 14:36:30 -0700 Subject: [PATCH] wip: batch entries up to limit the limit specified in the api --- cspell.config.json | 3 +- pkg/framer/property_aggregate_batch.go | 61 +- pkg/framer/property_value_batch.go | 59 +- pkg/framer/property_value_history_batch.go | 62 +- .../test/property_value_aggregate_test.go | 120 ++ .../test/property_value_history_test.go | 131 +- pkg/server/test/property_value_test.go | 129 +- pkg/sitewise/api/constants.go | 8 + pkg/sitewise/api/property_aggregate_batch.go | 26 +- pkg/sitewise/api/property_history_batch.go | 21 +- pkg/sitewise/api/property_value_batch.go | 20 +- pkg/sitewise/api/util.go | 43 + ...ange-1d-data-for-time-range-A.golden.jsonc | 2 + ...a-for-time-range-from-alias-A.golden.jsonc | 2 + ...ange-1h-data-for-time-range-A.golden.jsonc | 2 + ...a-for-time-range-from-alias-A.golden.jsonc | 2 + ...-for-reduced-max-data-point-A.golden.jsonc | 2 + ...d-max-data-point-from-alias-A.golden.jsonc | 2 + ...ange-1m-data-for-time-range-A.golden.jsonc | 2 + ...a-for-time-range-from-alias-A.golden.jsonc | 2 + ...nge-raw-data-for-time-range-A.golden.jsonc | 2 + ...a-for-time-range-from-alias-A.golden.jsonc | 2 + ...erty-history-values-boolean-A.golden.jsonc | 2 + ...s-boolean-associated-stream-A.golden.jsonc | 2 + ...n-with-disassociated-stream-A.golden.jsonc | 2 + ...iated-stream-empty-response-A.golden.jsonc | 2 + ...ory-values-from-alias-table-A.golden.jsonc | 2 + ...alues-from-alias-timeseries-A.golden.jsonc | 2 + ...values-with-batched-queries-A.golden.jsonc | 1333 +++++++++++++++++ src/getNextQueries.ts | 2 +- 30 files changed, 1926 insertions(+), 124 deletions(-) create mode 100644 pkg/testdata/property-history-values-with-batched-queries-A.golden.jsonc diff --git a/cspell.config.json b/cspell.config.json index c9b0c740..4f12a739 100644 --- a/cspell.config.json +++ b/cspell.config.json @@ -9,6 +9,7 @@ "pkg/**/*_test.go", "provisioning/**/*.yaml", "**/testdata/*.json", + "**/testdata/*.jsonc", "**/dashboards/*.json", "src/static/**", "vendor/**", @@ -70,7 +71,7 @@ "eslintcache", "lefthook", "ssjagad", - "jackspeak", + "jackspeak", "nvmrc", "golangci" ] diff --git a/pkg/framer/property_aggregate_batch.go b/pkg/framer/property_aggregate_batch.go index b8c5f5a9..cccf0b2a 100644 --- a/pkg/framer/property_aggregate_batch.go +++ b/pkg/framer/property_aggregate_batch.go @@ -14,8 +14,8 @@ import ( ) type AssetPropertyAggregatesBatch struct { - Request iotsitewise.BatchGetAssetPropertyAggregatesInput - Response iotsitewise.BatchGetAssetPropertyAggregatesOutput + Requests []iotsitewise.BatchGetAssetPropertyAggregatesInput + Responses []iotsitewise.BatchGetAssetPropertyAggregatesOutput } // getAggregationFields enforces ordering of aggregate fields @@ -86,40 +86,49 @@ func addAggregateFieldValues(idx int, fields map[string]*data.Field, aggs *iotsi } func (a AssetPropertyAggregatesBatch) Frames(ctx context.Context, resources resource.ResourceProvider) (data.Frames, error) { - resp := a.Response - frames := data.Frames{} + successEntriesLength := 0 + for _, r := range a.Responses { + successEntriesLength += len(r.SuccessEntries) + } + frames := make(data.Frames, 0, successEntriesLength) properties, err := resources.Properties(ctx) if err != nil { return nil, err } - for i, e := range resp.SuccessEntries { - property := properties[*e.EntryId] - frame, err := a.Frame(ctx, property, e.AggregatedValues) - if err != nil { - return nil, err - } - frame.Meta = &data.FrameMeta{ - Custom: models.SitewiseCustomMeta{ - NextToken: aws.StringValue(resp.NextToken), - Resolution: aws.StringValue(a.Request.Entries[i].Resolution), - Aggregates: aws.StringValueSlice(a.Request.Entries[i].AggregateTypes), - }, - } - frames = append(frames, frame) - } + for i, r := range a.Responses { + request := a.Requests[i] + for j, e := range r.SuccessEntries { + property := properties[*e.EntryId] + frame, err := a.Frame(ctx, property, e.AggregatedValues) + if err != nil { + return nil, err + } - for _, e := range resp.ErrorEntries { - property := properties[*e.EntryId] - frame := data.NewFrame(getFrameName(property)) - if e.ErrorMessage != nil { frame.Meta = &data.FrameMeta{ - Notices: []data.Notice{{Severity: data.NoticeSeverityError, Text: *e.ErrorMessage}}, + Custom: models.SitewiseCustomMeta{ + NextToken: aws.StringValue(r.NextToken), + EntryId: *e.EntryId, + Resolution: aws.StringValue(request.Entries[j].Resolution), + Aggregates: aws.StringValueSlice(request.Entries[j].AggregateTypes), + }, } + frames = append(frames, frame) + } + + for _, e := range r.ErrorEntries { + property := properties[*e.EntryId] + frame := data.NewFrame(getFrameName(property)) + if e.ErrorMessage != nil { + frame.Meta = &data.FrameMeta{ + Notices: []data.Notice{{Severity: data.NoticeSeverityError, Text: *e.ErrorMessage}}, + } + } + frames = append(frames, frame) } - frames = append(frames, frame) } + return frames, nil } @@ -152,4 +161,4 @@ func (a AssetPropertyAggregatesBatch) Frame(ctx context.Context, property *iotsi return frame, nil -} \ No newline at end of file +} diff --git a/pkg/framer/property_value_batch.go b/pkg/framer/property_value_batch.go index 7f0d12ad..8c224521 100644 --- a/pkg/framer/property_value_batch.go +++ b/pkg/framer/property_value_batch.go @@ -18,47 +18,58 @@ import ( ) type AssetPropertyValueBatch struct { - *iotsitewise.BatchGetAssetPropertyValueOutput + Responses []*iotsitewise.BatchGetAssetPropertyValueOutput AnomalyAssetIds []string SitewiseClient client.SitewiseClient } func (p AssetPropertyValueBatch) Frames(ctx context.Context, resources resource.ResourceProvider) (data.Frames, error) { - frames := data.Frames{} + successEntriesLength := 0 + for _, r := range p.Responses { + successEntriesLength += len(r.SuccessEntries) + } + frames := make(data.Frames, 0, successEntriesLength) properties, err := resources.Properties(ctx) if err != nil { return nil, err } - for _, e := range p.SuccessEntries { - property := properties[*e.EntryId] - if util.IsAssetProperty(property) && *property.AssetProperty.DataType == *aws.String("?") && e.AssetPropertyValue != nil { - property.AssetProperty.DataType = aws.String(getPropertyVariantValueType(e.AssetPropertyValue.Value)) - } + for _, r := range p.Responses { + for _, e := range r.SuccessEntries { + property := properties[*e.EntryId] + if util.IsAssetProperty(property) && *property.AssetProperty.DataType == *aws.String("?") && e.AssetPropertyValue != nil { + property.AssetProperty.DataType = aws.String(getPropertyVariantValueType(e.AssetPropertyValue.Value)) + } - var frame *data.Frame - if property.AssetId != nil && slices.Contains(p.AnomalyAssetIds, *property.AssetId) { - frame, err = p.frameL4ePropertyValue(ctx, property, e.AssetPropertyValue) - if err != nil { - return nil, err + var frame *data.Frame + if property.AssetId != nil && slices.Contains(p.AnomalyAssetIds, *property.AssetId) { + frame, err = p.frameL4ePropertyValue(ctx, property, e.AssetPropertyValue) + if err != nil { + return nil, err + } + } else { + frame = p.framePropertyValue(property, e.AssetPropertyValue) + } + frame.Meta = &data.FrameMeta{ + Custom: models.SitewiseCustomMeta{ + NextToken: aws.StringValue(r.NextToken), + EntryId: *e.EntryId, + }, } - } else { - frame = p.framePropertyValue(property, e.AssetPropertyValue) + frames = append(frames, frame) } - frames = append(frames, frame) - } - - for _, e := range p.ErrorEntries { - property := properties[*e.EntryId] - frame := data.NewFrame(*property.AssetName) - if e.ErrorMessage != nil { - frame.Meta = &data.FrameMeta{ - Notices: []data.Notice{{Severity: data.NoticeSeverityError, Text: *e.ErrorMessage}}, + for _, e := range r.ErrorEntries { + property := properties[*e.EntryId] + frame := data.NewFrame(*property.AssetName) + if e.ErrorMessage != nil { + frame.Meta = &data.FrameMeta{ + Notices: []data.Notice{{Severity: data.NoticeSeverityError, Text: *e.ErrorMessage}}, + } } + frames = append(frames, frame) } - frames = append(frames, frame) } return frames, nil diff --git a/pkg/framer/property_value_history_batch.go b/pkg/framer/property_value_history_batch.go index 465209ac..cbd21eda 100644 --- a/pkg/framer/property_value_history_batch.go +++ b/pkg/framer/property_value_history_batch.go @@ -17,38 +17,52 @@ import ( ) type AssetPropertyValueHistoryBatch struct { - *iotsitewise.BatchGetAssetPropertyValueHistoryOutput + Responses []*iotsitewise.BatchGetAssetPropertyValueHistoryOutput Query models.AssetPropertyValueQuery AnomalyAssetIds []string SitewiseClient client.SitewiseClient } func (p AssetPropertyValueHistoryBatch) Frames(ctx context.Context, resources resource.ResourceProvider) (data.Frames, error) { - frames := make(data.Frames, 0, len(p.SuccessEntries)) + successEntriesLength := 0 + for _, r := range p.Responses { + successEntriesLength += len(r.SuccessEntries) + } + frames := make(data.Frames, 0, successEntriesLength) + properties, err := resources.Properties(ctx) if err != nil { return frames, err } - for _, h := range p.SuccessEntries { - frame, err := p.Frame(ctx, properties[*h.EntryId], h.AssetPropertyValueHistory) - if err != nil { - return nil, err - } - if frame != nil { - frames = append(frames, frame) + for _, r := range p.Responses { + for _, s := range r.SuccessEntries { + frame, err := p.Frame(ctx, properties[*s.EntryId], s.AssetPropertyValueHistory) + frame.Meta = &data.FrameMeta{ + Custom: models.SitewiseCustomMeta{ + NextToken: aws.StringValue(r.NextToken), + EntryId: *s.EntryId, + Resolution: models.PropertyQueryResolutionRaw, + }, + } + if err != nil { + return nil, err + } + if frame != nil { + frames = append(frames, frame) + } } - } - for _, e := range p.ErrorEntries { - property := properties[*e.EntryId] - frame := data.NewFrame(getFrameName(property)) - if e.ErrorMessage != nil { - frame.Meta = &data.FrameMeta{ - Notices: []data.Notice{{Severity: data.NoticeSeverityError, Text: *e.ErrorMessage}}, + for _, e := range r.ErrorEntries { + property := properties[*e.EntryId] + frame := data.NewFrame(getFrameName(property)) + if e.ErrorMessage != nil { + frame.Meta = &data.FrameMeta{ + Notices: []data.Notice{{Severity: data.NoticeSeverityError, Text: *e.ErrorMessage}}, + } } + frames = append(frames, frame) } - frames = append(frames, frame) } return frames, nil @@ -93,13 +107,6 @@ func (p AssetPropertyValueHistoryBatch) framePropertyValues(property *iotsitewis valueField, qualityField) - frame.Meta = &data.FrameMeta{ - Custom: models.SitewiseCustomMeta{ - NextToken: aws.StringValue(p.NextToken), - Resolution: models.PropertyQueryResolutionRaw, - }, - } - for i, v := range h { if v.Value != nil && getPropertyVariantValue(v.Value) != nil { timeField.Set(i, getTime(v.Timestamp)) @@ -129,13 +136,6 @@ func (p AssetPropertyValueHistoryBatch) frameL4ePropertyValues(ctx context.Conte frameName, dataFields...) - frame.Meta = &data.FrameMeta{ - Custom: models.SitewiseCustomMeta{ - NextToken: aws.StringValue(p.NextToken), - Resolution: models.PropertyQueryResolutionRaw, - }, - } - return frame, nil } diff --git a/pkg/server/test/property_value_aggregate_test.go b/pkg/server/test/property_value_aggregate_test.go index 39dbeb14..857fca54 100644 --- a/pkg/server/test/property_value_aggregate_test.go +++ b/pkg/server/test/property_value_aggregate_test.go @@ -2,6 +2,7 @@ package test import ( "context" + "fmt" "math" "testing" "time" @@ -20,6 +21,7 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" + "github.com/grafana/iot-sitewise-datasource/pkg/sitewise/api" "github.com/grafana/iot-sitewise-datasource/pkg/sitewise/client/mocks" ) @@ -171,6 +173,7 @@ func TestPropertyValueAggregate(t *testing.T) { ).SetMeta(&data.FrameMeta{ Custom: models.SitewiseCustomMeta{ NextToken: "some-next-token", + EntryId: "1assetid-aaaa-2222-bbbb-3333cccc4444", Resolution: "1m", Aggregates: []string{models.AggregateSum}, }, @@ -281,6 +284,7 @@ func TestPropertyValueAggregateWithDisassociatedStream(t *testing.T) { ).SetMeta(&data.FrameMeta{ Custom: models.SitewiseCustomMeta{ NextToken: "some-next-token", + EntryId: "61e4e1a8ab39463fa0b9418d9be2923e364f40a8b935b69d006b999516cdecef", Resolution: "1m", Aggregates: []string{models.AggregateSum}, }, @@ -417,4 +421,120 @@ func TestPropertyValueAggregate_with_error(t *testing.T) { } +func TestPropertyValueAggregate_with_batched_queries(t *testing.T) { + mockSw := &mocks.SitewiseClient{} + + mockedSuccessEntriesFirstBatch := []*iotsitewise.BatchGetAssetPropertyAggregatesSuccessEntry{} + for i := 1; i <= api.BatchGetAssetPropertyAggregatesMaxEntries; i++ { + mockedSuccessEntriesFirstBatch = append(mockedSuccessEntriesFirstBatch, &iotsitewise.BatchGetAssetPropertyAggregatesSuccessEntry{ + AggregatedValues: []*iotsitewise.AggregatedValue{{ + Timestamp: Pointer(time.Date(2021, 2, 1, 16, 27, 0, 0, time.UTC)), + Value: &iotsitewise.Aggregates{Sum: Pointer(1688.6)}, + }}, + EntryId: aws.String(fmt.Sprintf("%dassetid-aaaa-2222-bbbb-3333cccc4444", i)), + }) + } + mockSw.On( + "BatchGetAssetPropertyAggregatesPageAggregation", + mock.Anything, + mock.MatchedBy(func(input *iotsitewise.BatchGetAssetPropertyAggregatesInput) bool { + return len(input.Entries) == api.BatchGetAssetPropertyAggregatesMaxEntries + }), + mock.Anything, + mock.Anything, + ).Return(&iotsitewise.BatchGetAssetPropertyAggregatesOutput{ + NextToken: Pointer("some-next-token-1"), + SuccessEntries: mockedSuccessEntriesFirstBatch, + }, nil) + mockedSuccessEntriesSecondBatch := []*iotsitewise.BatchGetAssetPropertyAggregatesSuccessEntry{{ + AggregatedValues: []*iotsitewise.AggregatedValue{{ + Timestamp: Pointer(time.Date(2021, 2, 1, 16, 27, 0, 0, time.UTC)), + Value: &iotsitewise.Aggregates{Sum: Pointer(1688.6)}, + }}, + EntryId: aws.String(fmt.Sprintf("%dassetid-aaaa-2222-bbbb-3333cccc4444", api.BatchGetAssetPropertyAggregatesMaxEntries+1)), + }} + mockSw.On( + "BatchGetAssetPropertyAggregatesPageAggregation", + mock.Anything, + mock.MatchedBy(func(input *iotsitewise.BatchGetAssetPropertyAggregatesInput) bool { + return len(input.Entries) < api.BatchGetAssetPropertyAggregatesMaxEntries + }), + mock.Anything, + mock.Anything, + ).Return(&iotsitewise.BatchGetAssetPropertyAggregatesOutput{ + NextToken: Pointer("some-next-token-2"), + SuccessEntries: mockedSuccessEntriesSecondBatch, + }, nil) + + mockSw.On("DescribeAssetPropertyWithContext", mock.Anything, mock.Anything).Return(&iotsitewise.DescribeAssetPropertyOutput{ + AssetName: Pointer("Demo Turbine Asset 1"), + AssetProperty: &iotsitewise.Property{ + DataType: Pointer("DOUBLE"), + Name: Pointer("Wind Speed"), + Unit: Pointer("m/s"), + }, + }, nil) + + srvr := &server.Server{Datasource: mockedDatasource(mockSw).(*sitewise.Datasource)} + + sitewise.GetCache = func() *cache.Cache { + return cache.New(cache.DefaultExpiration, cache.NoExpiration) + } + + query := &backend.QueryDataRequest{ + PluginContext: backend.PluginContext{}, + Queries: []backend.DataQuery{ + { + RefID: "A", + QueryType: models.QueryTypePropertyAggregate, + TimeRange: timeRange, + JSON: []byte(`{ + "region":"us-west-2", + "assetIds":[ + "1assetid-aaaa-2222-bbbb-3333cccc4444", + "2assetid-aaaa-2222-bbbb-3333cccc4444", + "3assetid-aaaa-2222-bbbb-3333cccc4444", + "4assetid-aaaa-2222-bbbb-3333cccc4444", + "5assetid-aaaa-2222-bbbb-3333cccc4444", + "6assetid-aaaa-2222-bbbb-3333cccc4444", + "7assetid-aaaa-2222-bbbb-3333cccc4444", + "8assetid-aaaa-2222-bbbb-3333cccc4444", + "9assetid-aaaa-2222-bbbb-3333cccc4444", + "10assetid-aaaa-2222-bbbb-3333cccc4444", + "11assetid-aaaa-2222-bbbb-3333cccc4444", + "12assetid-aaaa-2222-bbbb-3333cccc4444", + "13assetid-aaaa-2222-bbbb-3333cccc4444", + "14assetid-aaaa-2222-bbbb-3333cccc4444", + "15assetid-aaaa-2222-bbbb-3333cccc4444", + "16assetid-aaaa-2222-bbbb-3333cccc4444", + "17assetid-aaaa-2222-bbbb-3333cccc4444" + ], + "propertyId":"11propid-aaaa-2222-bbbb-3333cccc4444", + "aggregates":["SUM"], + "resolution":"1m" + }`), + }, + }, + } + + qdr, err := srvr.HandlePropertyAggregate(context.Background(), query) + require.Nil(t, err) + _, ok := qdr.Responses["A"] + require.True(t, ok) + expectedNumFrames := len(mockedSuccessEntriesFirstBatch) + len(mockedSuccessEntriesSecondBatch) + require.Len(t, qdr.Responses["A"].Frames, expectedNumFrames) + + for i, f := range qdr.Responses["A"].Frames { + require.NotNil(t, f) + expectedNextToken := "some-next-token-1" + if (i + 1) > api.BatchGetAssetPropertyAggregatesMaxEntries { + expectedNextToken = "some-next-token-2" + } + require.Equal(t, f.Meta.Custom.(models.SitewiseCustomMeta).EntryId, fmt.Sprintf("%dassetid-aaaa-2222-bbbb-3333cccc4444", i+1)) + require.Equal(t, f.Meta.Custom.(models.SitewiseCustomMeta).NextToken, expectedNextToken) + } + + mockSw.AssertExpectations(t) +} + func Pointer[T any](v T) *T { return &v } diff --git a/pkg/server/test/property_value_history_test.go b/pkg/server/test/property_value_history_test.go index 34990971..c7ff60bd 100644 --- a/pkg/server/test/property_value_history_test.go +++ b/pkg/server/test/property_value_history_test.go @@ -18,6 +18,7 @@ import ( "github.com/grafana/grafana-plugin-sdk-go/experimental" "github.com/grafana/iot-sitewise-datasource/pkg/models" "github.com/grafana/iot-sitewise-datasource/pkg/server" + "github.com/grafana/iot-sitewise-datasource/pkg/sitewise/api" "github.com/grafana/iot-sitewise-datasource/pkg/sitewise/client/mocks" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" @@ -93,7 +94,7 @@ func Test_get_property_value_history_with_default_aka_table_response_format(t *t data.NewField("Wind Speed", nil, []float64{23.8}).SetConfig(&data.FieldConfig{Unit: "m/s"}), data.NewField("quality", nil, []string{"GOOD"}), ).SetMeta(&data.FrameMeta{ - Custom: models.SitewiseCustomMeta{Resolution: "RAW"}, + Custom: models.SitewiseCustomMeta{Resolution: "RAW", EntryId: "1assetid-aaaa-2222-bbbb-3333cccc4444"}, }) if diff := cmp.Diff(expectedFrame, qdr.Responses["A"].Frames[0], data.FrameTestCompareOptions()...); diff != "" { t.Errorf("Result mismatch (-want +got):\n%s", diff) @@ -188,7 +189,7 @@ func Test_get_property_value_history_with_time_series_response_format(t *testing data.NewField("Wind Speed", data.Labels{"quality": "GOOD"}, []*float64{Pointer(23.8)}), ).SetMeta(&data.FrameMeta{ Type: data.FrameTypeTimeSeriesWide, - Custom: models.SitewiseCustomMeta{Resolution: "RAW"}, + Custom: models.SitewiseCustomMeta{Resolution: "RAW", EntryId: "1assetid-aaaa-2222-bbbb-3333cccc4444"}, }) if diff := cmp.Diff(expectedFrame, qdr.Responses["A"].Frames[0], data.FrameTestCompareOptions()...); diff != "" { t.Errorf("Result mismatch (-want +got):\n%s", diff) @@ -358,7 +359,7 @@ func Test_get_property_value_history_with_flatten_l4e(t *testing.T) { data.NewField("RPM", nil, []float64{0.44856}), data.NewField("Torque", nil, []float64{0.55144}), ).SetMeta(&data.FrameMeta{ - Custom: models.SitewiseCustomMeta{Resolution: "RAW"}, + Custom: models.SitewiseCustomMeta{Resolution: "RAW", EntryId: "1assetid-aaaa-2222-bbbb-3333cccc4444"}, }) if diff := cmp.Diff(expectedFrame, qdr.Responses["A"].Frames[0], data.FrameTestCompareOptions()...); diff != "" { t.Errorf("Result mismatch (-want +got):\n%s", diff) @@ -443,7 +444,7 @@ func Test_get_property_value_history_with_struct_type(t *testing.T) { data.NewField("AWS/L4E_ANOMALY_RESULT", nil, []string{structValue}).SetConfig(&data.FieldConfig{}), data.NewField("quality", nil, []string{"GOOD"}), ).SetMeta(&data.FrameMeta{ - Custom: models.SitewiseCustomMeta{Resolution: "RAW"}, + Custom: models.SitewiseCustomMeta{Resolution: "RAW", EntryId: "1assetid-aaaa-2222-bbbb-3333cccc4444"}, }) if diff := cmp.Diff(expectedFrame, qdr.Responses["A"].Frames[0], data.FrameTestCompareOptions()...); diff != "" { t.Errorf("Result mismatch (-want +got):\n%s", diff) @@ -898,7 +899,7 @@ func Test_get_property_value_history_from_expression_query_with_time_series_resp data.NewField("Wind Speed", data.Labels{"quality": "GOOD"}, []*float64{Pointer(23.8)}), ).SetMeta(&data.FrameMeta{ Type: data.FrameTypeTimeSeriesWide, - Custom: models.SitewiseCustomMeta{Resolution: "RAW"}, + Custom: models.SitewiseCustomMeta{Resolution: "RAW", EntryId: "1assetid-aaaa-2222-bbbb-3333cccc4444"}, }) if diff := cmp.Diff(expectedFrame, qdr.Responses["A"].Frames[0], data.FrameTestCompareOptions()...); diff != "" { t.Errorf("Result mismatch (-want +got):\n%s", diff) @@ -921,3 +922,123 @@ func Test_get_property_value_history_from_expression_query_with_time_series_resp }, ) } + +func Test_get_property_value_history_with_batched_queries(t *testing.T) { + mockSw := &mocks.SitewiseClient{} + mockedSuccessEntriesFirstBatch := []*iotsitewise.BatchGetAssetPropertyValueHistorySuccessEntry{} + for i := 1; i <= api.BatchGetAssetPropertyValueHistoryMaxEntries; i++ { + mockedSuccessEntriesFirstBatch = append(mockedSuccessEntriesFirstBatch, &iotsitewise.BatchGetAssetPropertyValueHistorySuccessEntry{ + AssetPropertyValueHistory: []*iotsitewise.AssetPropertyValue{ + { + Quality: Pointer("GOOD"), + Timestamp: &iotsitewise.TimeInNanos{ + OffsetInNanos: Pointer(int64(0)), + TimeInSeconds: Pointer(int64(1612207200)), + }, + Value: &iotsitewise.Variant{ + DoubleValue: Pointer(float64(23.8)), + }, + }, + }, + EntryId: Pointer(fmt.Sprintf("%dassetid-aaaa-2222-bbbb-3333cccc4444", i)), + }) + } + mockSw.On( + "BatchGetAssetPropertyValueHistoryPageAggregation", + mock.Anything, + mock.MatchedBy(func(input *iotsitewise.BatchGetAssetPropertyValueHistoryInput) bool { + return len(input.Entries) == api.BatchGetAssetPropertyValueHistoryMaxEntries + }), + mock.Anything, + mock.Anything, + ).Return(&iotsitewise.BatchGetAssetPropertyValueHistoryOutput{ + NextToken: Pointer("some-next-token-1"), + SuccessEntries: mockedSuccessEntriesFirstBatch, + }, nil) + mockedSuccessEntriesSecondBatch := []*iotsitewise.BatchGetAssetPropertyValueHistorySuccessEntry{{ + AssetPropertyValueHistory: []*iotsitewise.AssetPropertyValue{ + { + Quality: Pointer("GOOD"), + Timestamp: &iotsitewise.TimeInNanos{ + OffsetInNanos: Pointer(int64(0)), + TimeInSeconds: Pointer(int64(1612207200)), + }, + Value: &iotsitewise.Variant{ + DoubleValue: Pointer(float64(23.8)), + }, + }, + }, + EntryId: Pointer(fmt.Sprintf("%dassetid-aaaa-2222-bbbb-3333cccc4444", api.BatchGetAssetPropertyValueHistoryMaxEntries+1)), + }} + mockSw.On( + "BatchGetAssetPropertyValueHistoryPageAggregation", + mock.Anything, + mock.MatchedBy(func(input *iotsitewise.BatchGetAssetPropertyValueHistoryInput) bool { + return len(input.Entries) < api.BatchGetAssetPropertyValueHistoryMaxEntries + }), + mock.Anything, + mock.Anything, + ).Return(&iotsitewise.BatchGetAssetPropertyValueHistoryOutput{ + NextToken: Pointer("some-next-token-2"), + SuccessEntries: mockedSuccessEntriesSecondBatch, + }, nil) + mockSw.On("DescribeAssetPropertyWithContext", mock.Anything, mock.Anything).Return(&iotsitewise.DescribeAssetPropertyOutput{ + AssetName: Pointer("Demo Turbine Asset 1"), + AssetProperty: &iotsitewise.Property{ + DataType: Pointer("DOUBLE"), + Name: Pointer("Wind Speed"), + Unit: Pointer("m/s"), + }, + }, nil) + + srvr := &server.Server{ + Datasource: mockedDatasource(mockSw).(*sitewise.Datasource), + } + + sitewise.GetCache = func() *cache.Cache { + return cache.New(cache.DefaultExpiration, cache.NoExpiration) + } + + qdr, err := srvr.HandlePropertyValueHistory(context.Background(), &backend.QueryDataRequest{ + PluginContext: backend.PluginContext{}, + Queries: []backend.DataQuery{ + { + QueryType: models.QueryTypePropertyValueHistory, + RefID: "A", + MaxDataPoints: 100, + Interval: 1000, + TimeRange: timeRange, + JSON: testdata.SerializeStruct(t, models.AssetPropertyValueQuery{ + BaseQuery: models.BaseQuery{ + AwsRegion: testdata.AwsRegion, + AssetIds: []string{ + "1assetid-aaaa-2222-bbbb-3333cccc4444", + "2assetid-aaaa-2222-bbbb-3333cccc4444", + "3assetid-aaaa-2222-bbbb-3333cccc4444", + "4assetid-aaaa-2222-bbbb-3333cccc4444", + "5assetid-aaaa-2222-bbbb-3333cccc4444", + "6assetid-aaaa-2222-bbbb-3333cccc4444", + "7assetid-aaaa-2222-bbbb-3333cccc4444", + "8assetid-aaaa-2222-bbbb-3333cccc4444", + "9assetid-aaaa-2222-bbbb-3333cccc4444", + "10assetid-aaaa-2222-bbbb-3333cccc4444", + "11assetid-aaaa-2222-bbbb-3333cccc4444", + "12assetid-aaaa-2222-bbbb-3333cccc4444", + "13assetid-aaaa-2222-bbbb-3333cccc4444", + "14assetid-aaaa-2222-bbbb-3333cccc4444", + "15assetid-aaaa-2222-bbbb-3333cccc4444", + "16assetid-aaaa-2222-bbbb-3333cccc4444", + "17assetid-aaaa-2222-bbbb-3333cccc4444", + }, + }, + }), + }, + }, + }) + require.Nil(t, err) + + for i, dr := range qdr.Responses { + fname := fmt.Sprintf("%s-%s.golden", "property-history-values-with-batched-queries", i) + experimental.CheckGoldenJSONResponse(t, "../../testdata", fname, &dr, true) + } +} diff --git a/pkg/server/test/property_value_test.go b/pkg/server/test/property_value_test.go index bda6c455..e98b5106 100644 --- a/pkg/server/test/property_value_test.go +++ b/pkg/server/test/property_value_test.go @@ -2,6 +2,7 @@ package test import ( "context" + "fmt" "testing" "time" @@ -13,11 +14,13 @@ import ( "github.com/grafana/grafana-plugin-sdk-go/data" "github.com/grafana/iot-sitewise-datasource/pkg/server" "github.com/grafana/iot-sitewise-datasource/pkg/sitewise" + "github.com/grafana/iot-sitewise-datasource/pkg/testdata" "github.com/grafana/iot-sitewise-datasource/pkg/models" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" + "github.com/grafana/iot-sitewise-datasource/pkg/sitewise/api" "github.com/grafana/iot-sitewise-datasource/pkg/sitewise/client/mocks" ) @@ -77,7 +80,9 @@ func Test_property_value_query_by_asset_id_and_property_id(t *testing.T) { data.NewField("time", nil, []time.Time{time.Date(2021, 2, 1, 19, 20, 0, 0, time.UTC)}), data.NewField("Wind Speed", nil, []float64{23.8}).SetConfig(&data.FieldConfig{Unit: "m/s"}), data.NewField("quality", nil, []string{"GOOD"}), - ) + ).SetMeta(&data.FrameMeta{ + Custom: models.SitewiseCustomMeta{EntryId: "1assetid-aaaa-2222-bbbb-3333cccc4444"}, + }) if diff := cmp.Diff(expectedFrame, qdr.Responses["A"].Frames[0], data.FrameTestCompareOptions()...); diff != "" { t.Errorf("Result mismatch (-want +got):\n%s", diff) } @@ -194,7 +199,9 @@ func Test_property_value_query_by_asset_id_and_property_id_of_flatten_L4E_anomal data.NewField("prediction_reason", nil, []string{"NO_ANOMALY_DETECTED"}), data.NewField("RPM", nil, []float64{0.44856}), data.NewField("Torque", nil, []float64{0.55144}), - ) + ).SetMeta(&data.FrameMeta{ + Custom: models.SitewiseCustomMeta{EntryId: "1assetid-aaaa-2222-bbbb-3333cccc4444"}, + }) if diff := cmp.Diff(expectedFrame, qdr.Responses["A"].Frames[0], data.FrameTestCompareOptions()...); diff != "" { t.Errorf("Result mismatch (-want +got):\n%s", diff) } @@ -263,7 +270,9 @@ func Test_property_value_query_by_asset_id_and_property_id_of_struct_type(t *tes data.NewField("time", nil, []time.Time{time.Date(2021, 2, 1, 19, 20, 0, 0, time.UTC)}), data.NewField("AWS/L4E_ANOMALY_RESULT", nil, []string{structValue}).SetConfig(&data.FieldConfig{}), data.NewField("quality", nil, []string{"GOOD"}), - ) + ).SetMeta(&data.FrameMeta{ + Custom: models.SitewiseCustomMeta{EntryId: "1assetid-aaaa-2222-bbbb-3333cccc4444"}, + }) if diff := cmp.Diff(expectedFrame, qdr.Responses["A"].Frames[0], data.FrameTestCompareOptions()...); diff != "" { t.Errorf("Result mismatch (-want +got):\n%s", diff) } @@ -350,7 +359,9 @@ func Test_property_value_query_by_alias_associated_stream(t *testing.T) { data.NewField("time", nil, []time.Time{time.Date(2021, 2, 1, 19, 20, 0, 0, time.UTC)}), data.NewField("Wind Speed", nil, []float64{23.8}).SetConfig(&data.FieldConfig{Unit: "m/s"}), data.NewField("quality", nil, []string{"GOOD"}), - ) + ).SetMeta(&data.FrameMeta{ + Custom: models.SitewiseCustomMeta{EntryId: "1assetid-aaaa-2222-bbbb-3333cccc4444"}, + }) if diff := cmp.Diff(expectedFrame, qdr.Responses["A"].Frames[0], data.FrameTestCompareOptions()...); diff != "" { t.Errorf("Result mismatch (-want +got):\n%s", diff) } @@ -430,7 +441,9 @@ func Test_property_value_query_by_alias_disassociated_stream(t *testing.T) { data.NewField("time", nil, []time.Time{time.Date(2021, 2, 1, 19, 20, 0, 0, time.UTC)}), data.NewField("/amazon/renton/1/rpm", nil, []float64{23.8}).SetConfig(&data.FieldConfig{Unit: ""}), data.NewField("quality", nil, []string{"GOOD"}), - ) + ).SetMeta(&data.FrameMeta{ + Custom: models.SitewiseCustomMeta{EntryId: "61e4e1a8ab39463fa0b9418d9be2923e364f40a8b935b69d006b999516cdecef"}, + }) if diff := cmp.Diff(expectedFrame, qdr.Responses["A"].Frames[0], data.FrameTestCompareOptions()...); diff != "" { t.Errorf("Result mismatch (-want +got):\n%s", diff) } @@ -507,7 +520,9 @@ func Test_property_value_query_by_alias_disassociated_stream_with_integer_value( data.NewField("time", nil, []time.Time{time.Date(2021, 2, 1, 19, 20, 0, 0, time.UTC)}), data.NewField("/amazon/renton/1/rpm", nil, []int64{23}).SetConfig(&data.FieldConfig{Unit: ""}), data.NewField("quality", nil, []string{"GOOD"}), - ) + ).SetMeta(&data.FrameMeta{ + Custom: models.SitewiseCustomMeta{EntryId: "61e4e1a8ab39463fa0b9418d9be2923e364f40a8b935b69d006b999516cdecef"}, + }) if diff := cmp.Diff(expectedFrame, qdr.Responses["A"].Frames[0], data.FrameTestCompareOptions()...); diff != "" { t.Errorf("Result mismatch (-want +got):\n%s", diff) } @@ -581,7 +596,9 @@ func Test_property_value_query_with_empty_property_value_results(t *testing.T) { data.NewField("time", nil, []time.Time{}), data.NewField("Wind Speed", nil, []float64{}).SetConfig(&data.FieldConfig{Unit: "m/s"}), data.NewField("quality", nil, []string{}), - ) + ).SetMeta(&data.FrameMeta{ + Custom: models.SitewiseCustomMeta{EntryId: "1assetid-aaaa-2222-bbbb-3333cccc4444"}, + }) if diff := cmp.Diff(expectedFrame, qdr.Responses["A"].Frames[0], data.FrameTestCompareOptions()...); diff != "" { t.Errorf("Result mismatch (-want +got):\n%s", diff) } @@ -607,3 +624,101 @@ func Test_property_value_query_with_empty_property_value_results(t *testing.T) { }, ) } + +func Test_property_value_query_with_batched_queries(t *testing.T) { + mockSw := &mocks.SitewiseClient{} + mockedSuccessEntriesFirstBatch := []*iotsitewise.BatchGetAssetPropertyValueSuccessEntry{} + for i := 1; i <= api.BatchGetAssetPropertyValueMaxEntries; i++ { + mockedSuccessEntriesFirstBatch = append(mockedSuccessEntriesFirstBatch, &iotsitewise.BatchGetAssetPropertyValueSuccessEntry{ + AssetPropertyValue: &iotsitewise.AssetPropertyValue{ + Quality: Pointer("GOOD"), + Timestamp: &iotsitewise.TimeInNanos{ + OffsetInNanos: Pointer(int64(0)), + TimeInSeconds: Pointer(int64(1612207200)), + }, + Value: &iotsitewise.Variant{ + DoubleValue: Pointer(float64(23.8)), + }, + }, + EntryId: Pointer(fmt.Sprintf("%dassetid-aaaa-2222-bbbb-3333cccc4444", i)), + }) + } + mockSw.On("BatchGetAssetPropertyValueWithContext", mock.Anything, mock.MatchedBy(func(input *iotsitewise.BatchGetAssetPropertyValueInput) bool { + return len(input.Entries) == api.BatchGetAssetPropertyValueMaxEntries + })).Return(&iotsitewise.BatchGetAssetPropertyValueOutput{ + NextToken: Pointer("some-next-token-1"), + SuccessEntries: mockedSuccessEntriesFirstBatch, + }, nil) + mockedSuccessEntriesSecondBatch := []*iotsitewise.BatchGetAssetPropertyValueSuccessEntry{{ + AssetPropertyValue: &iotsitewise.AssetPropertyValue{ + Quality: Pointer("GOOD"), + Timestamp: &iotsitewise.TimeInNanos{ + OffsetInNanos: Pointer(int64(0)), + TimeInSeconds: Pointer(int64(1612207200)), + }, + Value: &iotsitewise.Variant{ + DoubleValue: Pointer(float64(23.8)), + }, + }, + EntryId: Pointer(fmt.Sprintf("%dassetid-aaaa-2222-bbbb-3333cccc4444", api.BatchGetAssetPropertyValueMaxEntries+1)), + }} + mockSw.On("BatchGetAssetPropertyValueWithContext", mock.Anything, mock.MatchedBy(func(input *iotsitewise.BatchGetAssetPropertyValueInput) bool { + return len(input.Entries) < api.BatchGetAssetPropertyValueMaxEntries + })).Return(&iotsitewise.BatchGetAssetPropertyValueOutput{ + NextToken: Pointer("some-next-token-2"), + SuccessEntries: mockedSuccessEntriesSecondBatch, + }, nil) + mockSw.On("DescribeAssetPropertyWithContext", mock.Anything, mock.Anything).Return(&iotsitewise.DescribeAssetPropertyOutput{ + AssetName: Pointer("Demo Turbine Asset 1"), + AssetProperty: &iotsitewise.Property{ + DataType: Pointer("DOUBLE"), + Name: Pointer("Wind Speed"), + Unit: Pointer("m/s"), + }, + }, nil) + + srvr := &server.Server{Datasource: mockedDatasource(mockSw).(*sitewise.Datasource)} + + sitewise.GetCache = func() *cache.Cache { + return cache.New(cache.DefaultExpiration, cache.NoExpiration) + } + + assetIds := []string{} + for i := 1; i <= api.BatchGetAssetPropertyValueMaxEntries+1; i++ { + assetIds = append(assetIds, fmt.Sprintf("%dassetid-aaaa-2222-bbbb-3333cccc4444", i)) + } + qdr, err := srvr.HandlePropertyValue(context.Background(), &backend.QueryDataRequest{ + PluginContext: backend.PluginContext{}, + Queries: []backend.DataQuery{ + { + RefID: "A", + QueryType: models.QueryTypePropertyValue, + TimeRange: timeRange, + JSON: testdata.SerializeStruct(t, &models.AssetPropertyValueQuery{ + BaseQuery: models.BaseQuery{ + AwsRegion: "us-west-2", + AssetIds: assetIds, + PropertyId: "11propid-aaaa-2222-bbbb-3333cccc4444", + }, + }), + }, + }, + }) + require.Nil(t, err) + _, ok := qdr.Responses["A"] + require.True(t, ok) + expectedNumFrames := api.BatchGetAssetPropertyValueMaxEntries + 1 + require.Len(t, qdr.Responses["A"].Frames, expectedNumFrames) + + for i, f := range qdr.Responses["A"].Frames { + require.NotNil(t, f) + expectedNextToken := "some-next-token-1" + if (i + 1) > api.BatchGetAssetPropertyValueMaxEntries { + expectedNextToken = "some-next-token-2" + } + require.Equal(t, f.Meta.Custom.(models.SitewiseCustomMeta).EntryId, fmt.Sprintf("%dassetid-aaaa-2222-bbbb-3333cccc4444", i+1)) + require.Equal(t, f.Meta.Custom.(models.SitewiseCustomMeta).NextToken, expectedNextToken) + } + + mockSw.AssertExpectations(t) +} diff --git a/pkg/sitewise/api/constants.go b/pkg/sitewise/api/constants.go index a3fdf168..1091ee40 100644 --- a/pkg/sitewise/api/constants.go +++ b/pkg/sitewise/api/constants.go @@ -1,8 +1,16 @@ package api const ( + // Max number of entries from: https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_BatchGetAssetPropertyAggregates.html#iotsitewise-BatchGetAssetPropertyAggregates-request-entries + BatchGetAssetPropertyAggregatesMaxEntries = 16 // Max results number from: https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_BatchGetAssetPropertyValueHistory.html#iotsitewise-BatchGetAssetPropertyValueHistory-request-maxResults BatchGetAssetPropertyValueHistoryMaxResults = 20000 + + // Max number of entries from: https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_BatchGetAssetPropertyValueHistory.html#iotsitewise-BatchGetAssetPropertyValueHistory-request-entries + BatchGetAssetPropertyValueHistoryMaxEntries = 16 // Max results number from: https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_BatchGetAssetPropertyAggregates.html#iotsitewise-BatchGetAssetPropertyAggregates-request-maxResults BatchGetAssetPropertyAggregatesMaxResults = 4000 + + // Max number of entries from: https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_BatchGetAssetPropertyValue.html#iotsitewise-BatchGetAssetPropertyValue-request-entries + BatchGetAssetPropertyValueMaxEntries = 128 ) diff --git a/pkg/sitewise/api/property_aggregate_batch.go b/pkg/sitewise/api/property_aggregate_batch.go index 13275bd9..e0c343c7 100644 --- a/pkg/sitewise/api/property_aggregate_batch.go +++ b/pkg/sitewise/api/property_aggregate_batch.go @@ -96,22 +96,22 @@ func BatchGetAssetPropertyAggregates(ctx context.Context, client client.Sitewise return models.AssetPropertyValueQuery{}, nil, err } - awsReq := aggregateBatchQueryToInput(modifiedQuery) - - resp, err := client.BatchGetAssetPropertyAggregatesPageAggregation(ctx, awsReq, modifiedQuery.MaxPageAggregations, maxDps) - - if err != nil { - return models.AssetPropertyValueQuery{}, nil, err + batchedQueries := batchQueries(modifiedQuery, BatchGetAssetPropertyAggregatesMaxEntries) + requests := []iotsitewise.BatchGetAssetPropertyAggregatesInput{} + responses := []iotsitewise.BatchGetAssetPropertyAggregatesOutput{} + for _, q := range batchedQueries { + awsReq := aggregateBatchQueryToInput(q) + requests = append(requests, *awsReq) + resp, err := client.BatchGetAssetPropertyAggregatesPageAggregation(ctx, awsReq, modifiedQuery.MaxPageAggregations, maxDps) + if err != nil { + return models.AssetPropertyValueQuery{}, nil, err + } + responses = append(responses, *resp) } return modifiedQuery, &framer.AssetPropertyAggregatesBatch{ - Request: *awsReq, - Response: iotsitewise.BatchGetAssetPropertyAggregatesOutput{ - SuccessEntries: resp.SuccessEntries, - SkippedEntries: resp.SkippedEntries, - ErrorEntries: resp.ErrorEntries, - NextToken: resp.NextToken, - }, + Requests: requests, + Responses: responses, }, nil } diff --git a/pkg/sitewise/api/property_history_batch.go b/pkg/sitewise/api/property_history_batch.go index 5adbef3a..6dd1948d 100644 --- a/pkg/sitewise/api/property_history_batch.go +++ b/pkg/sitewise/api/property_history_batch.go @@ -79,10 +79,15 @@ func BatchGetAssetPropertyValues(ctx context.Context, client client.SitewiseClie return models.AssetPropertyValueQuery{}, nil, err } - awsReq := historyBatchQueryToInput(modifiedQuery) - resp, err := client.BatchGetAssetPropertyValueHistoryPageAggregation(ctx, awsReq, query.MaxPageAggregations, maxDps) - if err != nil { - return models.AssetPropertyValueQuery{}, nil, err + batchedQueries := batchQueries(modifiedQuery, BatchGetAssetPropertyValueHistoryMaxEntries) + responses := []*iotsitewise.BatchGetAssetPropertyValueHistoryOutput{} + for _, q := range batchedQueries { + awsReq := historyBatchQueryToInput(q) + resp, err := client.BatchGetAssetPropertyValueHistoryPageAggregation(ctx, awsReq, query.MaxPageAggregations, maxDps) + if err != nil { + return models.AssetPropertyValueQuery{}, nil, err + } + responses = append(responses, resp) } anomalyAssetIds := []string{} @@ -95,10 +100,10 @@ func BatchGetAssetPropertyValues(ctx context.Context, client client.SitewiseClie return modifiedQuery, &framer.AssetPropertyValueHistoryBatch{ - BatchGetAssetPropertyValueHistoryOutput: resp, - Query: modifiedQuery, - AnomalyAssetIds: anomalyAssetIds, - SitewiseClient: client, + Responses: responses, + Query: modifiedQuery, + AnomalyAssetIds: anomalyAssetIds, + SitewiseClient: client, }, nil } diff --git a/pkg/sitewise/api/property_value_batch.go b/pkg/sitewise/api/property_value_batch.go index 09628c30..5d20b747 100644 --- a/pkg/sitewise/api/property_value_batch.go +++ b/pkg/sitewise/api/property_value_batch.go @@ -48,11 +48,15 @@ func BatchGetAssetPropertyValue(ctx context.Context, client client.SitewiseClien return models.AssetPropertyValueQuery{}, nil, err } - req := valueBatchQueryToInput(modifiedQuery) - - resp, err := client.BatchGetAssetPropertyValueWithContext(ctx, req) - if err != nil { - return models.AssetPropertyValueQuery{}, nil, err + batchedQueries := batchQueries(modifiedQuery, BatchGetAssetPropertyValueMaxEntries) + responses := []*iotsitewise.BatchGetAssetPropertyValueOutput{} + for _, q := range batchedQueries { + req := valueBatchQueryToInput(q) + resp, err := client.BatchGetAssetPropertyValueWithContext(ctx, req) + if err != nil { + return models.AssetPropertyValueQuery{}, nil, err + } + responses = append(responses, resp) } anomalyAssetIds := []string{} @@ -65,9 +69,9 @@ func BatchGetAssetPropertyValue(ctx context.Context, client client.SitewiseClien return modifiedQuery, &framer.AssetPropertyValueBatch{ - BatchGetAssetPropertyValueOutput: resp, - AnomalyAssetIds: anomalyAssetIds, - SitewiseClient: client, + Responses: responses, + AnomalyAssetIds: anomalyAssetIds, + SitewiseClient: client, }, nil } diff --git a/pkg/sitewise/api/util.go b/pkg/sitewise/api/util.go index d52cfce3..95efd04c 100644 --- a/pkg/sitewise/api/util.go +++ b/pkg/sitewise/api/util.go @@ -2,6 +2,7 @@ package api import ( "context" + "math" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/iotsitewise" @@ -103,3 +104,45 @@ func filterAnomalyAssetIds(ctx context.Context, client client.SitewiseClient, qu return anomalyAssetIds, nil } + +func batchQueries(query models.AssetPropertyValueQuery, maxBatchSize int) []models.AssetPropertyValueQuery { + numAssetIds := len(query.AssetIds) + if numAssetIds <= maxBatchSize { + return []models.AssetPropertyValueQuery{query} + } + + queries := []models.AssetPropertyValueQuery{} + if len(query.NextTokens) > 0 { + assetIdsGroupedByNextToken := map[string][]string{} + for _, id := range query.AssetIds { + nextToken := query.NextTokens[id] + if _, exists := assetIdsGroupedByNextToken[nextToken]; exists { + assetIdsGroupedByNextToken[nextToken] = append(assetIdsGroupedByNextToken[nextToken], id) + } else { + ids := []string{id} + assetIdsGroupedByNextToken[nextToken] = ids + } + } + for _, v := range assetIdsGroupedByNextToken { + q := query + q.AssetIds = v + queries = append(queries, q) + } + } else { + var idx = 0 + numBatches := int(math.Ceil(float64(numAssetIds) / float64(maxBatchSize))) + for i := 0; i < numBatches; i++ { + q := query + batchEndIndex := idx + maxBatchSize + if batchEndIndex <= numAssetIds { + q.AssetIds = query.AssetIds[idx:batchEndIndex] + idx += maxBatchSize + } else { + q.AssetIds = query.AssetIds[idx:] + } + queries = append(queries, q) + } + } + + return queries +} diff --git a/pkg/testdata/prop-val-for-time-range-1d-data-for-time-range-A.golden.jsonc b/pkg/testdata/prop-val-for-time-range-1d-data-for-time-range-A.golden.jsonc index cb627c1e..e8322e40 100644 --- a/pkg/testdata/prop-val-for-time-range-1d-data-for-time-range-A.golden.jsonc +++ b/pkg/testdata/prop-val-for-time-range-1d-data-for-time-range-A.golden.jsonc @@ -7,6 +7,7 @@ // ], // "custom": { // "nextToken": "Pbb7bb96ab41b718aabab1b1f0c64327b=AYADeEhsb/CNkFHmzaVMewZvIzUAXwABABVhd3MtY3J5cHRvLXB1YmxpYy1rZXkAREF3U2pCbnI0aWJSczhES05McUdoMVdGVEVFU1BOMUQzZmxOLzBLMUEwWnFBUXdQY3Jab25mZmxMZWtnYkdKZnNWZz09AAEAA0FTTQA0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SBoR1cLSrdP61UXriSvcGRvZD4L/X+vwETdTt6/ImYeUHZ7HctZi/TZ2ZJrScZtSJRfwiQw8HDY7MAZzBlAjBap+46gGu5sWmQ2Y9r1SBt3UTrF2Jqw8tE1u8CAQ1zxNfy5E+bE15pgN8OgfH6svUCMQDt4wVCf9vbc44MTFQYmoiIe1VBizp0lHMUptYC/oFWzfy/yhDQ4XDdTBXSbA9gZK4=", +// "entryId": "e64c9075-9d89-47cb-8ee5-d3251bd253f4", // "resolution": "1d", // "aggregates": [ // "avg" @@ -47,6 +48,7 @@ ], "custom": { "nextToken": "Pbb7bb96ab41b718aabab1b1f0c64327b=AYADeEhsb/CNkFHmzaVMewZvIzUAXwABABVhd3MtY3J5cHRvLXB1YmxpYy1rZXkAREF3U2pCbnI0aWJSczhES05McUdoMVdGVEVFU1BOMUQzZmxOLzBLMUEwWnFBUXdQY3Jab25mZmxMZWtnYkdKZnNWZz09AAEAA0FTTQA0YmI3YmI5NmFiNDFiNzE4YWFiYWIxYjFmMGM2NDMyN2IAAACAAAAADB8WXnM7VjhaB5/QIQAwVrqkP3Z3210py/B8F9wPsdFv9Lja7PAhWiLSdpoA3ejPGACbZ8uPt6otukNYV607AgAAAAAMAAAQAAAAAAAAAAAAAAAAAM2cAITzrrofJlVBsHfLl9D/////AAAAAQAAAAAAAAAAAAAAAQAAArGunNpIP7QEUmwfQzDhQ5eq/RnaTtm1BCHifxpR3oqYpRXy5kBR25bwJIsneC7u2Pun8wnCl5ayCHgxWopOQFDiu7S6/cjdL3xPlDSujxnuFRZTBqI32mSHc/Hr9aKcZjGKoWPNLjKDQnW43QVFcUEzH/RS97U180KhnZc4UiDSxKvtDY+osJgiksl3pjrk1wqF0ftP8z8e5YsPogsujJEfcCcCVXlzcSiVUSwwn0TCsZXtS/FEml6UlARJOdJUN7uGaeEUMqboQzb8Ax2cvdBwXqYEhfKp4LTGLv3qBHm28qylphVL88pWgSqlDAtlwvs3KAZQGaFjyGXBdNruJZRdqosk4SDE95SzuL9zFdjnbR37UHe99yuUE4iN1VYX+MHE+XoxGBOhgTWFdSchLIj8+8xdlyfjwnMFw/F0PcuUCQZEJtkjfiLmbN+gzKs7Lwpyy/FnBBmtbRmmh0RbNh+gJ7Rt4k8FFkUPrshmg4mjdb1eu/Ufbifkpz4ZBZqWeEvSWiCo5N7OBl7TiPu9c2SReBFHPJsPh1PqVg5aILatfY3YeJOfoQfKsH1mX8jp0QQKWo3Fz4UZ1rUSK4IOfJq2tUybGILAkc9IUPvcHGA/3VFimpvqnHwkKgzFFLb4qNNyks1M9WCT7q2yq0c1ujEqRg8mMB1ENBhcofGsrJeav77/mLPV75qaevwpLOPmHwSXvS6zc5V3E/abG8p6u/+oJkNFdGsWfGRhqxrAVB/rmEPvppEEn+PGpZRlyrT13VWfuiENIujoMDSCJl3K90YhT0uOLSP91VJA+9gI8LFXi4jq7hk4YmloF09MLKgdIE+4IWaddrManMCUuW4N+rmjbs7jCa/6IqSBoR1cLSrdP61UXriSvcGRvZD4L/X+vwETdTt6/ImYeUHZ7HctZi/TZ2ZJrScZtSJRfwiQw8HDY7MAZzBlAjBap+46gGu5sWmQ2Y9r1SBt3UTrF2Jqw8tE1u8CAQ1zxNfy5E+bE15pgN8OgfH6svUCMQDt4wVCf9vbc44MTFQYmoiIe1VBizp0lHMUptYC/oFWzfy/yhDQ4XDdTBXSbA9gZK4=", + "entryId": "e64c9075-9d89-47cb-8ee5-d3251bd253f4", "resolution": "1d", "aggregates": [ "avg" diff --git a/pkg/testdata/prop-val-for-time-range-1d-data-for-time-range-from-alias-A.golden.jsonc b/pkg/testdata/prop-val-for-time-range-1d-data-for-time-range-from-alias-A.golden.jsonc index cb627c1e..e8322e40 100644 --- a/pkg/testdata/prop-val-for-time-range-1d-data-for-time-range-from-alias-A.golden.jsonc +++ b/pkg/testdata/prop-val-for-time-range-1d-data-for-time-range-from-alias-A.golden.jsonc @@ -7,6 +7,7 @@ // ], // "custom": { // "nextToken": "Pbb7bb96ab41b718aabab1b1f0c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V75qaevwpLOPmHwSXvS6zc5V3E/abG8p6u/+oJkNFdGsWfGRhqxrAVB/rmEPvppEEn+PGpZRlyrT13VWfuiENIujoMDSCJl3K90YhT0uOLSP91VJA+9gI8LFXi4jq7hk4YmloF09MLKgdIE+4IWaddrManMCUuW4N+rmjbs7jCa/6IqSBoR1cLSrdP61UXriSvcGRvZD4L/X+vwETdTt6/ImYeUHZ7HctZi/TZ2ZJrScZtSJRfwiQw8HDY7MAZzBlAjBap+46gGu5sWmQ2Y9r1SBt3UTrF2Jqw8tE1u8CAQ1zxNfy5E+bE15pgN8OgfH6svUCMQDt4wVCf9vbc44MTFQYmoiIe1VBizp0lHMUptYC/oFWzfy/yhDQ4XDdTBXSbA9gZK4=", +// "entryId": "e64c9075-9d89-47cb-8ee5-d3251bd253f4", // "resolution": "1d", // "aggregates": [ // "avg" @@ -47,6 +48,7 @@ ], "custom": { "nextToken": "Pbb7bb96ab41b718aabab1b1f0c64327b=AYADeEhsb/CNkFHmzaVMewZvIzUAXwABABVhd3MtY3J5cHRvLXB1YmxpYy1rZXkAREF3U2pCbnI0aWJSczhES05McUdoMVdGVEVFU1BOMUQzZmxOLzBLMUEwWnFBUXdQY3Jab25mZmxMZWtnYkdKZnNWZz09AAEAA0FTTQA0YmI3YmI5NmFiNDFiNzE4YWFiYWIxYjFmMGM2NDMyN2IAAACAAAAADB8WXnM7VjhaB5/QIQAwVrqkP3Z3210py/B8F9wPsdFv9Lja7PAhWiLSdpoA3ejPGACbZ8uPt6otukNYV607AgAAAAAMAAAQAAAAAAAAAAAAAAAAAM2cAITzrrofJlVBsHfLl9D/////AAAAAQAAAAAAAAAAAAAAAQAAArGunNpIP7QEUmwfQzDhQ5eq/RnaTtm1BCHifxpR3oqYpRXy5kBR25bwJIsneC7u2Pun8wnCl5ayCHgxWopOQFDiu7S6/cjdL3xPlDSujxnuFRZTBqI32mSHc/Hr9aKcZjGKoWPNLjKDQnW43QVFcUEzH/RS97U180KhnZc4UiDSxKvtDY+osJgiksl3pjrk1wqF0ftP8z8e5YsPogsujJEfcCcCVXlzcSiVUSwwn0TCsZXtS/FEml6UlARJOdJUN7uGaeEUMqboQzb8Ax2cvdBwXqYEhfKp4LTGLv3qBHm28qylphVL88pWgSqlDAtlwvs3KAZQGaFjyGXBdNruJZRdqosk4SDE95SzuL9zFdjnbR37UHe99yuUE4iN1VYX+MHE+XoxGBOhgTWFdSchLIj8+8xdlyfjwnMFw/F0PcuUCQZEJtkjfiLmbN+gzKs7Lwpyy/FnBBmtbRmmh0RbNh+gJ7Rt4k8FFkUPrshmg4mjdb1eu/Ufbifkpz4ZBZqWeEvSWiCo5N7OBl7TiPu9c2SReBFHPJsPh1PqVg5aILatfY3YeJOfoQfKsH1mX8jp0QQKWo3Fz4UZ1rUSK4IOfJq2tUybGILAkc9IUPvcHGA/3VFimpvqnHwkKgzFFLb4qNNyks1M9WCT7q2yq0c1ujEqRg8mMB1ENBhcofGsrJeav77/mLPV75qaevwpLOPmHwSXvS6zc5V3E/abG8p6u/+oJkNFdGsWfGRhqxrAVB/rmEPvppEEn+PGpZRlyrT13VWfuiENIujoMDSCJl3K90YhT0uOLSP91VJA+9gI8LFXi4jq7hk4YmloF09MLKgdIE+4IWaddrManMCUuW4N+rmjbs7jCa/6IqSBoR1cLSrdP61UXriSvcGRvZD4L/X+vwETdTt6/ImYeUHZ7HctZi/TZ2ZJrScZtSJRfwiQw8HDY7MAZzBlAjBap+46gGu5sWmQ2Y9r1SBt3UTrF2Jqw8tE1u8CAQ1zxNfy5E+bE15pgN8OgfH6svUCMQDt4wVCf9vbc44MTFQYmoiIe1VBizp0lHMUptYC/oFWzfy/yhDQ4XDdTBXSbA9gZK4=", + "entryId": "e64c9075-9d89-47cb-8ee5-d3251bd253f4", "resolution": "1d", "aggregates": [ "avg" diff --git a/pkg/testdata/prop-val-for-time-range-1h-data-for-time-range-A.golden.jsonc b/pkg/testdata/prop-val-for-time-range-1h-data-for-time-range-A.golden.jsonc index bea0c471..96aaf72a 100644 --- a/pkg/testdata/prop-val-for-time-range-1h-data-for-time-range-A.golden.jsonc +++ b/pkg/testdata/prop-val-for-time-range-1h-data-for-time-range-A.golden.jsonc @@ -7,6 +7,7 @@ // ], // "custom": { // "nextToken": "Pbb7bb96ab41b718aabab1b1f0c64327b=AYADeEhsb/CNkFHmzaVMewZvIzUAXwABABVhd3MtY3J5cHRvLXB1YmxpYy1rZXkAREF3U2pCbnI0aWJSczhES05McUdoMVdGVEVFU1BOMUQzZmxOLzBLMUEwWnFBUXdQY3Jab25mZmxMZWtnYkdKZnNWZz09AAEAA0FTTQA0YmI3YmI5NmFiNDFiNzE4YWFiYWIxYjFmMGM2NDMyN2IAAACAAAAADB8WXnM7VjhaB5/QIQAwVrqkP3Z3210py/B8F9wPsdFv9Lja7PAhWiLSdpoA3ejPGACbZ8uPt6otukNYV607AgAAAAAMAAAQAAAAAAAAAAAAAAAAAM2cAITzrrofJlVBsHfLl9D/////AAAAAQAAAAAAAAAAAAAAAQAAArGunNpIP7QEUmwfQzDhQ5eq/RnaTtm1BCHifxpR3oqYpRXy5kBR25bwJIsneC7u2Pun8wnCl5ayCHgxWopOQFDiu7S6/cjdL3xPlDSujxnuFRZTBqI32mSHc/Hr9aKcZjGKoWPNLjKDQnW43QVFcUEzH/RS97U180KhnZc4UiDSxKvtDY+osJgiksl3pjrk1wqF0ftP8z8e5YsPogsujJEfcCcCVXlzcSiVUSwwn0TCsZXtS/FEml6UlARJOdJUN7uGaeEUMqboQzb8Ax2cvdBwXqYEhfKp4LTGLv3qBHm28qylphVL88pWgSqlDAtlwvs3KAZQGaFjyGXBdNruJZRdqosk4SDE95SzuL9zFdjnbR37UHe99yuUE4iN1VYX+MHE+XoxGBOhgTWFdSchLIj8+8xdlyfjwnMFw/F0PcuUCQZEJtkjfiLmbN+gzKs7Lwpyy/FnBBmtbRmmh0RbNh+gJ7Rt4k8FFkUPrshmg4mjdb1eu/Ufbifkpz4ZBZqWeEvSWiCo5N7OBl7TiPu9c2SReBFHPJsPh1PqVg5aILatfY3YeJOfoQfKsH1mX8jp0QQKWo3Fz4UZ1rUSK4IOfJq2tUybGILAkc9IUPvcHGA/3VFimpvqnHwkKgzFFLb4qNNyks1M9WCT7q2yq0c1ujEqRg8mMB1ENBhcofGsrJeav77/mLPV75qaevwpLOPmHwSXvS6zc5V3E/abG8p6u/+oJkNFdGsWfGRhqxrAVB/rmEPvppEEn+PGpZRlyrT13VWfuiENIujoMDSCJl3K90YhT0uOLSP91VJA+9gI8LFXi4jq7hk4YmloF09MLKgdIE+4IWaddrManMCUuW4N+rmjbs7jCa/6IqSBoR1cLSrdP61UXriSvcGRvZD4L/X+vwETdTt6/ImYeUHZ7HctZi/TZ2ZJrScZtSJRfwiQw8HDY7MAZzBlAjBap+46gGu5sWmQ2Y9r1SBt3UTrF2Jqw8tE1u8CAQ1zxNfy5E+bE15pgN8OgfH6svUCMQDt4wVCf9vbc44MTFQYmoiIe1VBizp0lHMUptYC/oFWzfy/yhDQ4XDdTBXSbA9gZK4=", +// "entryId": "e64c9075-9d89-47cb-8ee5-d3251bd253f4", // "resolution": "1h", // "aggregates": [ // "avg" @@ -47,6 +48,7 @@ ], "custom": { "nextToken": "Pbb7bb96ab41b718aabab1b1f0c64327b=AYADeEhsb/CNkFHmzaVMewZvIzUAXwABABVhd3MtY3J5cHRvLXB1YmxpYy1rZXkAREF3U2pCbnI0aWJSczhES05McUdoMVdGVEVFU1BOMUQzZmxOLzBLMUEwWnFBUXdQY3Jab25mZmxMZWtnYkdKZnNWZz09AAEAA0FTTQA0YmI3YmI5NmFiNDFiNzE4YWFiYWIxYjFmMGM2NDMyN2IAAACAAAAADB8WXnM7VjhaB5/QIQAwVrqkP3Z3210py/B8F9wPsdFv9Lja7PAhWiLSdpoA3ejPGACbZ8uPt6otukNYV607AgAAAAAMAAAQAAAAAAAAAAAAAAAAAM2cAITzrrofJlVBsHfLl9D/////AAAAAQAAAAAAAAAAAAAAAQAAArGunNpIP7QEUmwfQzDhQ5eq/RnaTtm1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b-8ee5-d3251bd253f4", "resolution": "1h", "aggregates": [ "avg" diff --git a/pkg/testdata/prop-val-for-time-range-1h-data-for-time-range-from-alias-A.golden.jsonc b/pkg/testdata/prop-val-for-time-range-1h-data-for-time-range-from-alias-A.golden.jsonc index bea0c471..96aaf72a 100644 --- a/pkg/testdata/prop-val-for-time-range-1h-data-for-time-range-from-alias-A.golden.jsonc +++ b/pkg/testdata/prop-val-for-time-range-1h-data-for-time-range-from-alias-A.golden.jsonc @@ -7,6 +7,7 @@ // ], // "custom": { // "nextToken": "Pbb7bb96ab41b718aabab1b1f0c64327b=AYADeEhsb/CNkFHmzaVMewZvIzUAXwABABVhd3MtY3J5cHRvLXB1YmxpYy1rZXkAREF3U2pCbnI0aWJSczhES05McUdoMVdGVEVFU1BOMUQzZmxOLzBLMUEwWnFBUXdQY3Jab25mZmxMZWtnYkdKZnNWZz09AAEAA0FTTQA0YmI3YmI5NmFiNDFiNzE4YWFiYWIxYjFmMGM2NDMyN2IAAACAAAAADB8WXnM7VjhaB5/QIQAwVrqkP3Z3210py/B8F9wPsdFv9Lja7PAhWiLSdpoA3ejPGACbZ8uPt6otukNYV607AgAAAAAMAAAQAAAAAAAAAAAAAAAAAM2cAITzrrofJlVBsHfLl9D/////AAAAAQAAAAAAAAAAAAAAAQAAArGunNpIP7QEUmwfQzDhQ5eq/RnaTtm1BCHifxpR3oqYpRXy5kBR25bwJIsneC7u2Pun8wnCl5ayCHgxWopOQFDiu7S6/cjdL3xPlDSujxnuFRZTBqI32mSHc/Hr9aKcZjGKoWPNLjKDQnW43QVFcUEzH/RS97U180KhnZc4UiDSxKvtDY+osJgiksl3pjrk1wqF0ftP8z8e5YsPogsujJEfcCcCVXlzcSiVUSwwn0TCsZXtS/FEml6UlARJOdJUN7uGaeEUMqboQzb8Ax2cvdBwXqYEhfKp4LTGLv3qBHm28qylphVL88pWgSqlDAtlwvs3KAZQGaFjyGXBdNruJZRdqosk4SDE95SzuL9zFdjnbR37UHe99yuUE4iN1VYX+MHE+XoxGBOhgTWFdSchLIj8+8xdlyfjwnMFw/F0PcuUCQZEJtkjfiLmbN+gzKs7Lwpyy/FnBBmtbRmmh0RbNh+gJ7Rt4k8FFkUPrshmg4mjdb1eu/Ufbifkpz4ZBZqWeEvSWiCo5N7OBl7TiPu9c2SReBFHPJsPh1PqVg5aILatfY3YeJOfoQfKsH1mX8jp0QQKWo3Fz4UZ1rUSK4IOfJq2tUybGILAkc9IUPvcHGA/3VFimpvqnHwkKgzFFLb4qNNyks1M9WCT7q2yq0c1ujEqRg8mMB1ENBhcofGsrJeav77/mLPV75qaevwpLOPmHwSXvS6zc5V3E/abG8p6u/+oJkNFdGsWfGRhqxrAVB/rmEPvppEEn+PGpZRlyrT13VWfuiENIujoMDSCJl3K90YhT0uOLSP91VJA+9gI8LFXi4jq7hk4YmloF09MLKgdIE+4IWaddrManMCUuW4N+rmjbs7jCa/6IqSBoR1cLSrdP61UXriSvcGRvZD4L/X+vwETdTt6/ImYeUHZ7HctZi/TZ2ZJrScZtSJRfwiQw8HDY7MAZzBlAjBap+46gGu5sWmQ2Y9r1SBt3UTrF2Jqw8tE1u8CAQ1zxNfy5E+bE15pgN8OgfH6svUCMQDt4wVCf9vbc44MTFQYmoiIe1VBizp0lHMUptYC/oFWzfy/yhDQ4XDdTBXSbA9gZK4=", +// "entryId": "e64c9075-9d89-47cb-8ee5-d3251bd253f4", // "resolution": "1h", // "aggregates": [ // "avg" @@ -47,6 +48,7 @@ ], "custom": { "nextToken": "Pbb7bb96ab41b718aabab1b1f0c64327b=AYADeEhsb/CNkFHmzaVMewZvIzUAXwABABVhd3MtY3J5cHRvLXB1YmxpYy1rZXkAREF3U2pCbnI0aWJSczhES05McUdoMVdGVEVFU1BOMUQzZmxOLzBLMUEwWnFBUXdQY3Jab25mZmxMZWtnYkdKZnNWZz09AAEAA0FTTQA0YmI3YmI5NmFiNDFiNzE4YWFiYWIxYjFmMGM2NDMyN2IAAACAAAAADB8WXnM7VjhaB5/QIQAwVrq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7MAZzBlAjBap+46gGu5sWmQ2Y9r1SBt3UTrF2Jqw8tE1u8CAQ1zxNfy5E+bE15pgN8OgfH6svUCMQDt4wVCf9vbc44MTFQYmoiIe1VBizp0lHMUptYC/oFWzfy/yhDQ4XDdTBXSbA9gZK4=", + "entryId": "e64c9075-9d89-47cb-8ee5-d3251bd253f4", "resolution": "1h", "aggregates": [ "avg" diff --git a/pkg/testdata/prop-val-for-time-range-1m-data-for-reduced-max-data-point-A.golden.jsonc b/pkg/testdata/prop-val-for-time-range-1m-data-for-reduced-max-data-point-A.golden.jsonc index 668bbc75..65b5478f 100644 --- a/pkg/testdata/prop-val-for-time-range-1m-data-for-reduced-max-data-point-A.golden.jsonc +++ b/pkg/testdata/prop-val-for-time-range-1m-data-for-reduced-max-data-point-A.golden.jsonc @@ -7,6 +7,7 @@ // ], // "custom": { // "nextToken": "Pbb7bb96ab41b718aabab1b1f0c64327b=AYADeEhsb/CNkFHmzaVMewZvIzUAXwABABVhd3MtY3J5cHRvLXB1YmxpYy1rZXkAREF3U2pCbnI0aWJSczhES05McUdoMVdGVEVFU1BOMUQzZmxOLzBLMUEwWnFBUXdQY3Jab25mZmxMZWtnYkdKZnNWZz09AAEAA0FTTQA0YmI3YmI5NmFiNDFiNzE4YWFiYWIxYjFmMGM2NDMyN2IAAACAAAAADB8WXnM7VjhaB5/QIQAwVrqkP3Z3210py/B8F9wPsdFv9Lja7PAhWiLSdpoA3ejPGACbZ8uPt6otukNYV607AgAAAAAMAAAQAAAAAAAAAAAAAAAAAM2cAITzrrofJlVBsHfLl9D/////AAAAAQAAAAAAAAAAAAAAAQAAArGunNpIP7QEUmwfQzDhQ5eq/RnaTtm1BCHifxpR3oqYpRXy5kBR25bwJIsneC7u2Pun8wnCl5ayCHgxWopOQFDiu7S6/cjdL3xPlDSujxnuFRZTBqI32mSHc/Hr9aKcZjGKoWPNLjKDQnW43QVFcUEzH/RS97U180KhnZc4UiDSxKvtDY+osJgiksl3pjrk1wqF0ftP8z8e5YsPogsujJEfcCcCVXlzcSiVUSwwn0TCsZXtS/FEml6UlARJOdJUN7uGaeEUMqboQzb8Ax2cvdBwXqYEhfKp4LTGLv3qBHm28qylphVL88pWgSqlDAtlwvs3KAZQGaFjyGXBdNruJZRdqosk4SDE95SzuL9zFdjnbR37UHe99yuUE4iN1VYX+MHE+XoxGBOhgTWFdSchLIj8+8xdlyfjwnMFw/F0PcuUCQZEJtkjfiLmbN+gzKs7Lwpyy/FnBBmtbRmmh0RbNh+gJ7Rt4k8FFkUPrshmg4mjdb1eu/Ufbifkpz4ZBZqWeEvSWiCo5N7OBl7TiPu9c2SReBFHPJsPh1PqVg5aILatfY3YeJOfoQfKsH1mX8jp0QQKWo3Fz4UZ1rUSK4IOfJq2tUybGILAkc9IUPvcHGA/3VFimpvqnHwkKgzFFLb4qNNyks1M9WCT7q2yq0c1ujEqRg8mMB1ENBhcofGsrJeav77/mLPV75qaevwpLOPmHwSXvS6zc5V3E/abG8p6u/+oJkNFdGsWfGRhqxrAVB/rmEPvppEEn+PGpZRlyrT13VWfuiENIujoMDSCJl3K90YhT0uOLSP91VJA+9gI8LFXi4jq7hk4YmloF09MLKgdIE+4IWaddrManMCUuW4N+rmjbs7jCa/6IqSBoR1cLSrdP61UXriSvcGRvZD4L/X+vwETdTt6/ImYeUHZ7HctZi/TZ2ZJrScZtSJRfwiQw8HDY7MAZzBlAjBap+46gGu5sWmQ2Y9r1SBt3UTrF2Jqw8tE1u8CAQ1zxNfy5E+bE15pgN8OgfH6svUCMQDt4wVCf9vbc44MTFQYmoiIe1VBizp0lHMUptYC/oFWzfy/yhDQ4XDdTBXSbA9gZK4=", +// "entryId": "e64c9075-9d89-47cb-8ee5-d3251bd253f4", // "resolution": "1m", // "aggregates": [ // "avg" @@ -47,6 +48,7 @@ ], "custom": { "nextToken": "Pbb7bb96ab41b718aabab1b1f0c64327b=AYADeEhsb/CNkFHmzaVMewZvIzUAXwABABVhd3MtY3J5cHRvLXB1YmxpYy1rZXkAREF3U2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yrT13VWfuiENIujoMDSCJl3K90YhT0uOLSP91VJA+9gI8LFXi4jq7hk4YmloF09MLKgdIE+4IWaddrManMCUuW4N+rmjbs7jCa/6IqSBoR1cLSrdP61UXriSvcGRvZD4L/X+vwETdTt6/ImYeUHZ7HctZi/TZ2ZJrScZtSJRfwiQw8HDY7MAZzBlAjBap+46gGu5sWmQ2Y9r1SBt3UTrF2Jqw8tE1u8CAQ1zxNfy5E+bE15pgN8OgfH6svUCMQDt4wVCf9vbc44MTFQYmoiIe1VBizp0lHMUptYC/oFWzfy/yhDQ4XDdTBXSbA9gZK4=", + "entryId": "e64c9075-9d89-47cb-8ee5-d3251bd253f4", "resolution": "1m", "aggregates": [ "avg" diff --git a/pkg/testdata/prop-val-for-time-range-1m-data-for-reduced-max-data-point-from-alias-A.golden.jsonc b/pkg/testdata/prop-val-for-time-range-1m-data-for-reduced-max-data-point-from-alias-A.golden.jsonc index 668bbc75..65b5478f 100644 --- a/pkg/testdata/prop-val-for-time-range-1m-data-for-reduced-max-data-point-from-alias-A.golden.jsonc +++ b/pkg/testdata/prop-val-for-time-range-1m-data-for-reduced-max-data-point-from-alias-A.golden.jsonc @@ -7,6 +7,7 @@ // ], // "custom": { // "nextToken": "Pbb7bb96ab41b718aabab1b1f0c64327b=AYADeEhsb/CNkFHmzaVMewZvIzUAXwABABVhd3MtY3J5cHRvLXB1YmxpYy1rZXkAREF3U2pCbnI0aWJSczhES05McUdoMVdGVEVFU1BOMUQzZmxOLzBLMUEwWnFBUXdQY3Jab25mZmxMZWtnYkdKZnNWZz09AAEAA0FTTQA0YmI3YmI5NmFiNDFiNzE4YWFiYWIxYjFmMGM2NDMyN2IAAACAAAAADB8WXnM7VjhaB5/QIQAwVrqkP3Z3210py/B8F9wPsdFv9Lja7PAhWiLSdpoA3ejPGACbZ8uPt6otukNYV607AgAAAAAMAAAQAAAAAAAAAAAAAAAAAM2cAITzrrofJlVBsHfLl9D/////AAAAAQAAAAAAAAAAAAAAAQAAArGunNpIP7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K4=", +// "entryId": "e64c9075-9d89-47cb-8ee5-d3251bd253f4", // "resolution": "1m", // "aggregates": [ // "avg" @@ -47,6 +48,7 @@ ], "custom": { "nextToken": "Pbb7bb96ab41b718aabab1b1f0c64327b=AYADeEhsb/CNkFHmzaVMewZvIzUAXwABABVhd3MtY3J5cHRvLXB1YmxpYy1rZXkAREF3U2pCbnI0aWJSczhES05McUdoMVdGVEVFU1BOMUQzZmxOLzBLMUEwWnFBUXdQY3Jab25mZmxMZWtnYkdKZnNWZz09AAEAA0FTTQA0YmI3YmI5NmFiNDFiNzE4YWFiYWIxYjFmMGM2NDMyN2IAAACAAAAADB8WXnM7VjhaB5/QIQAwVrqkP3Z3210py/B8F9wPsdFv9Lja7PAhWiLSdpoA3ejPGACbZ8uPt6otukNYV607AgAAAAAMAAAQAAAAAAAAAAAAAAAAAM2cAITzrrofJlVBsHfLl9D/////AAAAAQAAAAAAAAAAAAAAAQAAArGunNpIP7QEUmwfQzDhQ5eq/RnaTtm1BCHifxpR3oqYpRXy5kBR25bwJIsneC7u2Pun8wnCl5ayCHgxWopOQFDiu7S6/cjdL3xPlDSujxnuFRZTBqI32mSHc/Hr9aKcZjGKoWPNLjKDQnW43QVFcUEzH/RS97U180KhnZc4UiDSxKvtDY+osJgiksl3pjrk1wqF0ftP8z8e5YsPogsujJEfcCcCVXlzcSiVUSwwn0TCsZXtS/FEml6UlARJOdJUN7uGaeEUMqboQzb8Ax2cvdBwXqYEhfKp4LTGLv3qBHm28qylphVL88pWgSqlDAtlwvs3KAZQGaFjyGXBdNruJZRdqosk4SDE95SzuL9zFdjnbR37UHe99yuUE4iN1VYX+MHE+XoxGBOhgTWFdSchLIj8+8xdlyfjwnMFw/F0PcuUCQZEJtkjfiLmbN+gzKs7Lwpyy/FnBBmtbRmmh0RbNh+gJ7Rt4k8FFkUPrshmg4mjdb1eu/Ufbifkpz4ZBZqWeEvSWiCo5N7OBl7TiPu9c2SReBFHPJsPh1PqVg5aILatfY3YeJOfoQfKsH1mX8jp0QQKWo3Fz4UZ1rUSK4IOfJq2tUybGILAkc9IUPvcHGA/3VFimpvqnHwkKgzFFLb4qNNyks1M9WCT7q2yq0c1ujEqRg8mMB1ENBhcofGsrJeav77/mLPV75qaevwpLOPmHwSXvS6zc5V3E/abG8p6u/+oJkNFdGsWfGRhqxrAVB/rmEPvppEEn+PGpZRlyrT13VWfuiENIujoMDSCJl3K90YhT0uOLSP91VJA+9gI8LFXi4jq7hk4YmloF09MLKgdIE+4IWaddrManMCUuW4N+rmjbs7jCa/6IqSBoR1cLSrdP61UXriSvcGRvZD4L/X+vwETdTt6/ImYeUHZ7HctZi/TZ2ZJrScZtSJRfwiQw8HDY7MAZzBlAjBap+46gGu5sWmQ2Y9r1SBt3UTrF2Jqw8tE1u8CAQ1zxNfy5E+bE15pgN8OgfH6svUCMQDt4wVCf9vbc44MTFQYmoiIe1VBizp0lHMUptYC/oFWzfy/yhDQ4XDdTBXSbA9gZK4=", + "entryId": "e64c9075-9d89-47cb-8ee5-d3251bd253f4", "resolution": "1m", "aggregates": [ "avg" diff --git a/pkg/testdata/prop-val-for-time-range-1m-data-for-time-range-A.golden.jsonc b/pkg/testdata/prop-val-for-time-range-1m-data-for-time-range-A.golden.jsonc index 668bbc75..65b5478f 100644 --- a/pkg/testdata/prop-val-for-time-range-1m-data-for-time-range-A.golden.jsonc +++ b/pkg/testdata/prop-val-for-time-range-1m-data-for-time-range-A.golden.jsonc @@ -7,6 +7,7 @@ // ], // "custom": { // "nextToken": "Pbb7bb96ab41b718aabab1b1f0c64327b=AYADeEhsb/CNkFHmzaVMewZvIzUAXwABABVhd3MtY3J5cHRvLXB1YmxpYy1rZXkAREF3U2pCbnI0aWJSczhES05McUdoMVdGVEVFU1BOMUQzZmxOLzBLMUEwWnFBUXdQY3Jab25mZmxMZWtnYkdKZnNWZz09AAEAA0FTTQA0YmI3YmI5NmFiNDFiNzE4YWFiYWIxYjFmMGM2NDMyN2IAAACAAAAADB8WXnM7VjhaB5/QIQAw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HDY7MAZzBlAjBap+46gGu5sWmQ2Y9r1SBt3UTrF2Jqw8tE1u8CAQ1zxNfy5E+bE15pgN8OgfH6svUCMQDt4wVCf9vbc44MTFQYmoiIe1VBizp0lHMUptYC/oFWzfy/yhDQ4XDdTBXSbA9gZK4=", +// "entryId": "e64c9075-9d89-47cb-8ee5-d3251bd253f4", // "resolution": "1m", // "aggregates": [ // "avg" @@ -47,6 +48,7 @@ ], "custom": { "nextToken": "Pbb7bb96ab41b718aabab1b1f0c64327b=AYADeEhsb/CNkFHmzaVMewZvIzUAXwABABVhd3MtY3J5cHRvLXB1YmxpYy1rZXkAREF3U2pCbnI0aWJSczhES05McUdoMVdGVEVFU1BOMUQzZmxOLzBLMUEwWnFBUXdQY3Jab25mZmxMZWtnYkdKZnNWZz09AAEAA0FTTQA0YmI3YmI5NmFiNDFiNzE4YWFiYWIxYjFmMGM2NDMyN2IAAACAAAAADB8WXnM7VjhaB5/QIQAwVrqkP3Z3210py/B8F9wPsdFv9Lja7PAhWiLSdpoA3ejPGACbZ8uPt6otukNYV607AgAAAAAMAAAQAAAAAAAAAAAAAAAAAM2cAITzrrofJlVBsHfLl9D/////AAAAAQAAAAAAAAAAAAAAAQAAArGunNpIP7QEUmwfQzDhQ5eq/RnaTtm1BCHifxpR3oqYpRXy5kBR25bwJIsneC7u2Pun8wnCl5ayCHgxWopOQFDiu7S6/cjdL3xPlDSujxnuFRZTBqI32mSHc/Hr9aKcZjGKoWPNLjKDQnW43QVFcUEzH/RS97U180KhnZc4UiDSxKvtDY+osJgiksl3pjrk1wqF0ftP8z8e5YsPogsujJEfcCcCVXlzcSiVUSwwn0TCsZXtS/FEml6UlARJOdJUN7uGaeEUMqboQzb8Ax2cvdBwXqYEhfKp4LTGLv3qBHm28qylphVL88pWgSqlDAtlwvs3KAZQGaFjyGXBdNruJZRdqosk4SDE95SzuL9zFdjnbR37UHe99yuUE4iN1VYX+MHE+XoxGBOhgTWFdSchLIj8+8xdlyfjwnMFw/F0PcuUCQZEJtkjfiLmbN+gzKs7Lwpyy/FnBBmtbRmmh0RbNh+gJ7Rt4k8FFkUPrshmg4mjdb1eu/Ufbifkpz4ZBZqWeEvSWiCo5N7OBl7TiPu9c2SReBFHPJsPh1PqVg5aILatfY3YeJOfoQfKsH1mX8jp0QQKWo3Fz4UZ1rUSK4IOfJq2tUybGILAkc9IUPvcHGA/3VFimpvqnHwkKgzFFLb4qNNyks1M9WCT7q2yq0c1ujEqRg8mMB1ENBhcofGsrJeav77/mLPV75qaevwpLOPmHwSXvS6zc5V3E/abG8p6u/+oJkNFdGsWfGRhqxrAVB/rmEPvppEEn+PGpZRlyrT13VWfuiENIujoMDSCJl3K90YhT0uOLSP91VJA+9gI8LFXi4jq7hk4YmloF09MLKgdIE+4IWaddrManMCUuW4N+rmjbs7jCa/6IqSBoR1cLSrdP61UXriSvcGRvZD4L/X+vwETdTt6/ImYeUHZ7HctZi/TZ2ZJrScZtSJRfwiQw8HDY7MAZzBlAjBap+46gGu5sWmQ2Y9r1SBt3UTrF2Jqw8tE1u8CAQ1zxNfy5E+bE15pgN8OgfH6svUCMQDt4wVCf9vbc44MTFQYmoiIe1VBizp0lHMUptYC/oFWzfy/yhDQ4XDdTBXSbA9gZK4=", + "entryId": "e64c9075-9d89-47cb-8ee5-d3251bd253f4", "resolution": "1m", "aggregates": [ "avg" diff --git a/pkg/testdata/prop-val-for-time-range-1m-data-for-time-range-from-alias-A.golden.jsonc b/pkg/testdata/prop-val-for-time-range-1m-data-for-time-range-from-alias-A.golden.jsonc index 668bbc75..65b5478f 100644 --- a/pkg/testdata/prop-val-for-time-range-1m-data-for-time-range-from-alias-A.golden.jsonc +++ b/pkg/testdata/prop-val-for-time-range-1m-data-for-time-range-from-alias-A.golden.jsonc @@ -7,6 +7,7 @@ // ], // "custom": { // "nextToken": "Pbb7bb96ab41b718aabab1b1f0c64327b=AYADeEhsb/CNkFHmzaVMewZvIzUAXwABABVhd3MtY3J5cHRvLXB1YmxpYy1rZXkAREF3U2p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rT13VWfuiENIujoMDSCJl3K90YhT0uOLSP91VJA+9gI8LFXi4jq7hk4YmloF09MLKgdIE+4IWaddrManMCUuW4N+rmjbs7jCa/6IqSBoR1cLSrdP61UXriSvcGRvZD4L/X+vwETdTt6/ImYeUHZ7HctZi/TZ2ZJrScZtSJRfwiQw8HDY7MAZzBlAjBap+46gGu5sWmQ2Y9r1SBt3UTrF2Jqw8tE1u8CAQ1zxNfy5E+bE15pgN8OgfH6svUCMQDt4wVCf9vbc44MTFQYmoiIe1VBizp0lHMUptYC/oFWzfy/yhDQ4XDdTBXSbA9gZK4=", +// "entryId": "e64c9075-9d89-47cb-8ee5-d3251bd253f4", // "resolution": "1m", // "aggregates": [ // "avg" @@ -47,6 +48,7 @@ ], "custom": { "nextToken": "Pbb7bb96ab41b718aabab1b1f0c64327b=AYADeEhsb/CNkFHmzaVMewZvIzUAXwABABVhd3MtY3J5cHRvLXB1YmxpYy1rZXkAREF3U2pCbnI0aWJSczhES05McUdoMVdGVEVFU1BOMUQzZmxOLzBLMUEwWnFBUXdQY3Jab25mZmxMZWtnYkdKZnNWZz09AAEAA0FTTQA0YmI3YmI5NmFiNDFiNzE4YWFiYWIxYjFmMGM2NDMyN2IAAACAAAAADB8WXnM7VjhaB5/QIQAwVrqkP3Z3210py/B8F9wPsdFv9Lja7PAhWiLSdpoA3ejPGACbZ8uPt6otukNYV607AgAAAAAMAAAQAAAAAAAAAAAAAAAAAM2cAITzrrofJlVBsHfLl9D/////AAAAAQAAAAAAAAAAAAAAAQAAArGunNpIP7QEUmwfQzDhQ5eq/RnaTtm1BCHifxpR3oqYpRXy5kBR25bwJIsneC7u2Pun8wnCl5ayCHgxWopOQFDiu7S6/cjdL3xPlDSujxnuFRZTBqI32mSHc/Hr9aKcZjGKoWPNLjKDQnW43QVFcUEzH/RS97U180KhnZc4UiDSxKvtDY+osJgiksl3pjrk1wqF0ftP8z8e5YsPogsujJEfcCcCVXlzcSiVUSwwn0TCsZXtS/FEml6UlARJOdJUN7uGaeEUMqboQzb8Ax2cvdBwXqYEhfKp4LTGLv3qBHm28qylphVL88pWgSqlDAtlwvs3KAZQGaFjyGXBdNruJZRdqosk4SDE95SzuL9zFdjnbR37UHe99yuUE4iN1VYX+MHE+XoxGBOhgTWFdSchLIj8+8xdlyfjwnMFw/F0PcuUCQZEJtkjfiLmbN+gzKs7Lwpyy/FnBBmtbRmmh0RbNh+gJ7Rt4k8FFkUPrshmg4mjdb1eu/Ufbifkpz4ZBZqWeEvSWiCo5N7OBl7TiPu9c2SReBFHPJsPh1PqVg5aILatfY3YeJOfoQfKsH1mX8jp0QQKWo3Fz4UZ1rUSK4IOfJq2tUybGILAkc9IUPvcHGA/3VFimpvqnHwkKgzFFLb4qNNyks1M9WCT7q2yq0c1ujEqRg8mMB1ENBhcofGsrJeav77/mLPV75qaevwpLOPmHwSXvS6zc5V3E/abG8p6u/+oJkNFdGsWfGRhqxrAVB/rmEPvppEEn+PGpZRlyrT13VWfuiENIujoMDSCJl3K90YhT0uOLSP91VJA+9gI8LFXi4jq7hk4YmloF09MLKgdIE+4IWaddrManMCUuW4N+rmjbs7jCa/6IqSBoR1cLSrdP61UXriSvcGRvZD4L/X+vwETdTt6/ImYeUHZ7HctZi/TZ2ZJrScZtSJRfwiQw8HDY7MAZzBlAjBap+46gGu5sWmQ2Y9r1SBt3UTrF2Jqw8tE1u8CAQ1zxNfy5E+bE15pgN8OgfH6svUCMQDt4wVCf9vbc44MTFQYmoiIe1VBizp0lHMUptYC/oFWzfy/yhDQ4XDdTBXSbA9gZK4=", + "entryId": "e64c9075-9d89-47cb-8ee5-d3251bd253f4", "resolution": "1m", "aggregates": [ "avg" diff --git a/pkg/testdata/prop-val-for-time-range-raw-data-for-time-range-A.golden.jsonc b/pkg/testdata/prop-val-for-time-range-raw-data-for-time-range-A.golden.jsonc index 9d80d93b..d1d6d383 100644 --- a/pkg/testdata/prop-val-for-time-range-raw-data-for-time-range-A.golden.jsonc +++ b/pkg/testdata/prop-val-for-time-range-raw-data-for-time-range-A.golden.jsonc @@ -6,6 +6,7 @@ // 0 // ], // "custom": { +// "entryId": "e64c9075-9d89-47cb-8ee5-d3251bd253f4", // "resolution": "RAW" // } // } @@ -42,6 +43,7 @@ 0 ], "custom": { + "entryId": "e64c9075-9d89-47cb-8ee5-d3251bd253f4", "resolution": "RAW" } }, diff --git a/pkg/testdata/prop-val-for-time-range-raw-data-for-time-range-from-alias-A.golden.jsonc b/pkg/testdata/prop-val-for-time-range-raw-data-for-time-range-from-alias-A.golden.jsonc index 9d80d93b..d1d6d383 100644 --- a/pkg/testdata/prop-val-for-time-range-raw-data-for-time-range-from-alias-A.golden.jsonc +++ b/pkg/testdata/prop-val-for-time-range-raw-data-for-time-range-from-alias-A.golden.jsonc @@ -6,6 +6,7 @@ // 0 // ], // "custom": { +// "entryId": "e64c9075-9d89-47cb-8ee5-d3251bd253f4", // "resolution": "RAW" // } // } @@ -42,6 +43,7 @@ 0 ], "custom": { + "entryId": "e64c9075-9d89-47cb-8ee5-d3251bd253f4", "resolution": "RAW" } }, diff --git a/pkg/testdata/property-history-values-boolean-A.golden.jsonc b/pkg/testdata/property-history-values-boolean-A.golden.jsonc index 1bebbed9..c57f56f7 100644 --- a/pkg/testdata/property-history-values-boolean-A.golden.jsonc +++ b/pkg/testdata/property-history-values-boolean-A.golden.jsonc @@ -6,6 +6,7 @@ // 0 // ], // "custom": { +// "entryId": "e64c9075-9d89-47cb-8ee5-d3251bd253f4", // "resolution": "RAW" // } // } @@ -42,6 +43,7 @@ 0 ], "custom": { + "entryId": "e64c9075-9d89-47cb-8ee5-d3251bd253f4", "resolution": "RAW" } }, diff --git a/pkg/testdata/property-history-values-from-alias-boolean-associated-stream-A.golden.jsonc b/pkg/testdata/property-history-values-from-alias-boolean-associated-stream-A.golden.jsonc index 1bebbed9..c57f56f7 100644 --- a/pkg/testdata/property-history-values-from-alias-boolean-associated-stream-A.golden.jsonc +++ b/pkg/testdata/property-history-values-from-alias-boolean-associated-stream-A.golden.jsonc @@ -6,6 +6,7 @@ // 0 // ], // "custom": { +// "entryId": "e64c9075-9d89-47cb-8ee5-d3251bd253f4", // "resolution": "RAW" // } // } @@ -42,6 +43,7 @@ 0 ], "custom": { + "entryId": "e64c9075-9d89-47cb-8ee5-d3251bd253f4", "resolution": "RAW" } }, diff --git a/pkg/testdata/property-history-values-from-alias-boolean-with-disassociated-stream-A.golden.jsonc b/pkg/testdata/property-history-values-from-alias-boolean-with-disassociated-stream-A.golden.jsonc index eb8ad093..77aec14b 100644 --- a/pkg/testdata/property-history-values-from-alias-boolean-with-disassociated-stream-A.golden.jsonc +++ b/pkg/testdata/property-history-values-from-alias-boolean-with-disassociated-stream-A.golden.jsonc @@ -6,6 +6,7 @@ // 0 // ], // "custom": { +// "entryId": "61e4e1a8ab39463fa0b9418d9be2923e364f40a8b935b69d006b999516cdecef", // "resolution": "RAW" // } // } @@ -41,6 +42,7 @@ 0 ], "custom": { + "entryId": "61e4e1a8ab39463fa0b9418d9be2923e364f40a8b935b69d006b999516cdecef", "resolution": "RAW" } }, diff --git a/pkg/testdata/property-history-values-from-alias-boolean-with-disassociated-stream-empty-response-A.golden.jsonc b/pkg/testdata/property-history-values-from-alias-boolean-with-disassociated-stream-empty-response-A.golden.jsonc index 32d200ba..de03c149 100644 --- a/pkg/testdata/property-history-values-from-alias-boolean-with-disassociated-stream-empty-response-A.golden.jsonc +++ b/pkg/testdata/property-history-values-from-alias-boolean-with-disassociated-stream-empty-response-A.golden.jsonc @@ -6,6 +6,7 @@ // 0 // ], // "custom": { +// "entryId": "61e4e1a8ab39463fa0b9418d9be2923e364f40a8b935b69d006b999516cdecef", // "resolution": "RAW" // } // } @@ -31,6 +32,7 @@ 0 ], "custom": { + "entryId": "61e4e1a8ab39463fa0b9418d9be2923e364f40a8b935b69d006b999516cdecef", "resolution": "RAW" } }, diff --git a/pkg/testdata/property-history-values-from-alias-table-A.golden.jsonc b/pkg/testdata/property-history-values-from-alias-table-A.golden.jsonc index 1e2240ef..b03f486b 100644 --- a/pkg/testdata/property-history-values-from-alias-table-A.golden.jsonc +++ b/pkg/testdata/property-history-values-from-alias-table-A.golden.jsonc @@ -6,6 +6,7 @@ // 0 // ], // "custom": { +// "entryId": "e64c9075-9d89-47cb-8ee5-d3251bd253f4", // "resolution": "RAW" // } // } @@ -42,6 +43,7 @@ 0 ], "custom": { + "entryId": "e64c9075-9d89-47cb-8ee5-d3251bd253f4", "resolution": "RAW" } }, diff --git a/pkg/testdata/property-history-values-from-alias-timeseries-A.golden.jsonc b/pkg/testdata/property-history-values-from-alias-timeseries-A.golden.jsonc index 3e14c8d5..e82f62ab 100644 --- a/pkg/testdata/property-history-values-from-alias-timeseries-A.golden.jsonc +++ b/pkg/testdata/property-history-values-from-alias-timeseries-A.golden.jsonc @@ -7,6 +7,7 @@ // 0 // ], // "custom": { +// "entryId": "e64c9075-9d89-47cb-8ee5-d3251bd253f4", // "resolution": "RAW" // } // } @@ -44,6 +45,7 @@ 0 ], "custom": { + "entryId": "e64c9075-9d89-47cb-8ee5-d3251bd253f4", "resolution": "RAW" } }, diff --git a/pkg/testdata/property-history-values-with-batched-queries-A.golden.jsonc b/pkg/testdata/property-history-values-with-batched-queries-A.golden.jsonc new file mode 100644 index 00000000..e8a755ca --- /dev/null +++ b/pkg/testdata/property-history-values-with-batched-queries-A.golden.jsonc @@ -0,0 +1,1333 @@ +// 🌟 This was machine generated. Do not edit. 🌟 +// +// Frame[0] { +// "typeVersion": [ +// 0, +// 0 +// ], +// "custom": { +// "nextToken": "some-next-token-1", +// "entryId": "1assetid-aaaa-2222-bbbb-3333cccc4444", +// "resolution": "RAW" +// } +// } +// Name: Demo Turbine Asset 1 +// Dimensions: 3 Fields by 1 Rows +// +-------------------------------+------------------+----------------+ +// | Name: time | Name: Wind Speed | Name: quality | +// | Labels: | Labels: | Labels: | +// | Type: []time.Time | Type: []float64 | Type: []string | +// +-------------------------------+------------------+----------------+ +// | 2021-02-01 11:20:00 -0800 PST | 23.8 | GOOD | +// +-------------------------------+------------------+----------------+ +// +// +// +// Frame[1] { +// "typeVersion": [ +// 0, +// 0 +// ], +// "custom": { +// "nextToken": "some-next-token-1", +// "entryId": "2assetid-aaaa-2222-bbbb-3333cccc4444", +// "resolution": "RAW" +// } +// } +// Name: Demo Turbine Asset 1 +// Dimensions: 3 Fields by 1 Rows +// +-------------------------------+------------------+----------------+ +// | Name: time | Name: Wind Speed | Name: quality | +// | Labels: | Labels: | Labels: | +// | Type: []time.Time | Type: []float64 | Type: []string | +// +-------------------------------+------------------+----------------+ +// | 2021-02-01 11:20:00 -0800 PST | 23.8 | GOOD | +// +-------------------------------+------------------+----------------+ +// +// +// +// Frame[2] { +// "typeVersion": [ +// 0, +// 0 +// ], +// "custom": { +// "nextToken": "some-next-token-1", +// "entryId": "3assetid-aaaa-2222-bbbb-3333cccc4444", +// "resolution": "RAW" +// } +// } +// Name: Demo Turbine Asset 1 +// Dimensions: 3 Fields by 1 Rows +// +-------------------------------+------------------+----------------+ +// | Name: time | Name: Wind Speed | Name: quality | +// | Labels: | Labels: | Labels: | +// | Type: []time.Time | Type: []float64 | Type: []string | +// +-------------------------------+------------------+----------------+ +// | 2021-02-01 11:20:00 -0800 PST | 23.8 | GOOD | +// +-------------------------------+------------------+----------------+ +// +// +// +// Frame[3] { +// "typeVersion": [ +// 0, +// 0 +// ], +// "custom": { +// "nextToken": "some-next-token-1", +// "entryId": "4assetid-aaaa-2222-bbbb-3333cccc4444", +// "resolution": "RAW" +// } +// } +// Name: Demo Turbine Asset 1 +// Dimensions: 3 Fields by 1 Rows +// +-------------------------------+------------------+----------------+ +// | Name: time | Name: Wind Speed | Name: quality | +// | Labels: | Labels: | Labels: | +// | Type: []time.Time | Type: []float64 | Type: []string | +// +-------------------------------+------------------+----------------+ +// | 2021-02-01 11:20:00 -0800 PST | 23.8 | GOOD | +// +-------------------------------+------------------+----------------+ +// +// +// +// Frame[4] { +// "typeVersion": [ +// 0, +// 0 +// ], +// "custom": { +// "nextToken": "some-next-token-1", +// "entryId": "5assetid-aaaa-2222-bbbb-3333cccc4444", +// "resolution": "RAW" +// } +// } +// Name: Demo Turbine Asset 1 +// Dimensions: 3 Fields by 1 Rows +// +-------------------------------+------------------+----------------+ +// | Name: time | Name: Wind Speed | Name: quality | +// | Labels: | Labels: | Labels: | +// | Type: []time.Time | Type: []float64 | Type: []string | +// +-------------------------------+------------------+----------------+ +// | 2021-02-01 11:20:00 -0800 PST | 23.8 | GOOD | +// +-------------------------------+------------------+----------------+ +// +// +// +// Frame[5] { +// "typeVersion": [ +// 0, +// 0 +// ], +// "custom": { +// "nextToken": "some-next-token-1", +// "entryId": "6assetid-aaaa-2222-bbbb-3333cccc4444", +// "resolution": "RAW" +// } +// } +// Name: Demo Turbine Asset 1 +// Dimensions: 3 Fields by 1 Rows +// +-------------------------------+------------------+----------------+ +// | Name: time | Name: Wind Speed | Name: quality | +// | Labels: | Labels: | Labels: | +// | Type: []time.Time | Type: []float64 | Type: []string | +// +-------------------------------+------------------+----------------+ +// | 2021-02-01 11:20:00 -0800 PST | 23.8 | GOOD | +// +-------------------------------+------------------+----------------+ +// +// +// +// Frame[6] { +// "typeVersion": [ +// 0, +// 0 +// ], +// "custom": { +// "nextToken": "some-next-token-1", +// "entryId": "7assetid-aaaa-2222-bbbb-3333cccc4444", +// "resolution": "RAW" +// } +// } +// Name: Demo Turbine Asset 1 +// Dimensions: 3 Fields by 1 Rows +// +-------------------------------+------------------+----------------+ +// | Name: time | Name: Wind Speed | Name: quality | +// | Labels: | Labels: | Labels: | +// | Type: []time.Time | Type: []float64 | Type: []string | +// +-------------------------------+------------------+----------------+ +// | 2021-02-01 11:20:00 -0800 PST | 23.8 | GOOD | +// +-------------------------------+------------------+----------------+ +// +// +// +// Frame[7] { +// "typeVersion": [ +// 0, +// 0 +// ], +// "custom": { +// "nextToken": "some-next-token-1", +// "entryId": "8assetid-aaaa-2222-bbbb-3333cccc4444", +// "resolution": "RAW" +// } +// } +// Name: Demo Turbine Asset 1 +// Dimensions: 3 Fields by 1 Rows +// +-------------------------------+------------------+----------------+ +// | Name: time | Name: Wind Speed | Name: quality | +// | Labels: | Labels: | Labels: | +// | Type: []time.Time | Type: []float64 | Type: []string | +// +-------------------------------+------------------+----------------+ +// | 2021-02-01 11:20:00 -0800 PST | 23.8 | GOOD | +// +-------------------------------+------------------+----------------+ +// +// +// +// Frame[8] { +// "typeVersion": [ +// 0, +// 0 +// ], +// "custom": { +// "nextToken": "some-next-token-1", +// "entryId": "9assetid-aaaa-2222-bbbb-3333cccc4444", +// "resolution": "RAW" +// } +// } +// Name: Demo Turbine Asset 1 +// Dimensions: 3 Fields by 1 Rows +// +-------------------------------+------------------+----------------+ +// | Name: time | Name: Wind Speed | Name: quality | +// | Labels: | Labels: | Labels: | +// | Type: []time.Time | Type: []float64 | Type: []string | +// +-------------------------------+------------------+----------------+ +// | 2021-02-01 11:20:00 -0800 PST | 23.8 | GOOD | +// +-------------------------------+------------------+----------------+ +// +// +// +// Frame[9] { +// "typeVersion": [ +// 0, +// 0 +// ], +// "custom": { +// "nextToken": "some-next-token-1", +// "entryId": "10assetid-aaaa-2222-bbbb-3333cccc4444", +// "resolution": "RAW" +// } +// } +// Name: Demo Turbine Asset 1 +// Dimensions: 3 Fields by 1 Rows +// +-------------------------------+------------------+----------------+ +// | Name: time | Name: Wind Speed | Name: quality | +// | Labels: | Labels: | Labels: | +// | Type: []time.Time | Type: []float64 | Type: []string | +// +-------------------------------+------------------+----------------+ +// | 2021-02-01 11:20:00 -0800 PST | 23.8 | GOOD | +// +-------------------------------+------------------+----------------+ +// +// +// +// Frame[10] { +// "typeVersion": [ +// 0, +// 0 +// ], +// "custom": { +// "nextToken": "some-next-token-1", +// "entryId": "11assetid-aaaa-2222-bbbb-3333cccc4444", +// "resolution": "RAW" +// } +// } +// Name: Demo Turbine Asset 1 +// Dimensions: 3 Fields by 1 Rows +// +-------------------------------+------------------+----------------+ +// | Name: time | Name: Wind Speed | Name: quality | +// | Labels: | Labels: | Labels: | +// | Type: []time.Time | Type: []float64 | Type: []string | +// +-------------------------------+------------------+----------------+ +// | 2021-02-01 11:20:00 -0800 PST | 23.8 | GOOD | +// +-------------------------------+------------------+----------------+ +// +// +// +// Frame[11] { +// "typeVersion": [ +// 0, +// 0 +// ], +// "custom": { +// "nextToken": "some-next-token-1", +// "entryId": "12assetid-aaaa-2222-bbbb-3333cccc4444", +// "resolution": "RAW" +// } +// } +// Name: Demo Turbine Asset 1 +// Dimensions: 3 Fields by 1 Rows +// +-------------------------------+------------------+----------------+ +// | Name: time | Name: Wind Speed | Name: quality | +// | Labels: | Labels: | Labels: | +// | Type: []time.Time | Type: []float64 | Type: []string | +// +-------------------------------+------------------+----------------+ +// | 2021-02-01 11:20:00 -0800 PST | 23.8 | GOOD | +// +-------------------------------+------------------+----------------+ +// +// +// +// Frame[12] { +// "typeVersion": [ +// 0, +// 0 +// ], +// "custom": { +// "nextToken": "some-next-token-1", +// "entryId": "13assetid-aaaa-2222-bbbb-3333cccc4444", +// "resolution": "RAW" +// } +// } +// Name: Demo Turbine Asset 1 +// Dimensions: 3 Fields by 1 Rows +// +-------------------------------+------------------+----------------+ +// | Name: time | Name: Wind Speed | Name: quality | +// | Labels: | Labels: | Labels: | +// | Type: []time.Time | Type: []float64 | Type: []string | +// +-------------------------------+------------------+----------------+ +// | 2021-02-01 11:20:00 -0800 PST | 23.8 | GOOD | +// +-------------------------------+------------------+----------------+ +// +// +// +// Frame[13] { +// "typeVersion": [ +// 0, +// 0 +// ], +// "custom": { +// "nextToken": "some-next-token-1", +// "entryId": "14assetid-aaaa-2222-bbbb-3333cccc4444", +// "resolution": "RAW" +// } +// } +// Name: Demo Turbine Asset 1 +// Dimensions: 3 Fields by 1 Rows +// +-------------------------------+------------------+----------------+ +// | Name: time | Name: Wind Speed | Name: quality | +// | Labels: | Labels: | Labels: | +// | Type: []time.Time | Type: []float64 | Type: []string | +// +-------------------------------+------------------+----------------+ +// | 2021-02-01 11:20:00 -0800 PST | 23.8 | GOOD | +// +-------------------------------+------------------+----------------+ +// +// +// +// Frame[14] { +// "typeVersion": [ +// 0, +// 0 +// ], +// "custom": { +// "nextToken": "some-next-token-1", +// "entryId": "15assetid-aaaa-2222-bbbb-3333cccc4444", +// "resolution": "RAW" +// } +// } +// Name: Demo Turbine Asset 1 +// Dimensions: 3 Fields by 1 Rows +// +-------------------------------+------------------+----------------+ +// | Name: time | Name: Wind Speed | Name: quality | +// | Labels: | Labels: | Labels: | +// | Type: []time.Time | Type: []float64 | Type: []string | +// +-------------------------------+------------------+----------------+ +// | 2021-02-01 11:20:00 -0800 PST | 23.8 | GOOD | +// +-------------------------------+------------------+----------------+ +// +// +// +// Frame[15] { +// "typeVersion": [ +// 0, +// 0 +// ], +// "custom": { +// "nextToken": "some-next-token-1", +// "entryId": "16assetid-aaaa-2222-bbbb-3333cccc4444", +// "resolution": "RAW" +// } +// } +// Name: Demo Turbine Asset 1 +// Dimensions: 3 Fields by 1 Rows +// +-------------------------------+------------------+----------------+ +// | Name: time | Name: Wind Speed | Name: quality | +// | Labels: | Labels: | Labels: | +// | Type: []time.Time | Type: []float64 | Type: []string | +// +-------------------------------+------------------+----------------+ +// | 2021-02-01 11:20:00 -0800 PST | 23.8 | GOOD | +// +-------------------------------+------------------+----------------+ +// +// +// +// Frame[16] { +// "typeVersion": [ +// 0, +// 0 +// ], +// "custom": { +// "nextToken": "some-next-token-2", +// "entryId": "17assetid-aaaa-2222-bbbb-3333cccc4444", +// "resolution": "RAW" +// } +// } +// Name: Demo Turbine Asset 1 +// Dimensions: 3 Fields by 1 Rows +// +-------------------------------+------------------+----------------+ +// | Name: time | Name: Wind Speed | Name: quality | +// | Labels: | Labels: | Labels: | +// | Type: []time.Time | Type: []float64 | Type: []string | +// +-------------------------------+------------------+----------------+ +// | 2021-02-01 11:20:00 -0800 PST | 23.8 | GOOD | +// +-------------------------------+------------------+----------------+ +// +// +// 🌟 This was machine generated. Do not edit. 🌟 +{ + "status": 200, + "frames": [ + { + "schema": { + "name": "Demo Turbine Asset 1", + "meta": { + "typeVersion": [ + 0, + 0 + ], + "custom": { + "nextToken": "some-next-token-1", + "entryId": "1assetid-aaaa-2222-bbbb-3333cccc4444", + "resolution": "RAW" + } + }, + "fields": [ + { + "name": "time", + "type": "time", + "typeInfo": { + "frame": "time.Time" + } + }, + { + "name": "Wind Speed", + "type": "number", + "typeInfo": { + "frame": "float64" + }, + "config": { + "unit": "m/s" + } + }, + { + "name": "quality", + "type": "string", + "typeInfo": { + "frame": "string" + } + } + ] + }, + "data": { + "values": [ + [ + 1612207200000 + ], + [ + 23.8 + ], + [ + "GOOD" + ] + ] + } + }, + { + "schema": { + "name": "Demo Turbine Asset 1", + "meta": { + "typeVersion": [ + 0, + 0 + ], + "custom": { + "nextToken": "some-next-token-1", + "entryId": "2assetid-aaaa-2222-bbbb-3333cccc4444", + "resolution": "RAW" + } + }, + "fields": [ + { + "name": "time", + "type": "time", + "typeInfo": { + "frame": "time.Time" + } + }, + { + "name": "Wind Speed", + "type": "number", + "typeInfo": { + "frame": "float64" + }, + "config": { + "unit": "m/s" + } + }, + { + "name": "quality", + "type": "string", + "typeInfo": { + "frame": "string" + } + } + ] + }, + "data": { + "values": [ + [ + 1612207200000 + ], + [ + 23.8 + ], + [ + "GOOD" + ] + ] + } + }, + { + "schema": { + "name": "Demo Turbine Asset 1", + "meta": { + "typeVersion": [ + 0, + 0 + ], + "custom": { + "nextToken": "some-next-token-1", + "entryId": "3assetid-aaaa-2222-bbbb-3333cccc4444", + "resolution": "RAW" + } + }, + "fields": [ + { + "name": "time", + "type": "time", + "typeInfo": { + "frame": "time.Time" + } + }, + { + "name": "Wind Speed", + "type": "number", + "typeInfo": { + "frame": "float64" + }, + "config": { + "unit": "m/s" + } + }, + { + "name": "quality", + "type": "string", + "typeInfo": { + "frame": "string" + } + } + ] + }, + "data": { + "values": [ + [ + 1612207200000 + ], + [ + 23.8 + ], + [ + "GOOD" + ] + ] + } + }, + { + "schema": { + "name": "Demo Turbine Asset 1", + "meta": { + "typeVersion": [ + 0, + 0 + ], + "custom": { + "nextToken": "some-next-token-1", + "entryId": "4assetid-aaaa-2222-bbbb-3333cccc4444", + "resolution": "RAW" + } + }, + "fields": [ + { + "name": "time", + "type": "time", + "typeInfo": { + "frame": "time.Time" + } + }, + { + "name": "Wind Speed", + "type": "number", + "typeInfo": { + "frame": "float64" + }, + "config": { + "unit": "m/s" + } + }, + { + "name": "quality", + "type": "string", + "typeInfo": { + "frame": "string" + } + } + ] + }, + "data": { + "values": [ + [ + 1612207200000 + ], + [ + 23.8 + ], + [ + "GOOD" + ] + ] + } + }, + { + "schema": { + "name": "Demo Turbine Asset 1", + "meta": { + "typeVersion": [ + 0, + 0 + ], + "custom": { + "nextToken": "some-next-token-1", + "entryId": "5assetid-aaaa-2222-bbbb-3333cccc4444", + "resolution": "RAW" + } + }, + "fields": [ + { + "name": "time", + "type": "time", + "typeInfo": { + "frame": "time.Time" + } + }, + { + "name": "Wind Speed", + "type": "number", + "typeInfo": { + "frame": "float64" + }, + "config": { + "unit": "m/s" + } + }, + { + "name": "quality", + "type": "string", + "typeInfo": { + "frame": "string" + } + } + ] + }, + "data": { + "values": [ + [ + 1612207200000 + ], + [ + 23.8 + ], + [ + "GOOD" + ] + ] + } + }, + { + "schema": { + "name": "Demo Turbine Asset 1", + "meta": { + "typeVersion": [ + 0, + 0 + ], + "custom": { + "nextToken": "some-next-token-1", + "entryId": "6assetid-aaaa-2222-bbbb-3333cccc4444", + "resolution": "RAW" + } + }, + "fields": [ + { + "name": "time", + "type": "time", + "typeInfo": { + "frame": "time.Time" + } + }, + { + "name": "Wind Speed", + "type": "number", + "typeInfo": { + "frame": "float64" + }, + "config": { + "unit": "m/s" + } + }, + { + "name": "quality", + "type": "string", + "typeInfo": { + "frame": "string" + } + } + ] + }, + "data": { + "values": [ + [ + 1612207200000 + ], + [ + 23.8 + ], + [ + "GOOD" + ] + ] + } + }, + { + "schema": { + "name": "Demo Turbine Asset 1", + "meta": { + "typeVersion": [ + 0, + 0 + ], + "custom": { + "nextToken": "some-next-token-1", + "entryId": "7assetid-aaaa-2222-bbbb-3333cccc4444", + "resolution": "RAW" + } + }, + "fields": [ + { + "name": "time", + "type": "time", + "typeInfo": { + "frame": "time.Time" + } + }, + { + "name": "Wind Speed", + "type": "number", + "typeInfo": { + "frame": "float64" + }, + "config": { + "unit": "m/s" + } + }, + { + "name": "quality", + "type": "string", + "typeInfo": { + "frame": "string" + } + } + ] + }, + "data": { + "values": [ + [ + 1612207200000 + ], + [ + 23.8 + ], + [ + "GOOD" + ] + ] + } + }, + { + "schema": { + "name": "Demo Turbine Asset 1", + "meta": { + "typeVersion": [ + 0, + 0 + ], + "custom": { + "nextToken": "some-next-token-1", + "entryId": "8assetid-aaaa-2222-bbbb-3333cccc4444", + "resolution": "RAW" + } + }, + "fields": [ + { + "name": "time", + "type": "time", + "typeInfo": { + "frame": "time.Time" + } + }, + { + "name": "Wind Speed", + "type": "number", + "typeInfo": { + "frame": "float64" + }, + "config": { + "unit": "m/s" + } + }, + { + "name": "quality", + "type": "string", + "typeInfo": { + "frame": "string" + } + } + ] + }, + "data": { + "values": [ + [ + 1612207200000 + ], + [ + 23.8 + ], + [ + "GOOD" + ] + ] + } + }, + { + "schema": { + "name": "Demo Turbine Asset 1", + "meta": { + "typeVersion": [ + 0, + 0 + ], + "custom": { + "nextToken": "some-next-token-1", + "entryId": "9assetid-aaaa-2222-bbbb-3333cccc4444", + "resolution": "RAW" + } + }, + "fields": [ + { + "name": "time", + "type": "time", + "typeInfo": { + "frame": "time.Time" + } + }, + { + "name": "Wind Speed", + "type": "number", + "typeInfo": { + "frame": "float64" + }, + "config": { + "unit": "m/s" + } + }, + { + "name": "quality", + "type": "string", + "typeInfo": { + "frame": "string" + } + } + ] + }, + "data": { + "values": [ + [ + 1612207200000 + ], + [ + 23.8 + ], + [ + "GOOD" + ] + ] + } + }, + { + "schema": { + "name": "Demo Turbine Asset 1", + "meta": { + "typeVersion": [ + 0, + 0 + ], + "custom": { + "nextToken": "some-next-token-1", + "entryId": "10assetid-aaaa-2222-bbbb-3333cccc4444", + "resolution": "RAW" + } + }, + "fields": [ + { + "name": "time", + "type": "time", + "typeInfo": { + "frame": "time.Time" + } + }, + { + "name": "Wind Speed", + "type": "number", + "typeInfo": { + "frame": "float64" + }, + "config": { + "unit": "m/s" + } + }, + { + "name": "quality", + "type": "string", + "typeInfo": { + "frame": "string" + } + } + ] + }, + "data": { + "values": [ + [ + 1612207200000 + ], + [ + 23.8 + ], + [ + "GOOD" + ] + ] + } + }, + { + "schema": { + "name": "Demo Turbine Asset 1", + "meta": { + "typeVersion": [ + 0, + 0 + ], + "custom": { + "nextToken": "some-next-token-1", + "entryId": "11assetid-aaaa-2222-bbbb-3333cccc4444", + "resolution": "RAW" + } + }, + "fields": [ + { + "name": "time", + "type": "time", + "typeInfo": { + "frame": "time.Time" + } + }, + { + "name": "Wind Speed", + "type": "number", + "typeInfo": { + "frame": "float64" + }, + "config": { + "unit": "m/s" + } + }, + { + "name": "quality", + "type": "string", + "typeInfo": { + "frame": "string" + } + } + ] + }, + "data": { + "values": [ + [ + 1612207200000 + ], + [ + 23.8 + ], + [ + "GOOD" + ] + ] + } + }, + { + "schema": { + "name": "Demo Turbine Asset 1", + "meta": { + "typeVersion": [ + 0, + 0 + ], + "custom": { + "nextToken": "some-next-token-1", + "entryId": "12assetid-aaaa-2222-bbbb-3333cccc4444", + "resolution": "RAW" + } + }, + "fields": [ + { + "name": "time", + "type": "time", + "typeInfo": { + "frame": "time.Time" + } + }, + { + "name": "Wind Speed", + "type": "number", + "typeInfo": { + "frame": "float64" + }, + "config": { + "unit": "m/s" + } + }, + { + "name": "quality", + "type": "string", + "typeInfo": { + "frame": "string" + } + } + ] + }, + "data": { + "values": [ + [ + 1612207200000 + ], + [ + 23.8 + ], + [ + "GOOD" + ] + ] + } + }, + { + "schema": { + "name": "Demo Turbine Asset 1", + "meta": { + "typeVersion": [ + 0, + 0 + ], + "custom": { + "nextToken": "some-next-token-1", + "entryId": "13assetid-aaaa-2222-bbbb-3333cccc4444", + "resolution": "RAW" + } + }, + "fields": [ + { + "name": "time", + "type": "time", + "typeInfo": { + "frame": "time.Time" + } + }, + { + "name": "Wind Speed", + "type": "number", + "typeInfo": { + "frame": "float64" + }, + "config": { + "unit": "m/s" + } + }, + { + "name": "quality", + "type": "string", + "typeInfo": { + "frame": "string" + } + } + ] + }, + "data": { + "values": [ + [ + 1612207200000 + ], + [ + 23.8 + ], + [ + "GOOD" + ] + ] + } + }, + { + "schema": { + "name": "Demo Turbine Asset 1", + "meta": { + "typeVersion": [ + 0, + 0 + ], + "custom": { + "nextToken": "some-next-token-1", + "entryId": "14assetid-aaaa-2222-bbbb-3333cccc4444", + "resolution": "RAW" + } + }, + "fields": [ + { + "name": "time", + "type": "time", + "typeInfo": { + "frame": "time.Time" + } + }, + { + "name": "Wind Speed", + "type": "number", + "typeInfo": { + "frame": "float64" + }, + "config": { + "unit": "m/s" + } + }, + { + "name": "quality", + "type": "string", + "typeInfo": { + "frame": "string" + } + } + ] + }, + "data": { + "values": [ + [ + 1612207200000 + ], + [ + 23.8 + ], + [ + "GOOD" + ] + ] + } + }, + { + "schema": { + "name": "Demo Turbine Asset 1", + "meta": { + "typeVersion": [ + 0, + 0 + ], + "custom": { + "nextToken": "some-next-token-1", + "entryId": "15assetid-aaaa-2222-bbbb-3333cccc4444", + "resolution": "RAW" + } + }, + "fields": [ + { + "name": "time", + "type": "time", + "typeInfo": { + "frame": "time.Time" + } + }, + { + "name": "Wind Speed", + "type": "number", + "typeInfo": { + "frame": "float64" + }, + "config": { + "unit": "m/s" + } + }, + { + "name": "quality", + "type": "string", + "typeInfo": { + "frame": "string" + } + } + ] + }, + "data": { + "values": [ + [ + 1612207200000 + ], + [ + 23.8 + ], + [ + "GOOD" + ] + ] + } + }, + { + "schema": { + "name": "Demo Turbine Asset 1", + "meta": { + "typeVersion": [ + 0, + 0 + ], + "custom": { + "nextToken": "some-next-token-1", + "entryId": "16assetid-aaaa-2222-bbbb-3333cccc4444", + "resolution": "RAW" + } + }, + "fields": [ + { + "name": "time", + "type": "time", + "typeInfo": { + "frame": "time.Time" + } + }, + { + "name": "Wind Speed", + "type": "number", + "typeInfo": { + "frame": "float64" + }, + "config": { + "unit": "m/s" + } + }, + { + "name": "quality", + "type": "string", + "typeInfo": { + "frame": "string" + } + } + ] + }, + "data": { + "values": [ + [ + 1612207200000 + ], + [ + 23.8 + ], + [ + "GOOD" + ] + ] + } + }, + { + "schema": { + "name": "Demo Turbine Asset 1", + "meta": { + "typeVersion": [ + 0, + 0 + ], + "custom": { + "nextToken": "some-next-token-2", + "entryId": "17assetid-aaaa-2222-bbbb-3333cccc4444", + "resolution": "RAW" + } + }, + "fields": [ + { + "name": "time", + "type": "time", + "typeInfo": { + "frame": "time.Time" + } + }, + { + "name": "Wind Speed", + "type": "number", + "typeInfo": { + "frame": "float64" + }, + "config": { + "unit": "m/s" + } + }, + { + "name": "quality", + "type": "string", + "typeInfo": { + "frame": "string" + } + } + ] + }, + "data": { + "values": [ + [ + 1612207200000 + ], + [ + 23.8 + ], + [ + "GOOD" + ] + ] + } + } + ] +} \ No newline at end of file diff --git a/src/getNextQueries.ts b/src/getNextQueries.ts index cb3e250c..9ab59891 100644 --- a/src/getNextQueries.ts +++ b/src/getNextQueries.ts @@ -11,7 +11,7 @@ export function getNextQueries(request: DataQueryRequest, rsp?: D if (query) { const existingNextQuery = next.find((v) => v.refId === frame.refId); if (existingNextQuery) { - if (existingNextQuery.nextToken !== meta.nextToken && meta.entryId && meta.nextToken) { + if (meta.entryId && meta.nextToken) { if (!existingNextQuery.nextTokens) { existingNextQuery.nextTokens = {}; }