Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added documentation for datasource v1 and v2 #71

Merged
merged 26 commits into from
Apr 28, 2023
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
46aac3e
added documentation for datasource v1 and v2
krgrsebastian Mar 10, 2023
c2747e9
Merge main into feat/52/grafanaplugin_datasource_v2
github-actions[bot] Mar 10, 2023
9dbf63f
added matteos and jeremys feedback
krgrsebastian Mar 10, 2023
4f4398f
Merge remote-tracking branch 'origin/feat/52/grafanaplugin_datasource…
krgrsebastian Mar 10, 2023
666aa9b
shortcodes
krgrsebastian Mar 10, 2023
df568ee
Merge main into feat/52/grafanaplugin_datasource_v2
github-actions[bot] Mar 10, 2023
ebb1ffb
added all options to transform queried data, also did matteos changes
krgrsebastian Mar 13, 2023
9dd9ec5
git lfs
krgrsebastian Mar 13, 2023
ac9d8fe
git lfs
krgrsebastian Mar 13, 2023
d942df9
test
krgrsebastian Mar 13, 2023
445cdf8
test
krgrsebastian Mar 13, 2023
0977ebf
fixed pictures
krgrsebastian Mar 13, 2023
605a5b5
Merge main into feat/52/grafanaplugin_datasource_v2
github-actions[bot] Mar 14, 2023
d64c447
added timescale documentation and removed previous explanations
krgrsebastian Mar 14, 2023
19b6367
Merge remote-tracking branch 'origin/feat/52/grafanaplugin_datasource…
krgrsebastian Mar 14, 2023
e564a4b
Merge main into feat/52/grafanaplugin_datasource_v2
github-actions[bot] Mar 14, 2023
7bf95a2
added timescale documentation and removed previous explanations
krgrsebastian Mar 14, 2023
e8702fc
Merge remote-tracking branch 'origin/feat/52/grafanaplugin_datasource…
krgrsebastian Mar 14, 2023
7d2757a
Merge main into feat/52/grafanaplugin_datasource_v2
github-actions[bot] Mar 14, 2023
1b1b389
timescale documentation
krgrsebastian Mar 14, 2023
5678617
Merge remote-tracking branch 'origin/feat/52/grafanaplugin_datasource…
krgrsebastian Mar 14, 2023
17aa27d
Merge main into feat/52/grafanaplugin_datasource_v2
github-actions[bot] Mar 14, 2023
b5cd7c4
feedback jeremy and matteo
krgrsebastian Mar 16, 2023
429238c
included Matteos Feedback
krgrsebastian Apr 28, 2023
14ed452
included Matteos Feedback
krgrsebastian Apr 28, 2023
f1c42e9
Merge remote-tracking branch 'origin/main' into feat/52/grafanaplugin…
krgrsebastian Apr 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions umh.docs.umh.app/archetypes/grafana-plugins.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: "{{ replace .Name "-" " " | title }}"
content_type: grafana-plugin
description: |
The technical documentation of the {{ .Name }} plugin,
which
weight: 0
---

<!-- overview -->

<!-- body -->

<!-- Add the prerequisites section only if needed -->
## {{% heading "prerequisites" %}}

## {{% heading "howitworks" %}}

## {{% heading "configuration" %}}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
title: "Factoryinput-panel"
title: "Factoryinput Panel"
content_type: task
description: |
This page has the technical documentation of the microservice factoryinput-panel, which allows for easy execution of MQTT messages inside the UMH stack from a Grafana panel.
weight: 9000
This page contains the technical documentation of the plugin factoryinput-panel, which allows for easy execution of MQTT messages inside the UMH stack from a Grafana panel.
weight: 3000
---

{{% notice warning %}}
krgrsebastian marked this conversation as resolved.
Show resolved Hide resolved
This microservice is still in development and is not considered stable for production use
This plugin is still in development and is not considered stable for production use
{{% /notice %}}


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
title: "Umh Datasource V2"
content_type: grafana-plugin
description: |
This page contains the technical documentation of the Grafana umh-datasource-v2 plugin,
which allows for easy data extraction from factoryinsight.
weight: 1000
---

<!-- overview -->

The umh-datasource-v2 plugin is a Grafana data source plugin that allows you to fetch
resources from a database and build queries for your dashboard.

<!-- body -->

## {{% heading "howitworks" %}}

1. When creating a new panel, select umh-datasource-v2 from the Data source drop-down menu. It will then fetch the
resources
from the database. The loading time may depend on your internet speed.

![selectingDatasource](/images/grafana-plugins/grafanaPluginsSelectingV2.png?width=80%)

2. Select the resources in the cascade menu to build your query. **DefaultArea** and **DefaultProductionLine** are
placeholders
for the future implementation of the new data model.

![selectingDatasource](/images/grafana-plugins/grafanaPluginsSelectingWorkCell.png?width=80%)

3. Only the available values for the specified work cell will be fetched from the database. You can then select which
data value you want to query.

![selectingDatasource](/images/grafana-plugins/grafanaPluginsSelectingValue.png?width=80%)

4. Next you can specify how to transform the data, depending on what value you selected.

For *processValue*:

