The Prometheus monitoring system and time series database.

Overview

Prometheus

CircleCI Docker Repository on Quay Docker Pulls Go Report Card CII Best Practices Gitpod ready-to-code

Visit prometheus.io for the full documentation, examples and guides.

Prometheus, a Cloud Native Computing Foundation project, is a systems and service monitoring system. It collects metrics from configured targets at given intervals, evaluates rule expressions, displays the results, and can trigger alerts when specified conditions are observed.

The features that distinguish Prometheus from other metrics and monitoring systems are:

  • A multi-dimensional data model (time series defined by metric name and set of key/value dimensions)
  • PromQL, a powerful and flexible query language to leverage this dimensionality
  • No dependency on distributed storage; single server nodes are autonomous
  • An HTTP pull model for time series collection
  • Pushing time series is supported via an intermediary gateway for batch jobs
  • Targets are discovered via service discovery or static configuration
  • Multiple modes of graphing and dashboarding support
  • Support for hierarchical and horizontal federation

Architecture overview

Install

There are various ways of installing Prometheus.

Precompiled binaries

Precompiled binaries for released versions are available in the download section on prometheus.io. Using the latest production release binary is the recommended way of installing Prometheus. See the Installing chapter in the documentation for all the details.

Docker images

Docker images are available on Quay.io or Docker Hub.

You can launch a Prometheus container for trying it out with

$ docker run --name prometheus -d -p 127.0.0.1:9090:9090 prom/prometheus

Prometheus will now be reachable at http://localhost:9090/.

Building from source

To build Prometheus from source code, first ensure that have a working Go environment with version 1.14 or greater installed. You also need Node.js and Yarn installed in order to build the frontend assets.

You can directly use the go tool to download and install the prometheus and promtool binaries into your GOPATH:

$ go get github.com/prometheus/prometheus/cmd/...
$ prometheus --config.file=your_config.yml

However, when using go get to build Prometheus, Prometheus will expect to be able to read its web assets from local filesystem directories under web/ui/static and web/ui/templates. In order for these assets to be found, you will have to run Prometheus from the root of the cloned repository. Note also that these directories do not include the new experimental React UI unless it has been built explicitly using make assets or make build.

An example of the above configuration file can be found here.

You can also clone the repository yourself and build using make build, which will compile in the web assets so that Prometheus can be run from anywhere:

$ mkdir -p $GOPATH/src/github.com/prometheus
$ cd $GOPATH/src/github.com/prometheus
$ git clone https://github.com/prometheus/prometheus.git
$ cd prometheus
$ make build
$ ./prometheus --config.file=your_config.yml

The Makefile provides several targets:

  • build: build the prometheus and promtool binaries (includes building and compiling in web assets)
  • test: run the tests
  • test-short: run the short tests
  • format: format the source code
  • vet: check the source code for common errors
  • docker: build a docker container for the current HEAD
  • assets: build the new experimental React UI

React UI Development

For more information on building, running, and developing on the new React-based UI, see the React app's README.md.

More information

Contributing

Refer to CONTRIBUTING.md

License

Apache License 2.0, see LICENSE.

