Skip to main content

prometheus exporter for OpenMLDB

Project description

OpenMLDB Prometheus Exporter

PyPI PyPI - Python Version

Intro

This directory contains

  1. OpenMLDB Exporter exposing prometheus metrics
  2. OpenMLDB mixin provides well-configured examples for prometheus server and grafana dashboard

Requirements

  • A runnable OpenMLDB instance that is accessible from your network
  • OpenMLDB version >= 0.5.0
  • Python >= 3.8

Setup

For those want to try, simply install from pip, it will install the latest release:

pip install openmldb-exporter

Then type

openmldb-exporter -h

To see which flags should provided.

Developers may refer Development for how to setup openmldb exporter from source code.

Development

Extra Requirements

  • Same in Requirements
  • poetry as build tool
  • cmake (optional if want to test latest commit)

Build python SDK (Optional)

openmldb exporter depends on openmldb python SDK. For those introducing changes in python SDK or native code as well, this steps is required in order to take the latest Python SDK locally instead of the published one.

1. Build native code

cd to root directory of OpenMLDB, and run:

make SQL_PYSDK_ENABLE=ON

This will generate compiled shared library in python source directory.

2. Fix dependency list

Back to openmldb exporter directory, modify pyproject.toml and make content like below:

[tool.poetry.dependencies]
# ...
# openmldb = "^0.6.0"
# uncomment below to use openmldb sdk built from source
# set develop = true so changes in python will take effect immediately
openmldb = { path = "../python/", develop = true }

Run

  1. Setup python dependencies:

    poetry install
    
  2. Start openmldb exporter

    poetry run openmldb-exporter
    

    You need pass necessary flags after openmldb-exporter. Run poetry run openmldb-exporter --help to get the help info

    usage: openmldb-exporter [-h] [--log.level LOG.LEVEL] [--web.listen-address WEB.LISTEN_ADDRESS]
                             [--web.telemetry-path WEB.TELEMETRY_PATH] [--config.zk_root CONFIG.ZK_ROOT]
                             [--config.zk_path CONFIG.ZK_PATH] [--config.interval CONFIG.INTERVAL]
    
    OpenMLDB exporter
    
    optional arguments:
      -h, --help            show this help message and exit
      --log.level LOG.LEVEL
                            config log level, default WARN
      --web.listen-address WEB.LISTEN_ADDRESS
                            process listen port, default 8000
      --web.telemetry-path WEB.TELEMETRY_PATH
                            Path under which to expose metrics, default metrics
      --config.zk_root CONFIG.ZK_ROOT
                            endpoint to zookeeper, default 127.0.0.1:6181
      --config.zk_path CONFIG.ZK_PATH
                            root path in zookeeper for OpenMLDB, default /
      --config.interval CONFIG.INTERVAL
                            interval in seconds to pull metrics periodically, default 30.0
    
  3. View the available metrics, you can pull through curl

    curl http://127.0.0.1:8000/metrics
    

    A example output:

    # HELP openmldb_connected_seconds_total duration for a component conncted time in seconds                              
    # TYPE openmldb_connected_seconds_total counter                                                                        
    openmldb_connected_seconds_total{endpoint="172.17.0.15:9520",role="tablet"} 208834.70900011063                         
    openmldb_connected_seconds_total{endpoint="172.17.0.15:9521",role="tablet"} 208834.70700001717                         
    openmldb_connected_seconds_total{endpoint="172.17.0.15:9522",role="tablet"} 208834.71399998665                         
    openmldb_connected_seconds_total{endpoint="172.17.0.15:9622",role="nameserver"} 208833.70000004768                     
    openmldb_connected_seconds_total{endpoint="172.17.0.15:9623",role="nameserver"} 208831.70900011063                     
    openmldb_connected_seconds_total{endpoint="172.17.0.15:9624",role="nameserver"} 208829.7230000496                      
    # HELP openmldb_connected_seconds_created duration for a component conncted time in seconds                            
    # TYPE openmldb_connected_seconds_created gauge                                                                        
    openmldb_connected_seconds_created{endpoint="172.17.0.15:9520",role="tablet"} 1.6501813860467942e+09                   
    openmldb_connected_seconds_created{endpoint="172.17.0.15:9521",role="tablet"} 1.6501813860495396e+09                   
    openmldb_connected_seconds_created{endpoint="172.17.0.15:9522",role="tablet"} 1.650181386050323e+09                    
    openmldb_connected_seconds_created{endpoint="172.17.0.15:9622",role="nameserver"} 1.6501813860512116e+09               
    openmldb_connected_seconds_created{endpoint="172.17.0.15:9623",role="nameserver"} 1.650181386051238e+09                
    openmldb_connected_seconds_created{endpoint="172.17.0.15:9624",role="nameserver"} 1.6501813860512598e+09               
    

Release History

  • 0.7.1
    • Features
      • Upgrade OpenMLDB SDK to v0.7
      • Upgrade prometheus client to 0.16
  • 0.6.0
    • Features
      • Depends on OpenMLDB SDK v0.6

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openmldb_exporter-0.8.0.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

openmldb_exporter-0.8.0-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file openmldb_exporter-0.8.0.tar.gz.

File metadata

  • Download URL: openmldb_exporter-0.8.0.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.4 Linux/6.1.31-gentoo

File hashes

Hashes for openmldb_exporter-0.8.0.tar.gz
Algorithm Hash digest
SHA256 60bb917f38a6faa8264dacd56fff0999f517b92ada706fb6250f209782820d33
MD5 1e9c3fd3460c6ce64749176239240b7b
BLAKE2b-256 9730ecc1c2d1f31183c8b06a20015aa13d41de429583da85a771dfc4055f8707

See more details on using hashes here.

File details

Details for the file openmldb_exporter-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: openmldb_exporter-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.4 Linux/6.1.31-gentoo

File hashes

Hashes for openmldb_exporter-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 83672ff21a8736e520c028785de703d09643385abfc75c9222466d532f14a426
MD5 9dc2b705296206f9a841671519660fb7
BLAKE2b-256 6815ca2addbd15f1a7d9443cf018ad649b00b1541179b2bba9c697b5b82094cc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page