- Time bucket: allows you to aggregate data into buckets of time. Read more on the [timescale documentation](https://docs.timescale.com/api/latest/hyperfunctions/time_bucket/)
- Aggregates: allows you to choose between different aggregate functions like Average, Maximum, Minimum, Sum and
Count. Read more on the [timescale documentation](https://docs.timescale.com/api/latest/hyperfunctions/statistical-and-regression-analysis/stats_agg-one-variable/)
- Handling missing values: allows you to configure how to handle missing values. Read more on the [timescale documentation](https://docs.timescale.com/api/latest/hyperfunctions/gapfilling/time_bucket_gapfill/)
- Include last datapoint before time interval
- Include next datapoint after time interval

For *state*:

- Keep state integer: if enabled, instead of showing the string representation of the state, it shows its
integer value. e.g. instead of "No shifts", returns 160000.

For *tables*:

- Include running processes
- Keep states works the same way as Keep state integer, but only for availability tables, like
availabilityHistogram and availabilityTotal.


krgrsebastian marked this conversation as resolved.
Show resolved Hide resolved
![selectingDatasource](/images/grafana-plugins/grafanaPluginsSelectingOptions.png?width=80%)

## {{% heading "configuration" %}}

1. In Grafana, navigate to the Data sources configuration panel.

![selectingConfiguration](/images/grafana-plugins/grafanaPluginsConfigurationPanel.png?width=15%)

2. Select **umh-v2-datasource** to configure it.

![selectingConfiguration](/images/grafana-plugins/grafanaPluginsSelectingConfiguration.png?width=80%)

3. Configurations:
- Base URL: the URL for the factoryinsight backend. Defaults to `http://{{< resource type="service" name="factoryinsight" >}}/`.
- Enterprise name: previously **customerID** for the old datasource plugin. Defaults to **factoryinsight**.
- API Key: authenticates the API calls to factoryinsight.
Can be found with UMHLens by going to Secrets → {{< resource type="secret" name="factoryinsight" >}} → apiKey.
It should follow the format `Basic xxxxxxxx`.

![selectingConfiguration](/images/grafana-plugins/grafanaPluginsConfuguringDatasourceV2.png?width=80%)
Original file line number Diff line number Diff line change
@@ -1,44 +1,46 @@
+++
title = "umh-datasource"
menuTitle = "umh-datasource"
chapter = false
weight = 5
draft = false
description = "The technical documentation of the microservice umh-datasource, which allows for easy data extraction from factoryinsight."
+++
---
title: "Umh Datasource"
content_type: grafana-plugin
description: |
This page contains the technical documentation of the plugin umh-datasource, which allows for easy data extraction from factoryinsight.
weight: 2000
---

UMH Datasource provides a Grafana 8.X compatible plugin, allowing easy data extraction from the UMH factoryinsight microservice.
<!-- overview -->

## Get started
{{% notice warning %}}
We are no longer maintaining this plugin. Instead, use our new plugin datasource-v2 for data extraction from factoryinsight.
{{% /notice %}}

For development, the steps to build the plugin from source are described here.
The umh-datasource is a Grafana 8.X compatible plugin, that allows you to fetch resources from a database
and build queries for your dashboard.

1. Clone the datasource repository `[email protected]:united-manufacturing-hub/united-manufacturing-hub-datasource.git`
<!-- body -->

2. Install dependencies
## {{% heading "howitworks" %}}

```bash
yarn install
```
1. When creating a new panel, select **umh-datasource** from the Data source drop-down menu. It will then fetch the resources
from the database. The loading time may depend on your internet speed.

3. Build plugin in development mode or run in watch mode
![selectingDatasource](/images/grafana-plugins/grafanaPluginsSelectingV1.png?width=85%)

```bash
yarn dev
```
2. Select your query parameters **Location**, **Asset** and **Value** to build your query.

4. Build plugin in production mode (not recommended due to [Issue 32336](https://github.com/grafana/grafana/issues/32336)).
```bash
yarn build
```
5. Move the resulting dis folder in your Grafana plugins directory.
![selectingDatasource](/images/grafana-plugins/grafanaPluginsSelectingValuesV1.png?width=85%)

- Windows: `C:\Program Files\GrafanaLabs\grafana\data\plugins`
- Linux: `/var/lib/grafana/plugins`
## {{% heading "configuration" %}}

6. Rename the folder to umh-datasource.
1. In Grafana, navigate to the Data sources configuration panel.

7. Enable the [enable development mode](https://grafana.com/docs/grafana/latest/administration/configuration/) to load unsigned plugins.
![selectingConfiguration](/images/grafana-plugins/grafanaPluginsConfigurationPanel.png?width=15%)

8. restart your Grafana service.
2. Select **umh-datasource** to configure it.

![selectingConfiguration](/images/grafana-plugins/grafanaPluginsSelectingConfiguration.png?width=85%)
3. Configurations:
- Base URL: the URL for the factoryinsight backend. Defaults to `http://{{< resource type="service" name="factoryinsight" >}}/`.
- Enterprise name: previously **customerID** for the old datasource plugin. Defaults to **factoryinsight**.
- API Key: authenticates the API calls to factoryinsight.
Can be found with UMHLens by going to Secrets → {{< resource type="secret" name="factoryinsight" >}} → apiKey. It should follow the format `Basic xxxxxxxx`.

![selectingConfiguration](/images/grafana-plugins/grafanaPluginsConfiguringDatasourceV1.png?width=85%)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.