You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What happened:
I noticed an issue with the caching on the ListComponentTypes used by GetAlarms where it’s returning the wrong cached result after the server boots up. GetAlarms should return 1 entry for each alarm. The workspace has 6 alarms that are of a component type that extends com.amazon.iotsitewise.alarm called com.j.construction.alarm. The first time data is pulled it shows just 6, but when a refresh occurs it shows all 6 entries twice.
What you expected to happen:
After refresh there should still only be 6 entries
How to reproduce it (as minimally and precisely as possible):
Work space with zero basic alarms
Work space with zero alarms derived from basic alarm
workspace with zero sitewise alarms
workspace with 1+ alarms derived from sitewise alarms
Use GetAlarm query and display it in a Table Panel and get 1+ entries
What happened:
I noticed an issue with the caching on the ListComponentTypes used by GetAlarms where it’s returning the wrong cached result after the server boots up. GetAlarms should return 1 entry for each alarm. The workspace has 6 alarms that are of a component type that extends com.amazon.iotsitewise.alarm called com.j.construction.alarm. The first time data is pulled it shows just 6, but when a refresh occurs it shows all 6 entries twice.
What you expected to happen:
After refresh there should still only be 6 entries
How to reproduce it (as minimally and precisely as possible):
Work space with zero basic alarms
Work space with zero alarms derived from basic alarm
workspace with zero sitewise alarms
workspace with 1+ alarms derived from sitewise alarms
Use GetAlarm query and display it in a Table Panel and get 1+ entries
Refresh data query and get 2 times 1+ entries
Screenshots
Enhanced Logs
Added logging in get alarms of the basicComponentType returned on: https://github.com/grafana/grafana-iot-twinmaker-app/blob/11172022_Release/pkg/plugin/twinmaker/handler.go#L484 and sitewiseComponentType returned on https://github.com/grafana/grafana-iot-twinmaker-app/blob/11172022_Release/pkg/plugin/twinmaker/handler.go#L497
First pull logs:
ogger=plugin.grafana-iot-twinmaker-datasource t=2022-11-16T22:51:39.28193045Z level=info msg=“basic component types found: {\n ComponentTypeSummaries: [{\n Arn: \“arn:aws:iottwinmaker:us-east-1:iotrociaccount:workspace/AmazonOwnedTypesWorkspace/component-type/com.amazon.iotsitewise.alarm\“,\n ComponentTypeId: \“com.amazon.iotsitewise.alarm\“,\n CreationDateTime: 2022-06-15 00:57:17.495 +0000 UTC,\n Description: \“iotsitewise alarm native component type\“,\n Status: {\n Error: {\n\n },\n State: \“ACTIVE\“\n },\n UpdateDateTime: 2022-06-15 00:57:17.495 +0000 UTC\n }],\n WorkspaceId: \“JDemo\“\n}”
logger=plugin.grafana-iot-twinmaker-datasource t=2022-11-16T22:51:39.517052546Z level=info msg=“sitewise component types found: {\n ComponentTypeSummaries: [{\n Arn: \“arn:aws:iottwinmaker:us-east-1:282301944532:workspace/JDemo/component-type/com.j.construction.alarm\“,\n ComponentTypeId: \“com.j.construction.alarm\“,\n CreationDateTime: 2022-07-12 01:10:12.323 +0000 UTC,\n Description: \“J construction alarm type\“,\n Status: {\n Error: {\n\n },\n State: \“ACTIVE\“\n },\n UpdateDateTime: 2022-07-12 01:10:12.323 +0000 UTC\n }],\n WorkspaceId: \“JDemo\“\n}”
Second pull logs (note cache comment in logs):
logger=plugin.grafana-iot-twinmaker-datasource t=2022-11-16T22:52:31.158936973Z level=debug msg=“using cached value” key=ListComponentTypes
JDemo///com.amazon.iottwinmaker.alarm.basic@JDemo///com.amazon.iotsitewise.alarm@logger=plugin.grafana-iot-twinmaker-datasource t=2022-11-16T22:52:31.159047101Z level=info msg=“basic component types found: {\n ComponentTypeSummaries: [{\n Arn: \“arn:aws:iottwinmaker:us-east-1:282301944532:workspace/JDemo/component-type/com.j.construction.alarm\“,\n ComponentTypeId: \“com.j.construction.alarm\“,\n CreationDateTime: 2022-07-12 01:10:12.323 +0000 UTC,\n Description: \“Jconstruction alarm type\“,\n Status: {\n Error: {\n\n },\n State: \“ACTIVE\“\n },\n UpdateDateTime: 2022-07-12 01:10:12.323 +0000 UTC\n }],\n WorkspaceId: \“JDemo\“\n}”
logger=plugin.grafana-iot-twinmaker-datasource t=2022-11-16T22:52:31.159078839Z level=debug msg=“using cached value” key=ListComponentTypes
logger=plugin.grafana-iot-twinmaker-datasource t=2022-11-16T22:52:31.159155796Z level=info msg=“sitewise component types found: {\n ComponentTypeSummaries: [{\n Arn: \“arn:aws:iottwinmaker:us-east-1:282301944532:workspace/JDemo/component-type/com.j.construction.alarm\“,\n ComponentTypeId: \“com.j.construction.alarm\“,\n CreationDateTime: 2022-07-12 01:10:12.323 +0000 UTC,\n Description: \“J construction alarm type\“,\n Status: {\n Error: {\n\n },\n State: \“ACTIVE\“\n },\n UpdateDateTime: 2022-07-12 01:10:12.323 +0000 UTC\n }],\n WorkspaceId: \“JDemo\“\n}”
Anything else we need to know?:
Environment:
Grafana version:
Plugin version:
OS Grafana is installed on:
User OS & Browser:
Others:
The text was updated successfully, but these errors were encountered: