Code Monkey home page Code Monkey logo

grafana-iot-twinmaker-app's Introduction

AWS IoT TwinMaker Application Development Guide

Please add feedback to the issues folder, and we will follow up shortly. Be sure to include version information for both Grafana and the installed plugin.

The production plugins can be downloaded from the TwinMaker app plugin page.

For an overview of the plugin see src/README.md.

Developer Guide

Pull down the git repo locally.

Installation requirements:

  1. yarn install --frozen-lockfile
  2. yarn dev — will build the frontend changes, yarn watch will build in watch mode
  3. mage build:backend — will build the backend changes
    1. Troubleshooting: If you see Plugin unavailable when clicking “Save & test” for the TwinMaker datasource then run: mage -v buildAll. This builds the backend plugin for all platforms.
  4. The compiled plugin should be in dist/ directory.
  5. Run Grafana in development mode, or configure Grafana to load the unsigned plugin.

For more information, please consult the build a plugin docs page.

Build a release

You need to have commit rights to the GitHub repository to publish a release.

  1. Update the version number in the package.json file.
  2. Update the CHANGELOG.md by copy and pasting the relevant PRs from Github's Release drafter interface or by running npm run generate-release-notes.
  3. PR the changes.
  4. Once merged, follow the Drone release process that you can find here

Install

You can install by following the install Grafana plugins docs page.

Local Docker Setup

  1. Install the AWS CLI
  2. Run aws configure and enter your IAM user credentials
  3. Run the following docker command:
docker compose up -d

a. This container will mount the volume ~/.aws:/usr/share/grafana/.aws with the credentials you configured on your machine so you can use the “AWS SDK Default” authentication provider for the TwinMaker datasource

  1. Access from http://localhost:3000 on your browser. First time login will be username:admin password:admin.

Development Mode

By default, the webpack mode is set to production to work with the released Grafana production build.

To build the plugin with development mode, change the mode in webpack.config.js file to be development, and start the development mode local Grafana server following Grafana Developer Guide

grafana-iot-twinmaker-app's People

Contributors

atifali avatar dependabot[bot] avatar digized avatar divya-sea avatar fridgepoet avatar hwandersman avatar idastambuk avatar iwysiu avatar jackw avatar jwills-jdubs avatar katebrenner avatar kevinwcyu avatar mo-elmu avatar msshui-amzn avatar mukeshsahay avatar mumanity avatar njvrzm avatar raymfang avatar ryantxu avatar sarahzinger avatar sheilaxu avatar taleena avatar theevildev avatar toddtreece avatar wbrowne avatar yesoreyeram avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grafana-iot-twinmaker-app's Issues

[Bug - Critical] Live time series history streaming feature not working on AMG

"Live time series history streaming" is a new feature supported in the TwinMaker plugin v1.2.0, but this is not working on the AMG setup.
User can enable the streaming and can set the streaming interval in the query editor. However, the panel is not updated with the latest data.

This is a critical issue and many of our customers are reporting this.

image (2)

Caching on ListComponentTypes appears to have errors when using multiple Alarm Types

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

Screen Shot 2022-11-17 at 10 56 16 AM

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=ListComponentTypesJDemo///com.amazon.iottwinmaker.alarm.basic@
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
JDemo///com.amazon.iotsitewise.alarm@
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:

[Request]: sidebar collapsed

It will be very useful to add an option for the scene viewer to load the panel with the sidebar collapsed.
Indeed, if the scene viewer is in a dashboard with other panels on the right, then the sidebar reduces to much the 3D scene.

Improvement: Improve sample alarm dashboard

The sample alarm dashboard should have a text box that links to the setup tutorial and/or explains how to setup and use the dashboard. Also, the version on play grafana is more complex and it may be nice to use that to improve our sample dashboard.
Tutorial: https://github.com/grafana/grafana-iot-twinmaker-app/blob/main/src/panels/scene-viewer/README.md
Dashboard: https://github.com/grafana/grafana-iot-twinmaker-app/blob/main/src/datasource/dashboards/twinmaker-alarm-dashboard.json

Bug: Video Player does not use the correct value for repeated variable

What happened:
When the Video Player Panel is used with a Dashboard Variable, and has the Panel in a Row that repeats by Variable, the Row Name is correct, however the Panel seems to use the "All" Variable and shows all values from the Variable, rather than the individual Variable for that row.

