Commit 8d87d0ae authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Performance Evaluation:

- defined README.md file with commands
- created example dashboard
- defined deploy specs
- defined service monitors for context, device, service, slice components
parent 8c957489
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
# Performance Evaluation Method Wrapper

- deploy as:
```
tfs@tfs-vm:~/tfs-ctrl$ source src/common/perf_eval_method_wrapper/tests/deploy_specs.sh 
tfs@tfs-vm:~/tfs-ctrl$ ./deploy.sh 
```

- expose prometheus and grafana
terminal 1 (prometheus UI):
```
kubectl port-forward -n monitoring service/prometheus-k8s --address 0.0.0.0 9090:9090
```

terminal 2 (prometheus internal grafana):
```
kubectl port-forward -n monitoring service/grafana --address 0.0.0.0 3000:3000
```

terminal 3 (alertmanager):
```
kubectl port-forward -n monitoring service/alertmanager-main --address 0.0.0.0 9093:9093
```

- log into grafana:
  - 127.0.0.1:3000
  - admin/admin
  - upload dashboard_prometheus_histogram.json
  - watch in real time the dashboard

- upload topology through WebUI and navigate
  - should see histogram changing in Grafana
+110 −0
Original line number Diff line number Diff line
{
    "annotations": {
      "list": [
        {
          "builtIn": 1,
          "datasource": "-- Grafana --",
          "enable": true,
          "hide": true,
          "iconColor": "rgba(0, 211, 255, 1)",
          "name": "Annotations & Alerts",
          "type": "dashboard"
        }
      ]
    },
    "editable": true,
    "gnetId": null,
    "graphTooltip": 0,
    "id": 25,
    "links": [],
    "panels": [
      {
        "cards": {
          "cardPadding": null,
          "cardRound": null
        },
        "color": {
          "cardColor": "#b4ff00",
          "colorScale": "sqrt",
          "colorScheme": "interpolateRdYlGn",
          "exponent": 0.5,
          "max": null,
          "min": 0,
          "mode": "opacity"
        },
        "dataFormat": "tsbuckets",
        "datasource": "prometheus",
        "fieldConfig": {
          "defaults": {},
          "overrides": []
        },
        "gridPos": {
          "h": 11,
          "w": 24,
          "x": 0,
          "y": 0
        },
        "heatmap": {},
        "hideZeroBuckets": false,
        "highlightCards": true,
        "id": 2,
        "legend": {
          "show": true
        },
        "pluginVersion": "7.5.4",
        "reverseYBuckets": false,
        "targets": [
          {
            "exemplar": true,
            "expr": "sum(increase(Context_GetDevice_histogram_duration_bucket[$__interval])) by (le)",
            "format": "heatmap",
            "instant": false,
            "interval": "",
            "intervalFactor": 1,
            "legendFormat": "{{le}}",
            "queryType": "randomWalk",
            "refId": "A"
          }
        ],
        "title": "TFS / Histogram Component RPCs",
        "tooltip": {
          "show": true,
          "showHistogram": true
        },
        "type": "heatmap",
        "xAxis": {
          "show": true
        },
        "xBucketNumber": null,
        "xBucketSize": null,
        "yAxis": {
          "decimals": null,
          "format": "s",
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true,
          "splitFactor": null
        },
        "yBucketBound": "auto",
        "yBucketNumber": null,
        "yBucketSize": null
      }
    ],
    "refresh": "5s",
    "schemaVersion": 27,
    "style": "dark",
    "tags": [],
    "templating": {
      "list": []
    },
    "time": {
      "from": "now-30m",
      "to": "now"
    },
    "timepicker": {},
    "timezone": "",
    "title": "TFS / Histogram Component RPCs",
    "uid": "eAg-wsOVk",
    "version": 2
}
+26 −0
Original line number Diff line number Diff line
# Set the URL of your local Docker registry where the images will be uploaded to.
export TFS_REGISTRY_IMAGE="http://localhost:32000/tfs/"

# Set the list of components, separated by spaces, you want to build images for, and deploy.
# Supported components are:
#   context device automation policy service compute monitoring webui
#   interdomain slice pathcomp dlt
#   dbscanserving opticalattackmitigator opticalattackdetector
#   l3_attackmitigator l3_centralizedattackdetector l3_distributedattackdetector
export TFS_COMPONENTS="context device pathcomp service slice webui"

