diff --git a/packages/cactus-plugin-satp-hermes/docker-compose-satp.yml b/packages/cactus-plugin-satp-hermes/docker-compose-satp.yml index 998ad9e8e7..99e32ec43e 100644 --- a/packages/cactus-plugin-satp-hermes/docker-compose-satp.yml +++ b/packages/cactus-plugin-satp-hermes/docker-compose-satp.yml @@ -24,10 +24,13 @@ services: OTEL_METRIC_EXPORT_INTERVAL: "1000" OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION: explicit_bucket_histogram ports: - - "4000:3000" # Grafana + - "3000:3000" # Grafana - "4317:4317" # OpenTelemetry gRPC endpoint - "4318:4318" # OpenTelemetry HTTP endpoint - "9090:9090" # Prometheus - "3100:3100" # Loki - "3200:3200" # Tempo restart: unless-stopped + volumes: + - ./grafana/provisioning/dashboards:/otel-lgtm/grafana/conf/provisioning/dashboards + - ./grafana/provisioning/alerting:/otel-lgtm/grafana/conf/provisioning/alerting diff --git a/packages/cactus-plugin-satp-hermes/grafana/README.md b/packages/cactus-plugin-satp-hermes/grafana/README.md new file mode 100644 index 0000000000..c5ea7b40c6 --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/grafana/README.md @@ -0,0 +1,164 @@ +# Grafana / OTEL-LGTM Provisioning Guide + +This repository defines the provisioning setup for **Grafana** as part of the **[OpenTelemetry LGTM](https://hub.docker.com/r/grafana/otel-lgtm) (Loki, Grafana, Tempo, Prometheus)** stack. +Provisioning allows you to **automatically configure dashboards, alerting rules, and contact points** through YAML files — ensuring consistent, version-controlled observability configurations. + +--- + +## Overview + +Provisioning in Grafana means preloading configuration files that are applied automatically when Grafana starts. +This setup covers three main provisioning categories: + +1. **Dashboards** – Predefined visualizations for metrics, logs, and traces. +2. **Alerting Rules** – Conditions that trigger alerts based on metric or log thresholds. +3. **Contact Points** – Notification destinations for alert delivery (e.g., email, Discord, Slack). + +All provisioning files are placed inside the docker image under the directory `/otel-lgtm/grafana/conf/provisioning/` (or equivalent custom mount path defined in the [`docker-compose-satp.yml`](../docker-compose-satp.yml)). + +--- + +## Directory Structure + +To provision the monitor system with dashboards, alerts or contact points use the following repository layout: + +provisioning/
+├── dashboards/
+│ ├── [grafana-dashboards.yaml](#grafana-dashboardsyaml)     *# Dashboard provisioning configuration*
+│ ├── dashboard-#1.json       *# Dashboard #1 definition*
+│ ├── ...
+│ └── [dashboard-#n.json](#dashboard-njson)       *# Dashboard #n definition*
+├── alerting/
+│ ├── alert-#1.yaml          *# Alert group and rule definitions #1*
+│ ├── ...
+│ ├── [alert-#m.yaml](#alert-myaml)         *# Alert group and rule definitions #m*
+│ ├── contact-point-#1.yaml      *# Contact point definitions #1*
+│ ├── ...
+│ └── [contact-point-#p.yaml](#contact-point-pyaml)      *# Contact point definitions #p*
+ +### grafana-dashboards.yaml + +This file contains the list of dashboards to be made available on start of the docker image. Each entry in the providers list defines a new dashboard. + +### dashboard-#n.json + +An example of a dashboard, that must be included in the [grafana-dashboards.yaml](#grafana-dashboardsyaml). Each dashboard is defined in a separate JSON file + +Official documentation for dashboard provisioning available [here](https://grafana.com/docs/grafana/latest/administration/provisioning/#dashboards). + +### alert-#m.yaml + +An example of an alert. Alerts are defined in yaml files. + +Official documentation for alert provisioning available [here](https://grafana.com/docs/grafana/latest/alerting/set-up/provision-alerting-resources/file-provisioning/#import-alert-rules). + +### contact-point-#p.yaml + +An example of a contact point. Contact points are defined in yaml files. + +Official documentation for contact point provisioning available [here](https://grafana.com/docs/grafana/latest/alerting/set-up/provision-alerting-resources/file-provisioning/#import-contact-points). + +## Usage Explanation + +To customize the available dashboards, alerts and contact points, there are some files that require creation or modification. To create these elements there are 2 possible options: + +- Read the [official documentation](https://grafana.com/docs/grafana/latest/) (less intuitive). +- Initiate the docker image, create the element and export it (more interactive). + +In this explanation, we will provide a step-by-step tutorial on how to create a [dashboard](#dashboard-creation), an [alert rule](#alert-rule-creation) or a [contact point](#contact-point-creation) with the help of Grafana's built-in tools (the second option). + +### Dashboard Creation + +1. Go to the [`test file`](../src/test/typescript/integration/monitoring/functionality.test.ts) for monitoring and comment the lines that call the function `stopDockerComposeService`. + +2. Run the test using `npx jest ./packages/cactus-plugin-satp-hermes/src/test/typescript/integration/monitoring/functionality.test.ts` from the project root. + +*Note: This is done to make the metrics appear in Grafana, facilitating the process of creation.* + +3. Login into Grafana using the following [link](http://localhost:3000/login) using `admin` as both *username* and *password*. + +*Note: You might require to change the address in case it is not running on localhost.* + +4. Access the Grafana dashboard endpoint using the following [link](http://localhost:3000/dashboards). + +*Note: You might require to change the address in case it is not running on localhost.* + +5. Click the `New` button and then the `New dashboard` button. + +6. Click the `Add visualization` and select a data source for the data visualization. + +7. Configure the panel with the desired data. + +8. Click `Save dashboard`, name the dashboard and click `Save`. + +9. If more panels are desired, click `Add` and then `Visualization`. Redo step 7 and 8. + +10. After all panels are added, click `Exit edit` and then, `Export` followed by `Export as code`. + +11. Click `Download file`, then move the file to the folder `grafana/provisioning/dashboards/` inside the package for the SATP-Hermes project. + +12. On the file [grafana-dashboards.yaml](./provisioning/dashboards/grafana-dashboards.yaml), create a new entry by copying an existing example one and change the path to have the name of the new dashboard and change the property name of the dashboard itself. + +13. Kill the running docker image for the container regarding otel-lgtm, rerun the test from step 2 and check if the dashboard is automatically provisioned. + +14. Go to the [`test file`](../src/test/typescript/integration/monitoring/functionality.test.ts) for monitoring and uncomment the commented lines that call the function `stopDockerComposeService`. + +### Contact Point Creation + +*Note: This section appears before alert creation since alerts rely on the existence of established contact points.* + +1. Access the Grafana dashboard endpoint using the following [link](http://localhost:3000/alerting/notifications). + +*Note: You might require to change the address in case it is not running on localhost.* + +2. Click the `Create contact point` button. + +3. Browse the integration options, selecting the one that better suits the use case (eg. discord, email, etc.). + +4. Fill the name of the contact point and the specific details of the integration option. + +5. Click `Test` to assess the correct functioning of the contact point. + +6. Click `Save contact point`. + +7. Click `More` on the newly created contact point, followed by `Export`. + +8. Click `Download`, then move the file to the folder `grafana/provisioning/alerting/` inside the package for the SATP-Hermes project. + +### Alert Rule Creation + +1. Go to the [`test file`](../src/test/typescript/integration/monitoring/functionality.test.ts) for monitoring and comment the lines that call the function `stopDockerComposeService`. + +2. Run the test using `npx jest ./packages/cactus-plugin-satp-hermes/src/test/typescript/integration/monitoring/functionality.test.ts` from the project root. + +*Note: This is done to make the metrics appear in Grafana, facilitating the process of creation.* + +3. Access the Grafana dashboard endpoint using the following [link](http://localhost:3000/alerting/list). + +*Note: You might require to change the address in case it is not running on localhost.* + +4. Click the `New alert rule` button. + +5. Fill in the name and select the metric to track. + +6. Configure the threshold that should trigger the alarm. + +7. Select the folder for your rule or click `New folder` to create a new one, giving it a name and clicking `Create`. + +8. Select the evaluation group for your rule (periodicity of evaluation) or click `New evaluation group` to create a new one, giving it a name and an evaluation interval, and clicking `Create`. + +9. Select the contact point (if none is defined, check its corresponding [section](#contact-point-creation)). + +10. (Optional) Configure the notification message. + +11. Click `Save`. + +12. Click `More` on the newly created alert rule, followed by `Export` and `With modifications`. + +13. Scroll down and click `Export`. + +14. Click `Download`, then move the file to the folder `grafana/provisioning/alerting/` inside the package for the SATP-Hermes project. + +15. Kill the running docker image for the container regarding otel-lgtm, rerun the test from step 2 and check if the alert is automatically provisioned. + +16. Go to the [`test file`](../src/test/typescript/integration/monitoring/functionality.test.ts) for monitoring and uncomment the commented lines that call the function `stopDockerComposeService`. diff --git a/packages/cactus-plugin-satp-hermes/grafana/provisioning/alerting/example-alert-#1-failed_transactions.yaml b/packages/cactus-plugin-satp-hermes/grafana/provisioning/alerting/example-alert-#1-failed_transactions.yaml new file mode 100644 index 0000000000..ff8419035a --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/grafana/provisioning/alerting/example-alert-#1-failed_transactions.yaml @@ -0,0 +1,65 @@ +apiVersion: 1 + +# Definition of alert rule for failed transactions +# THIS IS AN EXAMPLE FILE. REPLACE THE VALUES WITH YOUR OWN ALERT CONDITIONS TO ENABLE ALERT NOTIFICATIONS. +groups: + - orgId: 1 + name: Alerts + folder: Alerts + interval: 1m + rules: + - uid: bf0keqynb8ni8d + title: Failed Transactions + condition: Failed Transactions over 0 + data: + - refId: Failed Transactions + relativeTimeRange: + from: 600 + to: 0 + datasourceUid: prometheus + model: + disableTextWrap: false + editorMode: builder + expr: failed_transactions_total + fullMetaSearch: false + includeNullMetadata: true + instant: true + intervalMs: 1000 + legendFormat: __auto + maxDataPoints: 43200 + range: false + refId: Failed Transactions + useBackend: false + - refId: Failed Transactions over 0 + datasourceUid: __expr__ + model: + conditions: + - evaluator: + params: + - 0 + type: gt + operator: + type: and + query: + params: + - Failed Transactions over 0 + reducer: + params: [] + type: last + type: query + datasource: + type: __expr__ + uid: __expr__ + expression: Failed Transactions + intervalMs: 1000 + maxDataPoints: 43200 + refId: Failed Transactions over 0 + type: threshold + noDataState: NoData + execErrState: Error + for: 1m + annotations: {} + labels: {} + isPaused: false + notification_settings: + receiver: test-contact-points diff --git a/packages/cactus-plugin-satp-hermes/grafana/provisioning/alerting/example-contact-points.yaml b/packages/cactus-plugin-satp-hermes/grafana/provisioning/alerting/example-contact-points.yaml new file mode 100644 index 0000000000..d7f4e819d3 --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/grafana/provisioning/alerting/example-contact-points.yaml @@ -0,0 +1,22 @@ +apiVersion: 1 + +# Definition of contact points for alerting +# THIS IS AN EXAMPLE FILE. REPLACE THE VALUES WITH YOUR OWN CONTACT INFORMATION TO ENABLE ALERT NOTIFICATIONS. +contactPoints: + - orgId: 1 + name: test-contact-points + receivers: + - uid: af1q2g33sy3uod + type: discord + settings: + # Replace with your Discord webhook URL (to test existing one, join the server using https://discord.gg/VnvMpcs2kT) + url: https://discord.com/api/webhooks/1430194325597196369/7Giic1fhAVEyhSO3Uy00yzgsyWMREEILBPMQACKXUghoB1KNdoOhoqWHntdE0CEanEJb + use_discord_username: false + disableResolveMessage: false + - uid: ff1q2g33sy3upc + type: email + settings: + # Replace with your email address + addresses: example@gmail.com + singleEmail: false + disableResolveMessage: false diff --git a/packages/cactus-plugin-satp-hermes/grafana/provisioning/dashboards/example_financial_metrics.json b/packages/cactus-plugin-satp-hermes/grafana/provisioning/dashboards/example_financial_metrics.json new file mode 100644 index 0000000000..0ce205b3be --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/grafana/provisioning/dashboards/example_financial_metrics.json @@ -0,0 +1,531 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": 3, + "links": [], + "panels": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "showValues": false, + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 0 + }, + "id": 2, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.2.0", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "builder", + "expr": "sum(value_exchanged_USD_total{transaction_direction=\"sent\"})", + "fullMetaSearch": false, + "includeNullMetadata": true, + "legendFormat": "Total Value Sent", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Total Value Sent", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "showValues": false, + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 0 + }, + "id": 3, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.2.0", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "builder", + "expr": "sum(value_exchanged_USD_total{transaction_direction=\"received\"})", + "fullMetaSearch": false, + "includeNullMetadata": true, + "legendFormat": "Total Value Received", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Total Value Received", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "fillOpacity": 80, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineWidth": 1, + "stacking": { + "group": "A", + "mode": "none" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 8 + }, + "id": 1, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.2.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "sum by(operation) (operation_gas_used)", + "fullMetaSearch": false, + "includeNullMetadata": false, + "legendFormat": "__auto", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Operation Gas Used", + "type": "histogram" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "showValues": false, + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 8 + }, + "id": 4, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.2.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "sum(successful_transactions_total)", + "fullMetaSearch": false, + "includeNullMetadata": false, + "legendFormat": "Successful Transactions", + "range": true, + "refId": "A", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "sum(ongoing_transactions)", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "instant": false, + "legendFormat": "Ongoing Transactions", + "range": true, + "refId": "B", + "useBackend": false + } + ], + "title": "Transactions Counts", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "fillOpacity": 80, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineWidth": 1, + "scaleDistribution": { + "type": "linear" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 16 + }, + "id": 5, + "options": { + "barRadius": 0, + "barWidth": 0.97, + "fullHighlight": false, + "groupWidth": 0.7, + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "orientation": "auto", + "showValue": "auto", + "stacking": "none", + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + }, + "xTickLabelRotation": 0, + "xTickLabelSpacing": 0 + }, + "pluginVersion": "12.2.0", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "builder", + "expr": "transaction_gas_used", + "fullMetaSearch": false, + "includeNullMetadata": false, + "legendFormat": "__auto", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Transaction Gas Used", + "type": "barchart" + } + ], + "preload": false, + "schemaVersion": 42, + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now-1h", + "to": "now" + }, + "timepicker": {}, + "timezone": "browser", + "title": "Financial Metrics", + "uid": "db542464-dacc-4721-a9b4-e9557b464179", + "version": 1 +} \ No newline at end of file diff --git a/packages/cactus-plugin-satp-hermes/grafana/provisioning/dashboards/example_performance_metrics.json b/packages/cactus-plugin-satp-hermes/grafana/provisioning/dashboards/example_performance_metrics.json new file mode 100644 index 0000000000..3dbd37de40 --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/grafana/provisioning/dashboards/example_performance_metrics.json @@ -0,0 +1,529 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": 2, + "links": [], + "panels": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "showValues": false, + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 0 + }, + "id": 3, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.2.0", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "builder", + "expr": "sum(operation_gas_used)", + "fullMetaSearch": false, + "includeNullMetadata": false, + "legendFormat": "__auto", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Total Gas Used", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "showValues": false, + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 0 + }, + "id": 2, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.2.0", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "builder", + "expr": "sum(value_exchanged_USD_total)", + "fullMetaSearch": false, + "includeNullMetadata": true, + "legendFormat": "__auto", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Total Exchanged Value", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "showValues": false, + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 8 + }, + "id": 1, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.2.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "sum(initiated_transactions_total)", + "fullMetaSearch": false, + "includeNullMetadata": true, + "legendFormat": "Initiated", + "range": true, + "refId": "A", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "sum(successful_transactions_total)", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "instant": false, + "legendFormat": "Successful", + "range": true, + "refId": "B", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "sum(failed_transactions_total)", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "instant": false, + "legendFormat": "Failed", + "range": true, + "refId": "C", + "useBackend": false + } + ], + "title": "Transactions", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "fillOpacity": 80, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineWidth": 1, + "stacking": { + "group": "A", + "mode": "none" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 8 + }, + "id": 4, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.2.0", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "builder", + "expr": "transaction_duration", + "fullMetaSearch": false, + "includeNullMetadata": true, + "legendFormat": "__auto", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Transaction Duration", + "type": "histogram" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "fillOpacity": 80, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineWidth": 1, + "stacking": { + "group": "A", + "mode": "none" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 16 + }, + "id": 5, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.2.0", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "builder", + "expr": "operation_duration_milliseconds_bucket", + "fullMetaSearch": false, + "includeNullMetadata": true, + "legendFormat": "__auto", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Operation Duration", + "type": "histogram" + } + ], + "preload": false, + "refresh": "5s", + "schemaVersion": 42, + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now-15m", + "to": "now" + }, + "timepicker": {}, + "timezone": "browser", + "title": "Performance Metrics", + "uid": "7ca055bd-1665-4c41-8899-645e5c07fcc8", + "version": 1 +} \ No newline at end of file diff --git a/packages/cactus-plugin-satp-hermes/grafana/provisioning/dashboards/example_system_overview.json b/packages/cactus-plugin-satp-hermes/grafana/provisioning/dashboards/example_system_overview.json new file mode 100644 index 0000000000..931f937ef5 --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/grafana/provisioning/dashboards/example_system_overview.json @@ -0,0 +1,457 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": 6, + "links": [], + "panels": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 0 + }, + "id": 3, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.1.1", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "builder", + "expr": "created_sessions_total", + "fullMetaSearch": false, + "includeNullMetadata": true, + "legendFormat": "Created Sessions", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Number of Sessions", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 0 + }, + "id": 4, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.1.1", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "builder", + "expr": "sum(successful_transactions_total)", + "fullMetaSearch": false, + "includeNullMetadata": true, + "legendFormat": "Successful Transactions", + "range": true, + "refId": "A", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "failed_transactions_total", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "instant": false, + "legendFormat": "Failed Transactions", + "range": true, + "refId": "B", + "useBackend": false + } + ], + "title": "Transactions", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 8, + "x": 0, + "y": 8 + }, + "id": 1, + "options": { + "minVizHeight": 75, + "minVizWidth": 75, + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showThresholdLabels": false, + "showThresholdMarkers": true, + "sizing": "auto" + }, + "pluginVersion": "12.1.1", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "connected_DLTs", + "fullMetaSearch": false, + "includeNullMetadata": true, + "legendFormat": "__auto", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Connected DLTs", + "type": "gauge" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 8, + "x": 8, + "y": 8 + }, + "id": 5, + "options": { + "minVizHeight": 75, + "minVizWidth": 75, + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showThresholdLabels": false, + "showThresholdMarkers": true, + "sizing": "auto" + }, + "pluginVersion": "12.1.1", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "builder", + "expr": "number_of_supported_assets", + "fullMetaSearch": false, + "includeNullMetadata": true, + "legendFormat": "__auto", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Number of Supported Assets", + "type": "gauge" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 8, + "x": 16, + "y": 8 + }, + "id": 2, + "options": { + "minVizHeight": 75, + "minVizWidth": 75, + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showThresholdLabels": false, + "showThresholdMarkers": true, + "sizing": "auto" + }, + "pluginVersion": "12.1.1", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "gateways", + "fullMetaSearch": false, + "includeNullMetadata": true, + "legendFormat": "__auto", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Gateways", + "type": "gauge" + } + ], + "preload": false, + "schemaVersion": 41, + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now-15m", + "to": "now" + }, + "timepicker": {}, + "timezone": "browser", + "title": "System Overview", + "uid": "3f3c4ad7-55d9-44a1-9e0e-4af0432ac064", + "version": 7 +} \ No newline at end of file diff --git a/packages/cactus-plugin-satp-hermes/grafana/provisioning/dashboards/grafana-dashboards.yaml b/packages/cactus-plugin-satp-hermes/grafana/provisioning/dashboards/grafana-dashboards.yaml new file mode 100644 index 0000000000..556a1f426b --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/grafana/provisioning/dashboards/grafana-dashboards.yaml @@ -0,0 +1,22 @@ +# Grafana dashboard providers configuration +apiVersion: 1 + +# Each entry in the providers list defines a new dashboard +# Each dashboard is defined in a separate JSON file +# THIS IS AN EXAMPLE FILE. MODIFY OR REPLACE THE VALUES WITH YOUR OWN DASHBOARD FILE PATHS TO ENABLE DASHBOARDS. +providers: + - name: "Performance Metrics" + type: file + options: + path: /otel-lgtm/grafana/conf/provisioning/dashboards/example_performance_metrics.json + foldersFromFilesStructure: false + - name: "Financial Metrics" + type: file + options: + path: /otel-lgtm/grafana/conf/provisioning/dashboards/example_financial_metrics.json + foldersFromFilesStructure: false + - name: "System Overview" + type: file + options: + path: /otel-lgtm/grafana/conf/provisioning/dashboards/example_system_overview.json + foldersFromFilesStructure: false \ No newline at end of file diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/services/monitoring/monitor.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/services/monitoring/monitor.ts index d1a77a1a9c..0e8f30bff4 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/services/monitoring/monitor.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/services/monitoring/monitor.ts @@ -146,7 +146,7 @@ export class MonitorService { } const resource = new Resource({ - "service.name": process.env.OTEL_SERVICE_NAME || "Satp-Hermes-Gateway", + "service.name": process.env.OTEL_SERVICE_NAME || "satp-hermes-gateway", }); if (!this.sdk) { @@ -391,16 +391,16 @@ export class MonitorService { } /** - * Increments the counter for the given metric by the specified amount. + * Updates the counter for the given metric by the specified amount. * - * @param metricName - The name of the metric to increment. - * @param amount - The amount to increment the counter by (default is 1). + * @param metricName - The name of the metric to update. + * @param amount - The amount to update the counter by (default is 1). * @param attributes - The attributes to attach to the metric (default is an empty object). - * @param ctx - The context in which to increment the counter (default is the current context). + * @param ctx - The context in which to update the counter (default is the current context). * @throws {UninitializedMonitorServiceError} If the NodeSDK is not initialized. * @throws {Error} If the counter for the given metric does not exist. - * @throws {Error} If the amount to increment is less than 1. - * @returns {Promise} A promise that resolves when the counter is incremented. + * @throws {Error} If the amount to update is less than 1. + * @returns {Promise} A promise that resolves when the counter is updated. */ public async updateCounter( metricName: string, @@ -431,13 +431,6 @@ export class MonitorService { } counter.metric.add(amount, attributes, ctx); - this.logger.trace( - `${fnTag} - Incremented counter: ${metricName} by ${amount} with attributes ${JSON.stringify(attributes)}`, - ); - this.createLog( - "trace", - `${fnTag} - Incremented counter: ${metricName} by ${amount} with attributes ${JSON.stringify(attributes)}`, - ); } /** @@ -473,13 +466,6 @@ export class MonitorService { ); } histogram.record(value, attributes, ctx); - this.logger.trace( - `${fnTag} - Recorded value ${value} in histogram ${metricName} with attributes ${JSON.stringify(attributes)}`, - ); - this.createLog( - "trace", - `${fnTag} - Recorded value ${value} in histogram ${metricName} with attributes ${JSON.stringify(attributes)}`, - ); } /** @@ -507,13 +493,6 @@ export class MonitorService { } const new_ctx = trace.setSpan(ctx, span); - this.createLog( - "trace", - `${fnTag} - Starting span: ${spanName} with tracer: ${tracerName} in context: ${ctx}`, - ); - this.logger.trace( - `${fnTag} - Started span: ${spanName} with tracer: ${tracerName} in context: ${new_ctx}`, - ); return { span, context: new_ctx }; } diff --git a/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/monitoring/functionality.test.ts b/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/monitoring/functionality.test.ts index ce5bf2c479..faa27187d8 100644 --- a/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/monitoring/functionality.test.ts +++ b/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/monitoring/functionality.test.ts @@ -285,7 +285,10 @@ beforeAll(async () => { console.info("Besu Ledger started successfully"); await besuEnv.deployAndSetupContracts(ClaimFormat.BUNGEE); // Start monitoring system - startDockerComposeService("otel-lgtm"); + startDockerComposeService( + path.resolve(__dirname, "../../../../../docker-compose-satp.yml"), + "otel-lgtm", + ); await executeTransfer("100", 1, "100"); }, TIMEOUT); @@ -313,13 +316,16 @@ afterAll(async () => { await Containers.logDiagnostics({ logLevel }); fail("Pruning didn't throw OK"); }); - stopDockerComposeService("otel-lgtm"); + stopDockerComposeService( + path.resolve(__dirname, "../../../../../docker-compose-satp.yml"), + "otel-lgtm", + ); }, TIMEOUT); describe("otel-lgtm captures information when a transaction occurs", () => { it("otel-lgtm ports should be open", async () => { await Promise.all([ - waitForPort(4000), + waitForPort(3000), waitForPort(4317), waitForPort(4318), waitForPort(9090), @@ -348,7 +354,7 @@ describe("otel-lgtm captures information when a transaction occurs", () => { expect(hasValueOne).toBe(true); //If using these links, please comment the function stopDockerComposeService - //http://localhost:4000/a/grafana-metricsdrilldown-app/drilldown?nativeHistogramMetric=&layout=grid&filters-rule=&filters-prefix=&filters-suffix=&from=now-6h&to=now&timezone=browser&var-filters=&var-labelsWingman=%28none%29&search_txt=&var-metrics-reducer-sort-by=default&var-ds=prometheus&var-other_metric_filters= + //http://localhost:3000/a/grafana-metricsdrilldown-app/drilldown?nativeHistogramMetric=&layout=grid&filters-rule=&filters-prefix=&filters-suffix=&from=now-6h&to=now&timezone=browser&var-filters=&var-labelsWingman=%28none%29&search_txt=&var-metrics-reducer-sort-by=default&var-ds=prometheus&var-other_metric_filters= }); it("should capture the transaction logs using Loki", async () => { @@ -356,7 +362,7 @@ describe("otel-lgtm captures information when a transaction occurs", () => { const end = Math.floor(Date.now() / 1000); // now in seconds const start = end - 60 * 60; // 1 hour ago const params = { - query: '{service_name="Satp-Hermes-Gateway"}', + query: '{service_name="satp-hermes-gateway"}', start: start, end: end, limit: 1000, @@ -386,7 +392,7 @@ describe("otel-lgtm captures information when a transaction occurs", () => { expect(hasMessage).toBe(true); //If using these links, please comment the function stopDockerComposeService - //http://localhost:4000/a/grafana-lokiexplore-app/explore?patterns=%5B%5D&var-primary_label=service_name%7C%3D~%7C.%2B&from=now-6h&to=now&timezone=browser&var-lineFormat=&var-ds=loki&var-filters=&var-fields=&var-levels=&var-metadata=&var-jsonFields=&var-all-fields=&var-patterns=&var-lineFilterV2=&var-lineFilters=&var-filters_replica= + //http://localhost:3000/a/grafana-lokiexplore-app/explore?patterns=%5B%5D&var-primary_label=service_name%7C%3D~%7C.%2B&from=now-6h&to=now&timezone=browser&var-lineFormat=&var-ds=loki&var-filters=&var-fields=&var-levels=&var-metadata=&var-jsonFields=&var-all-fields=&var-patterns=&var-lineFilterV2=&var-lineFilters=&var-filters_replica= }); it("should capture the transaction traces using Tempo", async () => { const tempoUrl = `${TEMPO_URL}/api/search`; @@ -401,6 +407,6 @@ describe("otel-lgtm captures information when a transaction occurs", () => { expect(Array.isArray(results)).toBe(true); expect(results.length).toBeGreaterThan(0); //If using these links, please comment the function stopDockerComposeService - //http://localhost:4000/a/grafana-exploretraces-app/explore?from=now-3h&to=now&timezone=browser&var-ds=tempo&var-primarySignal=nestedSetParent%3C0&var-filters=&var-metric=rate&var-groupBy=resource.service.name&var-spanListColumns=&var-latencyThreshold=&var-partialLatencyThreshold=&actionView=breakdown + //http://localhost:3000/a/grafana-exploretraces-app/explore?from=now-3h&to=now&timezone=browser&var-ds=tempo&var-primarySignal=nestedSetParent%3C0&var-filters=&var-metric=rate&var-groupBy=resource.service.name&var-spanListColumns=&var-latencyThreshold=&var-partialLatencyThreshold=&actionView=breakdown }); }); diff --git a/packages/cactus-plugin-satp-hermes/src/test/typescript/test-utils.ts b/packages/cactus-plugin-satp-hermes/src/test/typescript/test-utils.ts index cf716856fd..e4f0cb8110 100644 --- a/packages/cactus-plugin-satp-hermes/src/test/typescript/test-utils.ts +++ b/packages/cactus-plugin-satp-hermes/src/test/typescript/test-utils.ts @@ -37,11 +37,6 @@ export function getTestConfigFilesDirectory(basePath: string): string { return testFilesDirectoryConfig; } -const composeFilePath = path.resolve( - __dirname, - "../../../../../packages/cactus-plugin-satp-hermes/docker-compose-satp.yml", -); - // Function overloads for creating different types of API clients export function createClient( type: "AdminApi", @@ -401,7 +396,10 @@ export interface IContractJson { }; } -export function startDockerComposeService(serviceName: string) { +export function startDockerComposeService( + composeFilePath: string, + serviceName: string, +) { if (!fs.existsSync(composeFilePath)) { throw new Error(`Compose file does not exist at ${composeFilePath}`); } @@ -410,7 +408,10 @@ export function startDockerComposeService(serviceName: string) { }); } -export function stopDockerComposeService(serviceName: string) { +export function stopDockerComposeService( + composeFilePath: string, + serviceName: string, +) { if (!fs.existsSync(composeFilePath)) { throw new Error(`Compose file does not exist at ${composeFilePath}`); }