Issues
  • TSDB data import tool for OpenMetrics format.

    TSDB data import tool for OpenMetrics format.

    Created a tool to import data formatted according to the Prometheus exposition format. The tool can be accessed via the TSDB CLI.

    closes prometheus/prometheus#535

    Signed-off-by: Dipack P Panjabi [email protected]

    (Port of https://github.com/prometheus/tsdb/pull/671)

    opened by dipack95 126
  • Add mechanism to perform bulk imports

    Add mechanism to perform bulk imports

    Currently the only way to bulk-import data is a hacky one involving client-side timestamps and scrapes with multiple samples per time series. We should offer an API for bulk import. This relies on https://github.com/prometheus/prometheus/issues/481.

    EDIT: It probably won't be an web-based API in Prometheus, but a command-line tool.

    kind/enhancement priority/P2 component/tsdb 
    opened by juliusv 112
  • Create a section ANNOTATIONS with user-defined payload and generalize RUNBOOK, DESCRIPTION, SUMMARY into fields therein.

    Create a section ANNOTATIONS with user-defined payload and generalize RUNBOOK, DESCRIPTION, SUMMARY into fields therein.

    RUNBOOK was added in a hurry in #843 for an internal demo of one of our users, which didn't give it enough time to be fully discussed. The demo has been done, so we can reconsider this.

    I think we should revert this change, and remove RUNBOOK:

    • Our general policy is that if it can be done with labels, do it with labels
    • All notification methods in the alertmanager will need extra code to deal with this
    • In future, all alertmanager notification templates will need extra code to deal with this
    • In general, all user code touching the alertmanager will need extra code to deal with this
    • This presumes a certain workflow in that you have something called a "runbook" (and not any other name - playbook is also common) and that you have exactly one of them

    Runbooks are not a fundamental aspect of an alert, are not in use by all of our users and thus I don't believe they meet the bar for first-class support within prometheus. This is especially true considering that they don't add anything that isn't already possible with labels.

    opened by brian-brazil 102
  • Implement strategies to limit memory usage.

    Implement strategies to limit memory usage.

    Currently, Prometheus simply limits the chunks in memory to a fixed number.

    However, this number doesn't directly imply the total memory usage as many other things take memory as well.

    Prometheus could measure its own memory consumption and (optionally) evict chunks early if it needs too much memory.

    It's non-trivial to measure "actual" memory consumption in a platform independent way.

    kind/enhancement 
    opened by beorn7 90
  • '@ <timestamp>' modifier

    '@ ' modifier

    This PR implements @ <timestamp> modifier as per this design doc.

    An example query:

    rate(process_cpu_seconds_total[1m]) 
      and
    topk(7, rate(process_cpu_seconds_total[1h] @ 1234))
    

    which ranks based on last 1h rate and w.r.t. unix timestamp 1234 but actually plots the 1m rate.

    Closes #7903

    This PR is to be followed up with an easier way to represent the start, end, range of a query in PromQL so that we could do @ <end>, metric[<range>] easily.

    opened by codesome 88
  • Port isolation from old TSDB PR

    Port isolation from old TSDB PR

    The original PR was https://github.com/prometheus/tsdb/pull/306 .

    I tried to carefully adjust to the new world order, but please give this a very careful review, especially around iterator reuse (marked with a TODO).

    On the bright side, I definitely found and fixed a bug in txRing.

    prombench 
    opened by beorn7 78
  • 2.3.0 significatnt memory usage increase.

    2.3.0 significatnt memory usage increase.

    Bug Report

    What did you do? Upgraded to 2.3.0

    What did you expect to see? General improvements.

    What did you see instead? Under which circumstances? Memory usage, possibly driven by queries, has considerably increased. Upgrade at 09:27, the memory usage drops on the graph after then are from container restarts due to OOM.

    container_memory_usage_bytes

    image

    Environment

    Prometheus in kubernetes 1.9

    • System information: Standard docker containers, on docker kubelet on linux.

    • Prometheus version: 2.3.0 insert output of prometheus --version here

    kind/bug 
    opened by tcolgate 77
  • Support for environment variable substitution in configuration file

    Support for environment variable substitution in configuration file

    I think that would be a good idea to substitute environment variables in the configuration file.

    That could be done really easily using os.ExpandEnv on configuration string when loading configuration string.

    That would be much easier to substitute environment variables only on configuration values. go -ini provides a valueMapper but yaml.v2 doesn't have such mechanism.

    opened by dopuskh3 72
  • React UI: Implement more sophisticated autocomplete

    React UI: Implement more sophisticated autocomplete

    It would be great to have more sophisticated expression field autocompletion in the new React UI.

    Currently it only autocompletes metric names, and only when the expression field doesn't contain any other sub-expressions yet.

    Things that would be nice to autocomplete:

    • metric names anywhere within an expression
    • label names
    • label values
    • function names
    • etc.

    For autocomplete functionality not to annoy users, it needs to be as highly performant, correct, and unobtrusive as possible. Grafana does many things right here already, but they also have a few really annoying bugs, like inserting closing parentheses in incorrect locations of an expression.

    Currently @slrtbtfs has indicated interest in building a language-server-based autocomplete implementation.

    component/ui priority/P3 kind/feature 
    opened by juliusv 69
  • Benchmark tsdb master

    Benchmark tsdb master

    DO NOT MERGE

    Benchmark 1

    Benchmark the following PRs against 2.11.1

    1. For queries: https://github.com/prometheus/tsdb/pull/642
    2. For compaction: https://github.com/prometheus/tsdb/pull/643 https://github.com/prometheus/tsdb/pull/654 https://github.com/prometheus/tsdb/pull/653
    3. Opening block: https://github.com/prometheus/tsdb/pull/645

    Results

    Did not test for compaction from on-disk blocks. Could not really see the allocation optimizations in compaction, that might be because the savings are mostly in the number of allocations and not the size of allocation (size is what is showed in the dashboards). That would mean CPU to be saved, but couldn't make a huge difference, but a slight increase in gap during compaction.

    The gains looked good in

    1. Allocations
    2. CPU (because of allocations?)
    3. RSS was also lower (upto 10 GiB lower! ~60 vs ~70).
    4. Also a tiny-good improvement in query inner_eval times.
    5. Compaction time (this should help the increase in compaction time that https://github.com/prometheus/tsdb/pull/627 is going to bring).
    6. System load.

    And bad in

    1. result_sort for the queries. Not sure why.

    Benchmark 2

    Benchmark https://github.com/prometheus/tsdb/pull/627 (which includes all the PRs from above Benchmark 1) against 2.11.1

    opened by codesome 65
  • M-map full chunks of Head from disk

    M-map full chunks of Head from disk

    tl-dr desc for the PR from @krasi-georgiev


    When appending to the head and a chunk is full it is flushed to the disk and m-mapped (memory mapped) to free up memory

    Prom startup now happens in these stages

    • Iterate the m-maped chunks from disk and keep a map of series reference to its slice of mmapped chunks.
    • Iterate the WAL as usual. Whenever we create a new series, look for it's mmapped chunks in the map created before and add it to that series.

    If a head chunk is corrupted the currpted one and all chunks after that are deleted and the data after the corruption is recovered from the existing WAL which means that a corruption in m-mapped files results in NO data loss.

    Mmaped chunks format - main difference is that the chunk for mmaping now also includes series reference because there is no index for mapping series to chunks. The block chunks are accessed from the index which includes the offsets for the chunks in the chunks file - example - chunks of series ID have offsets 200, 500 etc in the chunk files. In case of mmaped chunks, the offsets are stored in memory and accessed from that. During WAL replay, these offsets are restored by iterating all m-mapped chunks as stated above by matching the series id present in the chunk header and offset of that chunk in that file.

    Prombench results

    WAL Replay

    1h Wal reply time 30% less wal reply time - 4m31 vs 3m36 2h Wal reply time 20% less wal reply time - 8m16 vs 7m

    Memory During WAL Replay

    High Churn 10-15% less RAM - 32gb vs 28gb 20% less RAM after compaction 34gb vs 27gb No Churn 20-30% less RAM - 23gb vs 18gb 40% less RAM after compaction 32.5gb vs 20gb

    Screenshots are in this comment


    Prerequisite: https://github.com/prometheus/prometheus/pull/6830 (Merged)

    Closes https://github.com/prometheus/prometheus/issues/6377. More info in the linked issue and the doc in that issue and the doc inside that doc inside that issue :)

    • [x] Add tests
    • [x] Explore possible ways to get rid of new globals added in head.go
    • [x] Wait for https://github.com/prometheus/prometheus/pull/6830 to be merged
    • [x] Fix windows tests
    prombench 
    opened by codesome 64
  • promtool return zero code on validation error (unmarshall errors)

    promtool return zero code on validation error (unmarshall errors)

    What did you do?

    $ promtool check config inputs/prometheus/prometheus.yml; echo $?
      FAILED: parsing YAML file /tmp/prometheus.yml: yaml: unmarshal errors:
      line 22: field relabel_configs not found in type struct { Targets []string "yaml:\"targets\""; Labels model.LabelSet "yaml:\"labels\"" }
      line 23: field source_labels not found in type struct { Targets []string "yaml:\"targets\""; Labels model.LabelSet "yaml:\"labels\"" }
      line 24: field target_label not found in type struct { Targets []string "yaml:\"targets\""; Labels model.LabelSet "yaml:\"labels\"" }
      line 25: field source_labels not found in type struct { Targets []string "yaml:\"targets\""; Labels model.LabelSet "yaml:\"labels\"" }
      line 26: field target_label not found in type struct { Targets []string "yaml:\"targets\""; Labels model.LabelSet "yaml:\"labels\"" }
      line 27: field target_label not found in type struct { Targets []string "yaml:\"targets\""; Labels model.LabelSet "yaml:\"labels\"" }
      line 28: field replacement not found in type struct { Targets []string "yaml:\"targets\""; Labels model.LabelSet "yaml:\"labels\"" }
    
    0
    

    What did you expect to see?

    Promtool fails with non-zero return code

    What did you see instead? Under which circumstances?

    Zero return code

    System information

    Linux 5.17.7-300.fc36.x86_64 x86_64

    Prometheus version

    promtool, version 2.36.2 (branch: HEAD, revision: d7e7b8e04b5ecdc1dd153534ba376a622b72741b)
      build user:       [email protected]
      build date:       20220620-13:21:35
      go version:       go1.18.3
      platform:         linux/amd64
    

    Prometheus configuration file

    global:
      scrape_interval:     20s
      evaluation_interval: 5s
    
    # Alertmanager configuration
    alerting:
      alertmanagers:
        - static_configs:
          - targets:
            - alertmanager:9093
    
    # Scrape configurations
    scrape_configs:
      - job_name: "invalid"
        metrics_path: /probe
        params:
          module:
            - http_fuse
        static_configs:
          - targets:
            - https://someurl
            relabel_configs:
          - source_labels: [__address__]
            target_label: __param_target
          - source_labels: [__param_target]
            target_label: instance
          - target_label: __address__
            replacement: blackbox-exporter:9115
    

    Alertmanager version

    No response

    Alertmanager configuration file

    No response

    Logs

    No response

    opened by thrix 1
  • Consider warning users that label-propagation optimisations that seem 'trivial' are not done

    Consider warning users that label-propagation optimisations that seem 'trivial' are not done

    Proposal

    I think it's fair to say developers tend to expect things to be automatically optimised - see any modern compiler or DBMS, and there's generally an assumption that they will spot obvious inefficiencies and fix them for you at 'build' time (whether that's building code or preparing queries for execution) before consuming computational time.

    I noticed today that Prometheus doesn't optimise queries along the lines of: a{b="c"} + d into the form a{b="c"} + d{b="c"}, which can produce very significant (15x for my query, though this presumably differs wildly) performance improvements, and I searched around looking for the rationale for not optimising this, and stumbled upon an old issue (#8053) suggesting this exact optimisation. There's very good reasons enumerated there why this optimisation can't be taken, but I would wager that most users of Prometheus don't realise these use cases exist and would assume the same way I did that there is no need to manually optimise these queries.

    As a consequence, I wonder whether it might be worth adding "hints" to the UI warning users that Prometheus doesn't optimise these things? I imagine, for example, if you input a query in the graph view along the lines of:

    a{b="c"} <bin-op> d

    and assuming the query takes more than some fixed time - say, 1s - to execute, then there could be a one-time dismissible warning that you may benefit from including your label selectors on both sides of the query string if you are querying "normal" metrics stored in the TSDB, and not a dynamic remote endpoint that might do something particularly clever with d.

    To be clear -- I totally understand the rationale why this isn't optimised, and I'm not criticising or suggesting that changes! Just suggesting there might be a large volume of users who don't realise this and get bitten by this issue unknowingly on the regular. Perhaps a dynamic detection for these things in the UI isn't the correct path, and emphasising it in the documentation might be better? Very open to discussion here of course and I'm happy to help the implementation if others agree with this!

    opened by ashleydavies 0
  • Add Alert PrometheusQueryOverload to mixins

    Add Alert PrometheusQueryOverload to mixins

    This PR adds an alert PrometheusQueryOverload to the mixins in documentation/prometheus-mixin.

    This alert warns the user when Prometheus' query API is saturated by concurrent queries, so that the user can take measurements before functionalities relying on Prometheus stops working, such as autoscalers in a Kubernetes cluster.

    opened by raptorsun 0
  • Consider specifying and standardize on a change log tag for Security Bugfixes

    Consider specifying and standardize on a change log tag for Security Bugfixes

    I've seen tags utilize [Bugfix/Security] or [Security/Bugfix]. But explicitly specifying the tag used would help users more quickly understand the release notes. Maybe this is already being done (based upon the tags I've seen), but without specifying it, its hard to tell if it is always followed and what tags are used or if it just depends on the particular maintainer that is making the release.

    Also, if considered, the release documentation should be updated.

    opened by rilehudd 2
Releases(v2.36.2)
Time Series Database based on Cassandra with Prometheus remote read/write support

SquirrelDB SquirrelDB is a scalable high-available timeseries database (TSDB) compatible with Prometheus remote storage. SquirrelDB store data in Cass

Bleemeo 16 Jun 18, 2022
Fast specialized time-series database for IoT, real-time internet connected devices and AI analytics.

unitdb Unitdb is blazing fast specialized time-series database for microservices, IoT, and realtime internet connected devices. As Unitdb satisfy the

Saffat Technologies 91 Jun 9, 2022
LinDB is an open-source Time Series Database which provides high performance, high availability and horizontal scalability.

LinDB is an open-source Time Series Database which provides high performance, high availability and horizontal scalability. LinDB stores all monitoring data of ELEME Inc, there is 88TB incremental writes per day and 2.7PB total raw data.

LinDB 2.3k Jun 29, 2022
TalariaDB is a distributed, highly available, and low latency time-series database for Presto

TalariaDB is a distributed, highly available, and low latency time-series database that stores real-time data. It's built on top of Badger DB.

Grab 97 Jun 18, 2022
Export output from pg_stat_activity and pg_stat_statements from Postgres into a time-series database that supports the Influx Line Protocol (ILP).

pgstat2ilp pgstat2ilp is a command-line program for exporting output from pg_stat_activity and pg_stat_statements (if the extension is installed/enabl

Zikani Nyirenda Mwase 4 Dec 15, 2021
🤔 A minimize Time Series Database, written from scratch as a learning project.

mandodb ?? A minimize Time Series Database, written from scratch as a learning project. 时序数据库(TSDB: Time Series Database)大多数时候都是为了满足监控场景的需求,这里先介绍两个概念:

dongdong 478 Jun 26, 2022
Owl is a db manager platform,committed to standardizing the data, index in the database and operations to the database, to avoid risks and failures.

Owl is a db manager platform,committed to standardizing the data, index in the database and operations to the database, to avoid risks and failures. capabilities which owl provides include Process approval、sql Audit、sql execute and execute as crontab、data backup and recover .

null 35 Jun 17, 2022
Beerus-DB: a database operation framework, currently only supports Mysql, Use [go-sql-driver/mysql] to do database connection and basic operations

Beerus-DB · Beerus-DB is a database operation framework, currently only supports Mysql, Use [go-sql-driver/mysql] to do database connection and basic

Beerus 6 Mar 5, 2022
This is a simple graph database in SQLite, inspired by "SQLite as a document database".

About This is a simple graph database in SQLite, inspired by "SQLite as a document database". Structure The schema consists of just two structures: No

Denis Papathanasiou 1.1k Jun 28, 2022
Hard Disk Database based on a former database

Hard Disk Database based on a former database

null 0 Nov 1, 2021
Simple key value database that use json files to store the database

KValDB Simple key value database that use json files to store the database, the key and the respective value. This simple database have two gRPC metho

Francisco Santos 0 Nov 13, 2021
Vitess is a database clustering system for horizontal scaling of MySQL through generalized sharding.

Vitess is a database clustering system for horizontal scaling of MySQL through generalized sharding.

Vitess 14.3k Jun 26, 2022
Go reproduction of Bustub--a simple relational database system.

Bustub in Golang Bustub is the course project of CMU15-445 Database System, which is a simple relational database system. This repo is a golang reprod

Zhang Each 1 Dec 18, 2021
Nipo is a powerful, fast, multi-thread, clustered and in-memory key-value database, with ability to configure token and acl on commands and key-regexes written by GO

Welcome to NIPO Nipo is a powerful, fast, multi-thread, clustered and in-memory key-value database, with ability to configure token and acl on command

Morteza Bashsiz 16 Jun 13, 2022
Scalable datastore for metrics, events, and real-time analytics

InfluxDB InfluxDB is an open source time series platform. This includes APIs for storing and querying data, processing it in the background for ETL or

InfluxData 23.7k Jun 26, 2022
Scalable datastore for metrics, events, and real-time analytics

InfluxDB InfluxDB is an open source time series platform. This includes APIs for storing and querying data, processing it in the background for ETL or

InfluxData 23.7k Jun 27, 2022
A GPU-powered real-time analytics storage and query engine.

AresDB AresDB is a GPU-powered real-time analytics storage and query engine. It features low query latency, high data freshness and highly efficient i

Uber Open Source 2.9k Jun 29, 2022
Real-time Geospatial and Geofencing

Tile38 is an open source (MIT licensed), in-memory geolocation data store, spatial index, and realtime geofence. It supports a variety of object types

Josh Baker 8.2k Jun 30, 2022
:handbag: Cache arbitrary data with an expiration time.

cache Cache arbitrary data with an expiration time. Features 0 dependencies About 100 lines of code 100% test coverage Usage // New cache c := cache.N

Eduard Urbach 108 Jun 21, 2022