Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info

ALPHABETA

We are actively developing and refining this feature. Usage and APIs are subject to change. Please send your feedback.

...

Info

As Prometheus and Grafana are external to Connexion, you can create your own queries, charts, tables, and alerts independent of Connexion version. You can also aggregate data across many different Connexion instances, or other platforms such as AWS, operating systems, database hosts, etc.

Prometheus

Prometheus is an open-source systems monitoring and alerting toolkit. It is a standalone open source project and maintained independently of any company. To emphasize this, and to clarify the project's governance structure, Prometheus joined the Cloud Native Computing Foundation in 2016 as the second hosted project, after Kubernetes.

Prometheus collects and stores its metrics as time series data, i.e. metrics information is stored with the timestamp at which it was recorded, alongside optional key-value pairs called labels.

Grafana

Grafana allows you to query, visualize, alert on and understand your metrics no matter where they are stored. Create, explore, and share beautiful dashboards with your team and foster a data driven culture. Read more about Grafana.

Architecture Overview

Connexion metrics are http-hosted in the Prometheus text format. Connexion aggregates metrics across all child processes and then surfaces them over an http(s) connection. Prometheus is configured to ingest these metrics and store them in its time-series database. The frequency of ingestion and the data retention period are configurable within Prometheus.

...

Info

Prometheus and Grafana are not installed as part of Connexion. You must download and install them yourself. They support many different platforms, both on-site and cloud.

Performance Implications

In order to minimize any performance degradation, each metric can be individually enabled (often on a per-channel basis). We strongly recommend you only enable metrics being actively monitored, or, only enable metrics required for debugging/diagnostic purposes temporarily.

Using a Grafana dashboard to monitor the performance of Connexion servers can be a good way to gauge the impact of enabled metrics.

Enable Connexion Metrics

The Connexion metrics platform is disabled by default. To enable the metrics endpoint (which will be scraped by Prometheus), run the Configuration Wizard and navigate to the Services Options page.

...

Once you have confirmed the metrics endpoint is working, you will need to point your installed copy of Prometheus at it.

Prometheus Scraping

Once you have installed Prometheus (https://prometheus.io/docs/prometheus/latest/installation/, no additional packages are required), navigate .

Navigate to the prometheus.yml configuration file.

...

  • job_name: You can optionally set this to ‘Connexion’. This can be useful if you choose to include other metrics sources (database servers, AWS, etc.)

  • scheme: This must be changed to https

  • targets: For each Connexion instance you wish to scrape, enter a - targets: MyCxnServerDnsName:Port entry.

  • labels / instance: If your server DNS name is not what you want displayed in your dashboards, enter a descriptive name in the instance block.

  • insecure_skip_verify: Set this to true to tell Prometheus to accept the Connexion self-signed certificate.

Example:

Code Block
# my global config
global:
  scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).

# Alertmanager configuration
alerting:
  alertmanagers:
    - static_configs:
        - targets:
          # - alertmanager:9093

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: "Connexion"
    scheme: https

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
      - targets: ["localhost:8092"]
        labels:
          instance: 'JR-Work'
    tls_config:
       insecure_skip_verify: true
Info

NOTE: Do not use tabs when editing the Prometheus yml file

Prometheus exposes a web console on port 9090. Navigate to this page on your Prometheus host and then select the Status menu and Targets item. If Prometheus is able to scrape the Connexion endpoint, your screen should display an UP state in green.

...

Once you have confirmed the UP state, you should install and configure Grafana.

Prometheus doesn’t support installation as a service (on Windows) out of the box. If you want to install Prometheus as a service on Windows, you will need to download nssm, or, use the copy of nssm distributed with Grafana. You can use the following commands to install prometheus as a service:

Code Block
languagenone
nssm install prometheus <path to prometheus.exe here>
nssm set prometheus AppParameters --web.listen-address :9092 <--only if you want to change the default port
nssm set prometheus AppParameters --storage.tsdb.retention.time 365d <--only if you want to change the default retention

Grafana Configuration

Once installed, Grafana exposes a web console on port 3000. Navigate to your Grafana host and select the Add your first data source link.

Info

The default username/password to log into Grafana is admin/admin. You will be prompted to change this.

...

Select the Prometheus option and fill in the Host address. If your Grafana instance will be accessible outside a secured network, you must secure it (there are many options for this).

Now that you have the metrics infrastructure in place, learn how to create and configure metrics within Connexion.