# Set the tag you want to use for your images.
export TFS_IMAGE_TAG="dev"

# Set the name of the Kubernetes namespace to deploy to.
export TFS_K8S_NAMESPACE="tfs"

# Set additional manifest files to be applied after the deployment
export TFS_EXTRA_MANIFESTS="manifests/nginx_ingress_http.yaml src/common/perf_eval_method_wrapper/tests/servicemonitors.yaml"

# Set the new Grafana admin password
export TFS_GRAFANA_PASSWORD="admin123+"

# If not already set, disable skip-build flag.
# If TFS_SKIP_BUILD is "YES", the containers are not rebuilt-retagged-repushed and existing ones are used.
export TFS_SKIP_BUILD=${TFS_SKIP_BUILD:-"YES"}
+115 −0
Original line number Diff line number Diff line
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  namespace: monitoring # namespace where prometheus is running
  name: tfs-contextservice-metric
  labels:
    app: contextservice
    #release: prometheus
    #release: prom  # name of the release 
    # ( VERY IMPORTANT: You need to know the correct release name by viewing 
    #   the servicemonitor of Prometheus itself: Without the correct name, 
    #   Prometheus cannot identify the metrics of the Flask app as the target.)
spec:
  selector:
    matchLabels:
      # Target app service
      #namespace: tfs
      app: contextservice # same as above
      #release: prometheus # same as above
  endpoints:
  - port: metrics # named port in target app
    scheme: http
    path: /metrics # path to scrape
    interval: 15s # scrape interval
  namespaceSelector:
    any: false
    matchNames:
    - tfs # namespace where the app is running
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  namespace: monitoring # namespace where prometheus is running
  name: tfs-deviceservice-metric
  labels:
    app: deviceservice
    #release: prometheus
    #release: prom  # name of the release 
    # ( VERY IMPORTANT: You need to know the correct release name by viewing 
    #   the servicemonitor of Prometheus itself: Without the correct name, 
    #   Prometheus cannot identify the metrics of the Flask app as the target.)
spec:
  selector:
    matchLabels:
      # Target app service
      #namespace: tfs
      app: deviceservice # same as above
      #release: prometheus # same as above
  endpoints:
  - port: metrics # named port in target app
    scheme: http
    path: /metrics # path to scrape
    interval: 15s # scrape interval
  namespaceSelector:
    any: false
    matchNames:
    - tfs # namespace where the app is running
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  namespace: monitoring # namespace where prometheus is running
  name: tfs-serviceservice-metric
  labels:
    app: serviceservice
    #release: prometheus
    #release: prom  # name of the release 
    # ( VERY IMPORTANT: You need to know the correct release name by viewing 
    #   the servicemonitor of Prometheus itself: Without the correct name, 
    #   Prometheus cannot identify the metrics of the Flask app as the target.)
spec:
  selector:
    matchLabels:
      # Target app service
      #namespace: tfs
      app: serviceservice # same as above
      #release: prometheus # same as above
  endpoints:
  - port: metrics # named port in target app
    scheme: http
    path: /metrics # path to scrape
    interval: 15s # scrape interval
  namespaceSelector:
    any: false
    matchNames:
    - tfs # namespace where the app is running
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  namespace: monitoring # namespace where prometheus is running
  name: tfs-sliceservice-metric
  labels:
    app: sliceservice
    #release: prometheus
    #release: prom  # name of the release 
    # ( VERY IMPORTANT: You need to know the correct release name by viewing 
    #   the servicemonitor of Prometheus itself: Without the correct name, 
    #   Prometheus cannot identify the metrics of the Flask app as the target.)
spec:
  selector:
    matchLabels:
      # Target app service
      #namespace: tfs
      app: sliceservice # same as above
      #release: prometheus # same as above
  endpoints:
  - port: metrics # named port in target app
    scheme: http
    path: /metrics # path to scrape
    interval: 15s # scrape interval
  namespaceSelector:
    any: false
    matchNames:
    - tfs # namespace where the app is running