image

note that even though the titles, set as ${System}_CAM1 are correct, the video player interpolation of the value is not:
image

From my initial investigation, the issue seems to be that the video player panel is not getting the correct value to use for $System.

What you expected to happen:
Its expected that the Repeat Variable should be correctly used in the Video Player like it is in the Title and Row.

How to reproduce it (as minimally and precisely as possible):
Reproduction dashboard:

{
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "target": {
          "limit": 100,
          "matchAny": false,
          "tags": [],
          "type": "dashboard"
        },
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": 433,
  "iteration": 1678290630082,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 2,
      "panels": [],
      "title": "$System Cameras",
      "type": "row"
    },
    {
      "gridPos": {
        "h": 10,
        "w": 4.8,
        "x": 0,
        "y": 1
      },
      "id": 4,
      "maxPerRow": 6,
      "options": {
        "componentName": "",
        "datasource": "",
        "entityId": "",
        "kvsStreamName": "$System"
      },
      "repeat": "System",
      "repeatDirection": "h",
      "title": "${System}_CAM1",
      "type": "grafana-iot-twinmaker-videoplayer-panel"
    }
  ],
  "schemaVersion": 35,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "current": {
          "selected": false,
          "text": "All",
          "value": "$__all"
        },
        "hide": 0,
        "includeAll": true,
        "multi": false,
        "name": "System",
        "options": [
          {
            "selected": true,
            "text": "All",
            "value": "$__all"
          },
          {
            "selected": false,
            "text": "demo",
            "value": "demo"
          },
          {
            "selected": false,
            "text": "test",
            "value": "test"
          },
          {
            "selected": false,
            "text": "example",
            "value": "example"
          },
          {
            "selected": false,
            "text": "new",
            "value": "new"
          },
          {
            "selected": false,
            "text": "old",
            "value": "old"
          }
        ],
        "query": "demo,test,example,new,old",
        "queryValue": "",
        "skipUrlSync": false,
        "type": "custom"
      }
    ]
  },
  "time": {
    "from": "now-6h",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "",
  "title": "All Cameras",
  "uid": "zkpk9ahVk",
  "version": 2,
  "weekStart": ""
}

Anything else we need to know?:

Environment:

  • Grafana version: v8.4.7
  • Plugin version: 8.5.21

Add field to GetAlarms to set max results

Querty GetAlarms for a workspace with hundreds of alarms will take too long to collect all data. Customers can use the filter to get fewer results faster, but we should also allow them to specify a limit to the results in the query editor.

  • New field in the frontend query editor
  • Use field in the backend API to only return data for MaxResults # of alarms

test, please ignore

What happened:

What you expected to happen:

How to reproduce it (as minimally and precisely as possible):

Screenshots

Anything else we need to know?:

Environment:

  • Grafana version:
  • Plugin version:
  • OS Grafana is installed on:
  • User OS & Browser:
  • Others:

Result does not sort correctly with Multiple OrderBy

1. Steps:
    1. Select a component, and enter property group / selected properties / filter. 
    2. Add multiple order by and run query
2. Error:
    1. Response on the plugin is not sorted based on the order of the OrderBy.
    2. Example add first order as x and second order as Y.
    3. Display on the panel order is based on Y but not on X.
    4. We need to add a logic sort based on the order of the OrderBy.

Support multi-property response for LIST data types

We only parse the first item in the LIST response from the GetPropertyValue handler: https://github.com/grafana/grafana-iot-twinmaker-app/blob/main/pkg/plugin/twinmaker/handler.go#L310-L330

If we request multiple LIST type properties in a GetPropertyValue query we should show the response for each property
Screen Shot 2022-04-28 at 12 56 38 PM
Screen Shot 2022-04-28 at 12 56 53 PM
.

As you can see above we only show the latest property requested in the query input. We should show the output for "bounds" and "position".

Grafana/UI CustomScrollbar import broken and blocking builds

There is an error in PR #68 build: https://drone.grafana.net/grafana/grafana-iot-twinmaker-app/162/1/5

Compiling...  ERROR in grafana-iot-twinmaker-app/src/panels/alarm/TwinMakerAlarmPanel.tsx(41,6):
  TS2322: Type '{ children: Element; autoHeightMin: string; }' is not assignable to type 'IntrinsicAttributes & Props'.
    Property 'children' does not exist on type 'IntrinsicAttributes & Props'.
  ERROR in grafana-iot-twinmaker-app/src/panels/layout/LayoutPanel.tsx(231,12):
  TS2322: Type '{ children: Element; autoHeightMin: string; }' is not assignable to type 'IntrinsicAttributes & Props'.
    Property 'children' does not exist on type 'IntrinsicAttributes & Props'.
✖ Build failed
error Command failed with exit code 1.

Issue with CustomScrollbar here: https://github.com/grafana/grafana-iot-twinmaker-app/blob/main/src/panels/alarm/TwinMakerAlarmPanel.tsx#L41
And in the LayoutPanel.

Need to fix this broken dependency.

Improvement: ConfigEditor should be clearer about workspace loading

Currently, when you create a new TwinMaker datasource, the workspace field is somewhat confusing. As a user, you fill in the Authentication, Assume Role, and Workspace Id fields, and after saving it, the Workspace ID field swaps from a text field to a select and says that the Workspace ID isn't found:

Screen Shot 2023-01-27 at 2 14 37 PM

If you save again, it will load in the workspaces and remove the (not found) part of the message, but this could be confusing for users.

Instead, it should work like the Cloudwatch Logs Config Editor, which tells the user to save the datasource first, and then they can select from the loaded values.
Screen Shot 2023-01-27 at 2 01 19 PM

Chore: Handover to AWS Plugins

Add basic templates and processes:

  • - CODEOWNERS
  • - Bugs
  • - FR (to Discussions)
  • - PR template
  • - Automate CHANGELOG
  • - Levitate (as comments)
  • - Add to project board (for the new squad)

This does not include: Code coverage

  • Before closing this issue, we should test them out.

Legend displays some selected properties inconsistently

What happened:
Some weird behavior around the Legend: sometimes choosing "Temperature," for example, causes "Temperature" to just continue displaying on the legend, even if it is a duplicate.

Screen.Recording.2023-05-10.at.11.24.16.mov

What you expected to happen:
It should show the properties which were selected.

How to reproduce it (as minimally and precisely as possible):
See the above screen recording on https://play.grafana.org/d/TRA53ITVz/main-dashboard?orgId=1
Play around with the Selected Properties, removing them, adding them back -- you should see the the inconsistent behavior.
For example, selecting Mixer entity > Temperature + RPM Properties in the same query only displays Temperature twice on the panel. However if you choose RPM alone, Temperature still displays.

Environment:

  • Grafana version: 9.5.2-cloud
  • Plugin version:

[Request]: dynamic selection of the scene

Hi,

In the configuration of a panel of your plugin, we can select (statically) the scene that will be displayed into the dashboard.
I would like to be able to select a scene dynamically regarding the variable of the dashboard, but currently it is not possible.

So could you add a feature, to be able to the select the scene from a variable of the dashboard?

Thank you

How to contribute to "aws-iot-twinmaker-grafana-utils" package?

Hi all, I would like to contribute to "aws-iot-twinmaker-grafana-utils" package, which is referred to a static file in package.json

...
  "dependencies": {
    "aws-iot-twinmaker-grafana-utils": "file:libs/aws-iot-twinmaker-grafana-utils-1.0.0.tgz",
...

Where do we maintain this package? Who is responsible to build the tgz file when it's changed and place it to this repo?

What I'm trying to do?
When a panel in Grafana set up to visualize a TwinMaker scene, it fails if its corresponding S3 bucket for 3D model resources isn’t configured for CORS access properly. Customers are able to resolve the issue by searching the error message on internet and applying what is recommended on repost.aws. However, the error message is not explicit enough:

Load 3D Scene failed with Network Failure

I know that the browser itself can’t know if it’s a CORS error or something else. Even though, we can have a better error message to guide customers/users to find the issue quicker.

Load 3D Scene failed with Network Failure: Some of the 3D model resources are missing, or your browser isn’t able to access the 3D model resource files due to missing CORS configuration. Please reach out to your administrator.

This error message is defined in ./aws-iot-twinmaker-grafana-utils/dist/index.js. So, this is why I'm investigating how to contribute that package.

...
        this.renderErrorView = () => {
            const errorMessage = this.state.loadSceneError;
            return (React__default["default"].createElement("div", { className: styles.loadingWrapper },
                React__default["default"].createElement(vendor.Box, { margin: 'xs' },
                    "Load 3D Scene failed ",
                    errorMessage ? 'with ' + errorMessage : '')));
        };
...

GetPropertyValueHistory by Entity filter is broken

Allow users to edit maxResults sent to the lambdas

It seems users want the ability to increase the maxResults we use (100 by default) as the pagination latency is frustatingly slow.
This is for calling the 'Get Property Value by x' or 'Get Alarms' APIs.

This I believe would be a good addition to make but we should enforce 100 as the minimum. At least until we find a good use case to decrease it.

User complaint:
"In the event sent to the connector lambda there is a maxResults parameter. I assume this is the number of results the lambda should return for a single call, and if the total number of results from the query is larger it should paginate using nextToken. Can this value be configured by the user? 100 seems a really low value and I observe that the pagination latency is killing the dashboard performances. Moreover, for widgets such as Gauges, the Gauges change value for each page, which is really annoying."

Fix "Validation error" message when Assume Role ARN is misconfigured

Need a better error message shown when the Assume Role ARN does not work for a TwinMaker datasource. The error usually occurs when the auth provider creds doesn't have access to the assume role ARN. If any of those fields are incorrect the error message is not clear, so we need to surface the correct one.

Support for non-double time-series data

When UDQ returns non-double (e.g. long values) for time-series it's getting displayed as {LongValue: 62} in Grafana so time-series panel doesn't work (can see using Table visualization instead)

In contrast, doubleValue is correctly displayed

Sample UDQ response snippets:

# this renders correctly in panel (e.g. 58.887597369065645)
[
  {
    "entityPropertyReference": {
      "componentName": "mycomponent",
      "externalIdProperty": {
        "telemetryAssetId": "telemetryId"
      },
      "entityId": "Warehouse_Room_E_62a08267-a89f-4a3c-826e-844fc52736e5",
      "propertyName": "Temperature"
    },
    "values": [
      {
        "value": {
          "doubleValue": 58.887597369065645
        },
        "time": "2022-05-19T21:29:14.344Z"
      },

vs

# this renders as the json blob under "value"
  {
    "entityPropertyReference": {
      "componentName": "mycomponent",
      "externalIdProperty": {
        "telemetryAssetId": "telemetryId"
      },
      "entityId": "Warehouse_Room_E_62a08267-a89f-4a3c-826e-844fc52736e5",
      "propertyName": "p1"
    },
    "values": [
      {
        "value": {
          "longValue": 81
        },
        "time": "2022-05-19T21:42:03.062Z"
      },

Multiple queries on a panel are out of sync

Ran into an issue where two separate GetPropertyValueHistory by EntityId queries were added to a Time series panel, each have a different range of timestamps, but they are not graphed consistently. The panel only uses the Timestamps of the first query. See the images below:

TimestampIssue1
TimestampIssue2
:

Explore error in certain workspaces

I am seeing this in explore on Grafana v8.5.2 with v1.1.1 of the data source:
image

Full error:

An unexpected error happened
TypeError: Object(...)() is undefined

t@https://toddtest.grafana.net/public/plugins/grafana-iot-twinmaker-app/datasource/module.js:272:499159
Po@https://grafana-assets.grafana.net/grafana-pro/8.5.2/public/build/3317.20c89cb88e65f4bf594e.js:3111:467
Fo@https://grafana-assets.grafana.net/grafana-pro/8.5.2/public/build/3317.20c89cb88e65f4bf594e.js:3111:1023
div
div
div
./.yarn/__virtual__/react-beautiful-dnd-virtual-27e4b658e7/3/opt/drone/yarncache/react-beautiful-dnd-npm-13.1.0-fcf5568b1c-12b7e9fbe8.zip/node_modules/react-beautiful-dnd/dist/react-beautiful-dnd.esm.js/ko<@https://grafana-assets.grafana.net/grafana-pro/8.5.2/public/build/7809.20c89cb88e65f4bf594e.js:2:696911
g@https://grafana-assets.grafana.net/grafana-pro/8.5.2/public/build/7809.20c89cb88e65f4bf594e.js:2:1112460
Eo@https://grafana-assets.grafana.net/grafana-pro/8.5.2/public/build/7809.20c89cb88e65f4bf594e.js:2:698226
So@https://grafana-assets.grafana.net/grafana-pro/8.5.2/public/build/7809.20c89cb88e65f4bf594e.js:2:698335
d@https://grafana-assets.grafana.net/grafana-pro/8.5.2/public/build/3317.20c89cb88e65f4bf594e.js:4710:1116
div
C@https://grafana-assets.grafana.net/grafana-pro/8.5.2/public/build/3317.20c89cb88e65f4bf594e.js:7466:181
div
./.yarn/__virtual__/react-beautiful-dnd-virtual-27e4b658e7/3/opt/drone/yarncache/react-beautiful-dnd-npm-13.1.0-fcf5568b1c-12b7e9fbe8.zip/node_modules/react-beautiful-dnd/dist/react-beautiful-dnd.esm.js/Ao<@https://grafana-assets.grafana.net/grafana-pro/8.5.2/public/build/7809.20c89cb88e65f4bf594e.js:2:700585
g@https://grafana-assets.grafana.net/grafana-pro/8.5.2/public/build/7809.20c89cb88e65f4bf594e.js:2:1112460
c@https://grafana-assets.grafana.net/grafana-pro/8.5.2/public/build/7809.20c89cb88e65f4bf594e.js:2:1109977
Fr@https://grafana-assets.grafana.net/grafana-pro/8.5.2/public/build/7809.20c89cb88e65f4bf594e.js:2:683932
t@https://grafana-assets.grafana.net/grafana-pro/8.5.2/public/build/7809.20c89cb88e65f4bf594e.js:2:617363
Ur@https://grafana-assets.grafana.net/grafana-pro/8.5.2/public/build/7809.20c89cb88e65f4bf594e.js:2:687475
d@https://grafana-assets.grafana.net/grafana-pro/8.5.2/public/build/1602.20c89cb88e65f4bf594e.js:67:806
Vt@https://grafana-assets.grafana.net/grafana-pro/8.5.2/public/build/explore.20c89cb88e65f4bf594e.js:282:1239
div
div
div
div
t@https://grafana-assets.grafana.net/grafana-pro/8.5.2/public/build/7809.20c89cb88e65f4bf594e.js:2:771450
u@https://grafana-assets.grafana.net/grafana-pro/8.5.2/public/build/3317.20c89cb88e65f4bf594e.js:314:3427
nn@https://grafana-assets.grafana.net/grafana-pro/8.5.2/public/build/explore.20c89cb88e65f4bf594e.js:509:13203
WithTheme(undefined)
g@https://grafana-assets.grafana.net/grafana-pro/8.5.2/public/build/7809.20c89cb88e65f4bf594e.js:2:1112460
div
cn@https://grafana-assets.grafana.net/grafana-pro/8.5.2/public/build/explore.20c89cb88e65f4bf594e.js:524:2771
g@https://grafana-assets.grafana.net/grafana-pro/8.5.2/public/build/7809.20c89cb88e65f4bf594e.js:2:1112460
Po@https://grafana-assets.grafana.net/grafana-pro/8.5.2/public/build/3317.20c89cb88e65f4bf594e.js:3111:467
Fo@https://grafana-assets.grafana.net/grafana-pro/8.5.2/public/build/3317.20c89cb88e65f4bf594e.js:3111:1023
div
div
vn@https://grafana-assets.grafana.net/grafana-pro/8.5.2/public/build/explore.20c89cb88e65f4bf594e.js:524:4454
g@https://grafana-assets.grafana.net/grafana-pro/8.5.2/public/build/7809.20c89cb88e65f4bf594e.js:2:1112460
n@https://grafana-assets.grafana.net/grafana-pro/8.5.2/public/build/7809.20c89cb88e65f4bf594e.js:2:1055472
St@https://grafana-assets.grafana.net/grafana-pro/8.5.2/public/build/3317.20c89cb88e65f4bf594e.js:4518:23161
t@https://grafana-assets.grafana.net/grafana-pro/8.5.2/public/build/7809.20c89cb88e65f4bf594e.js:2:1130458
t@https://grafana-assets.grafana.net/grafana-pro/8.5.2/public/build/7809.20c89cb88e65f4bf594e.js:2:1132479
main
t@https://grafana-assets.grafana.net/grafana-pro/8.5.2/public/build/7809.20c89cb88e65f4bf594e.js:2:1127076
div
Ls@https://grafana-assets.grafana.net/grafana-pro/8.5.2/public/build/3317.20c89cb88e65f4bf594e.js:2585:1012
./public/app/core/utils/ConfigProvider.tsx/d<@https://grafana-assets.grafana.net/grafana-pro/8.5.2/public/build/3317.20c89cb88e65f4bf594e.js:5098:30514
Po@https://grafana-assets.grafana.net/grafana-pro/8.5.2/public/build/3317.20c89cb88e65f4bf594e.js:3111:467
Fo@https://grafana-assets.grafana.net/grafana-pro/8.5.2/public/build/3317.20c89cb88e65f4bf594e.js:3111:1023
y@https://grafana-assets.grafana.net/grafana-pro/8.5.2/public/build/7809.20c89cb88e65f4bf594e.js:2:142485
yt@https://grafana-assets.grafana.net/grafana-pro/8.5.2/public/build/3317.20c89cb88e65f4bf594e.js:4518:22547
c@https://grafana-assets.grafana.net/grafana-pro/8.5.2/public/build/7809.20c89cb88e65f4bf594e.js:2:1109977
Bt@https://grafana-assets.grafana.net/grafana-pro/8.5.2/public/build/3317.20c89cb88e65f4bf594e.js:4531:164

This seems to be related to the workspace I have selected. In a dashboard panel, the datasource returns this error:

ConnectorFailureException: Lambda function arn:aws:lambda:us-east-1:<redacted>:function:CookieFactoryTelemetry-timestreamReader<redacted>` throws exception. Please check your lambda logs for detailed information.

It seems like a frontend execption should not be thrown if the backend responds with an error.

Upgrade to Grafana 8.5

Upgrade Grafana dependencies to 8.5.0. Test the TwinMaker plugin thoroughly to ensure it is backwards compatible.

Enforce EC2 instance credentials cannot be used directly

Investigate feasibility of detecting when Grafana is running on EC2 and disabling using Instance credentials if so. Customer must use the Assume Role ARN in the datasource configuration when running on EC2 and using AWS SDK Default.

Can check the AuthType for EC2: https://github.com/grafana/grafana-aws-sdk/blob/main/pkg/awsds/sessions.go#L192

We may be able to check for the AuthType in the session settings of NewTwinMakerClient: https://github.com/grafana/grafana-iot-twinmaker-app/blob/main/pkg/plugin/twinmaker/client.go#L46

[Request]: Tag link in the same tab

Hi,

In TwinMaker scene composer we can define a link for a tag.
On the Grafana plugin, if we click on the tag then it redirects to the link in a new tab of the browser.

Is possible to add an option in the plugin to force the link to redirect into the same page instead of in a new tab of the brower?

Thank you

Integrate with new Grafana 8.5 feature: Table pagination

The GetPropertyValueHistory API returns paginated results, but we haven't been able to separate these pages visually on the dashboard. Onboard to the new Table pagination and ensure customers can see 1 page of responses at a time.

Update GoLang SDK

Use new GoLang SDK for TwinMaker.

Need to make the following changes to our backend plugin:

  • PropertyValue.Timestamp is now PropertyValue.Time
  • The timestamp is now represented in ISO 8601 format - test that passing this to panels doesn't break anything

Make default on GetAlarms to be "ACTIVE"

Since the new proposed optimization for getAlarms is only useful in the case the alarm_status is filtered - lets make the default filter for that query to be set to ACTIVE.

NOTE: without the filter set the getAlarms query is going to be very very slow - and that is an intended effect of the proposed change from the AWS TwinMaker team

Handle ISO 8601 Timestamp in GoLang

Our GetPropertyValueHistory API has deprecated the "Timestamp" field in the response and "StartDateTime" and "EndDateTime" in the request. We are being pushed to use the "Time" field in the response and "StartTime" and "EndTime" in the request. These new fields use timestamps as a string object.

In GoLang we use the RFC3339 constant to format strings and timestamps. This is strictly matches the format "YYYY-MM-DDTHH:MM:SSZ". However, the API response only promises the ISO 8601 format where the seconds are optional. We need to handle the case where seconds are missing and format timestamps correctly.

Example values in a response:

                {
                    "value": {
                        "stringValue": "ACTIVE"
                    },
                    "time": "2022-04-27T17:50Z"
                }

vs


                {
                    "value": {
                        "stringValue": "ACTIVE"
                    },
                    "time": "2022-04-27T17:49:46Z"
                }

2022-04-27T17:50Z is missing seconds so converting this directly with the RFC3339 format will result in a timestamp that equates to 0. Need to add the ":00" before the "Z" to ensure a correct conversioin.

GetAlarms API Update for Large Data Set

Background
With the current approach, since Grafana need to loop through all the entities in TwinMaker, which may not be able to scale for large systems (e.g. with 100K entities). This is the update to resolve the issue.

Current Workflow
Steps

  1. (Result is cached) Call API ListComponentTypes to get all component types which extend from the basic alarm component type "com.amazon.iottwinmaker.alarm.basic"
  2. (Result is cached) Call API ListEntities with all the component types from the last step.
  3. (Result is cached) Call API GetEntity for all the entities from the last step to get the entity detailed information (includes componentName).
  4. Build a HashMap for externalID->entityId/componentName lookup
  5. Call API GetPropertyValueHistory for all the componentTypes from step 1, and then use the externalIDs from API response with the HashMap from step 4 to add entityId/componentName into the response.

Traffic Estimation: for a customer with 100K entities, 10 alarm components and 20 active alarms, the number of API calls are: 100,000 + 10 * 2 + 1

New workflow

Steps

  1. (Result is cached) Call API ListComponentTypes to get all component types which extend from the basic alarm component type "com.amazon.iottwinmaker.alarm.basic"
  2. Call API GetPropertyValueHistory for all the componentTypes from step 1
  3. For each data frame, search in-memory cache for the externalID, if exists, use cache to add entityId/componentName into the response, otherwise:
    3.1 Call API listEntities with externalID as filter to find the entity summary.
    3.2. Call API GetEntity with the entityID from step 3.1 to find the entity componentName.

Traffic Estimation: for a customer with 100K entities, 10 alarm components and 20 active alarms, the number of API calls are: 20 + 20 + 10 + 1

Non-time-series and non-component-type properties are not showing in Grafana query selection

For properties are non-time-series, if they are not declared in component type, then the won't be shown in Grafana query.

For example, KinesisVideoStreamName and CaptureStartTime are declared in SiteWatch as entity level of property, they are not showing in Grafana selection; on the other side, sitewiseAssetId and sitewiseAssetModelId are defined in component type level, they are shown in Grafana query. Double confirmed that all these 4 properties are in getEntity response.

Bug: Fix webpack issue

The update to create-plugin broke the scene-viewer panel:

Screen Shot 2023-02-06 at 3 41 29 PM

We should (preferably) fix it, but it we can't we can revert the create-plugin change temporarily.

Support for `interval`

Use case: when querying data over long date ranges, it is useful to reduce the data granularity to avoid getting more data than what can be displayed. Grafana calculates an interval property that can be used at that effect, indicating the minimum time range each returned data point should represent. This is for example supported by Timestream plugin ($__interval).

When looking at the request that is sent to my connector by TwinMaker plugin, I cannot find any field being populated with the value of the interval calculated by Grafana based on the time range and graph width. Is it supported?

Since the TwinMaker request object contains the following property I would expect to find the Grafana computed interval populated.

{ "interpolation": { "intervalInSeconds": long, "interpolationType": string}

Restore original dashboard after a dashboard merge

When a dashboard is merged many of the panels are replaced. A user should be able to click the back button on their browser to restore the previous state of the dashboard. If the dashboard is merged multiple times, the history should be maintained.

Possible solutions:

  • Store the dashboardId to merge in a template variable - when it is empty the original dashboard is restored
  • When all rules are not matched on the Dashboard Layout panel the original dashboard is restored
  • Have a refresh button on the Dashboard Layout panel that forces the dashboard back to its original state

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.