Top Related Projects
The Prometheus monitoring system and time series database.
Evolving the Prometheus exposition format into a standard.
Specifications for OpenTelemetry
Like Prometheus, but for logs.
Agent for collecting, processing, aggregating, and writing metrics, logs, and other arbitrary data.
Main repository for Datadog Agent
Quick Overview
OpenMetrics is a project aimed at evolving the Prometheus exposition format into a standard that can be adopted by other monitoring systems and exporters. It provides a specification for transmitting metrics at scale, with support for both text representation and protocol buffers.
Pros
- Standardizes metric exposition across different monitoring systems
- Supports both human-readable text format and efficient protocol buffers
- Includes rich metadata and exemplars for enhanced observability
- Backed by the Cloud Native Computing Foundation (CNCF)
Cons
- Still in development, not yet widely adopted
- May require changes to existing Prometheus-based systems for full compatibility
- Limited tooling and ecosystem compared to established formats
- Potential overhead for simple use cases that don't require advanced features
Code Examples
As OpenMetrics is a specification rather than a code library, there are no direct code examples. However, here's an example of what an OpenMetrics-compliant metric might look like in the text format:
# TYPE http_requests_total counter
# UNIT http_requests_total requests
# HELP http_requests_total The total number of HTTP requests.
http_requests_total{method="post",code="200"} 1027 1395066363000
http_requests_total{method="post",code="400"} 3 1395066363000
Getting Started
To get started with OpenMetrics:
- Read the OpenMetrics specification at https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md
- Implement the specification in your metrics exporter or monitoring system
- Use OpenMetrics-compatible tools for scraping and processing metrics
- Contribute to the project by providing feedback or submitting pull requests
Note that as OpenMetrics is a specification, there's no specific code library to install or use directly. Implementation depends on the specific programming language and monitoring tools you're working with.
Competitor Comparisons
The Prometheus monitoring system and time series database.
Pros of Prometheus
- Full-featured monitoring system with built-in time series database
- Extensive ecosystem with wide adoption and community support
- Rich query language (PromQL) for data analysis and alerting
Cons of Prometheus
- More complex setup and configuration compared to OpenMetrics
- Larger codebase and resource footprint
- Steeper learning curve for new users
Code Comparison
Prometheus (Go):
func (h *Handler) serveMetrics(w http.ResponseWriter, r *http.Request) {
metrics, err := h.gatherer.Gather()
if err != nil {
http.Error(w, "Error gathering metrics", http.StatusInternalServerError)
return
}
h.writeMetrics(w, metrics)
}
OpenMetrics (Python):
@app.route('/metrics')
def metrics():
return generate_latest(REGISTRY)
Summary
Prometheus is a comprehensive monitoring system with a built-in time series database, while OpenMetrics focuses on defining a standard for exposing metrics. Prometheus offers more features and a rich ecosystem but requires more setup and resources. OpenMetrics provides a simpler approach to metric exposition but lacks the full monitoring capabilities of Prometheus. The choice between them depends on specific project requirements and complexity needs.
Evolving the Prometheus exposition format into a standard.
Pros of OpenMetrics
- Standardized metrics format for better interoperability
- Supports richer metadata and exemplars
- Designed for cloud-native environments and modern observability needs
Cons of OpenMetrics
- May require additional tooling or adapters for existing systems
- Potentially more complex for simple use cases
- Still evolving, which could lead to changes in the specification
Code Comparison
OpenMetrics format:
# TYPE http_requests_total counter
# HELP http_requests_total The total number of HTTP requests.
http_requests_total{method="post",code="200"} 1027 1395066363000
http_requests_total{method="post",code="400"} 3 1395066363000
Prometheus format:
# HELP http_requests_total The total number of HTTP requests.
# TYPE http_requests_total counter
http_requests_total{method="post",code="200"} 1027
http_requests_total{method="post",code="400"} 3
The main differences are the order of TYPE and HELP metadata, and the inclusion of timestamps in OpenMetrics.
Specifications for OpenTelemetry
Pros of OpenTelemetry Specification
- Broader scope, covering metrics, traces, and logs in a unified framework
- Vendor-neutral and supported by major cloud providers and observability companies
- Designed for modern, distributed systems and microservices architectures
Cons of OpenTelemetry Specification
- More complex due to its comprehensive nature, potentially steeper learning curve
- Still evolving, with some components in beta or experimental stages
- May require more setup and configuration compared to OpenMetrics
Code Comparison
OpenMetrics example:
# HELP http_requests_total The total number of HTTP requests.
# TYPE http_requests_total counter
http_requests_total{method="post",code="200"} 1027 1395066363000
http_requests_total{method="post",code="400"} 3 1395066363000
OpenTelemetry example:
from opentelemetry import metrics
from opentelemetry.sdk.metrics import MeterProvider
from opentelemetry.sdk.metrics.export import ConsoleMetricExporter
metrics.set_meter_provider(MeterProvider())
meter = metrics.get_meter(__name__)
http_requests_counter = meter.create_counter("http_requests_total", "The total number of HTTP requests")
http_requests_counter.add(1, {"method": "post", "code": "200"})
While OpenMetrics focuses specifically on metrics with a simple text-based format, OpenTelemetry provides a more comprehensive approach to observability, including metrics, traces, and logs. OpenTelemetry requires more setup but offers greater flexibility and integration possibilities across different observability domains.
Like Prometheus, but for logs.
Pros of Loki
- Designed specifically for log aggregation and storage, making it more efficient for handling large volumes of log data
- Supports multi-tenancy out of the box, allowing for better isolation and management of logs from different sources
- Integrates seamlessly with other Grafana ecosystem tools, providing a unified observability experience
Cons of Loki
- Limited to log data, whereas OpenMetrics can handle various types of metrics and time series data
- Less mature ecosystem compared to Prometheus and OpenMetrics, which have been around longer and have more widespread adoption
- May require additional components (e.g., Promtail) for log collection, adding complexity to the setup
Code Comparison
Loki query example:
{app="myapp"} |= "error" | json | rate[5m]
OpenMetrics example:
# TYPE http_requests_total counter
# HELP http_requests_total The total number of HTTP requests.
http_requests_total{method="post",code="200"} 1027 1395066363000
While OpenMetrics focuses on defining a standard for exposing metrics, Loki's query language (LogQL) is designed for searching and analyzing log data. OpenMetrics provides a more structured approach to metrics, whereas Loki offers flexibility in querying unstructured log data.
Agent for collecting, processing, aggregating, and writing metrics, logs, and other arbitrary data.
Pros of Telegraf
- Extensive plugin ecosystem with support for numerous input and output formats
- Flexible data collection and processing capabilities
- Easy integration with InfluxDB and other time-series databases
Cons of Telegraf
- Steeper learning curve due to its extensive configuration options
- Higher resource consumption compared to simpler metric exporters
- Less focus on standardization of metric formats
Code Comparison
Telegraf configuration example:
[[inputs.cpu]]
percpu = true
totalcpu = true
collect_cpu_time = false
report_active = false
[[outputs.prometheus_client]]
listen = ":9273"
OpenMetrics example:
# HELP http_requests_total The total number of HTTP requests.
# TYPE http_requests_total counter
http_requests_total{method="post",code="200"} 1027 1395066363000
http_requests_total{method="post",code="400"} 3 1395066363000
While Telegraf focuses on configuration-based metric collection and processing, OpenMetrics emphasizes standardizing metric exposition format. Telegraf offers more flexibility in data collection and output, while OpenMetrics aims to provide a consistent format for metric exposition across different systems. Telegraf is better suited for complex monitoring setups with diverse data sources, whereas OpenMetrics is ideal for standardizing metric formats in distributed systems.
Main repository for Datadog Agent
Pros of datadog-agent
- Comprehensive monitoring solution with built-in integrations for various services and platforms
- Provides advanced features like anomaly detection, forecasting, and custom dashboards
- Offers a user-friendly interface for easy setup and configuration
Cons of datadog-agent
- Proprietary software with associated costs, unlike the open-source OpenMetrics
- May have a steeper learning curve due to its extensive feature set
- Less flexibility for customization compared to OpenMetrics' open standard approach
Code Comparison
datadog-agent:
from datadog_checks.base import AgentCheck
class MyCheck(AgentCheck):
def check(self, instance):
self.gauge('my_metric', 1000)
OpenMetrics:
# HELP my_metric Description of my_metric
# TYPE my_metric gauge
my_metric 1000
Summary
datadog-agent is a comprehensive monitoring solution with advanced features and integrations, but comes with associated costs and potential complexity. OpenMetrics, on the other hand, is an open standard that provides flexibility and simplicity for metric exposition, allowing for easier adoption and customization across different monitoring systems.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
OpenMetrics
OpenMetrics a specification built upon and carefully extending Prometheus exposition format in almost 100% backwards-compatible ways.
NOTE: This project recently moved to Prometheus and we are working on OpenMetrics 2.0! See the details in #276 on how to participate!
Spec
See our spec file and our proto.
News and updates
Join the mailing list or follow us on Twitter
Code of Conduct
To make OpenMetrics a welcoming and harassment-free experience for everyone, we follow the CNCF Code of Conduct.
OpenMetrics 2.0 development
OpenMetrics 2.0 is currently under development. You can see our charter to understand our direction and our meeting notes to understand our latest discussions.
Contributing to OpenMetrics 2.0
How can one propose a spec change to OpenMetrics?
The process starts with creating a new issue in the OpenMetricsâ GitHub repository: https://github.com/prometheus/OpenMetrics.
When opening an Issue, the author should try to describe the problem in detail. An issue asking for a change without explaining why such a thing is necessary will be ignored or closed. It's a good practice to focus on a feature that would be enabled by the change instead of going straight to implementation details.
Example of a bad issue:
Title: Relax requirement to add unit as suffixes
Body: It's annoying.
Example of a better issue:
Title: Allow exposing multiple metrics with same name in the same target
Body:
# Problem Statement
Prometheus' federation endpoint cannot follow OpenMetrics specification because it's possible that multiple targets expose the same metric with same name but different metadata like Type/Help/Unit, but they all become a single target once exposed by Prometheus /federate endpoint.
The same problem occurs with OpenTelemetry's Collector, who is able to collect metrics from several places and expose them in a single endpoint.
# Proposed idea
OpenMetrics should relax the requirement of exposing only one metric family by metric name. Instead, it should be allowed as long as metric TYPE or UNIT are different.
Once the issue is created, one of the maintainers should act by adding the necessary labels or closing the Issue if the idea is rejected.
Labeling issues
triage:deciding:*
These labels are applied to issues when it is unclear yet if they are something the project will take on.
triage:deciding:community-feedback
- This issue is open to community discussion. If the community can provide sufficient reasoning, the project may accept it.triage:deciding:needs-info
- This issue does not provide enough information for the project to accept it. It is left open to give the author time to add more details.
triage:accepted:*
These labels are applied to issues that describe a problem that is in scope and that we would like to tackle. Just because an issue is accepted does not mean that a solution suggested by the issue will be the solution applied.
triage:accepted:needs-champion
- This issue was discussed enough and the outcome is clear to the maintainers, however, someone to take this to the finish line is still needed.triage:accepted:needs-formal-proposal
- This issue was discussed enough, the outcome is clear, and someone has already been assigned to implement the solution. The next step is to open a PR to the repository prometheus/proposals explaining the change to the wider Prometheus community. This proposal will cover the necessary changes that SDKs and/or Prometheus server will need to make.triage:accepted:PoC-needed
- This issue was discussed amongst maintainers, but it's still unclear if the implementation is doable efficiently. A Proof of Concept showcasing the results is necessary to advance.triage:accepted:ready
- The formal proposal has been accepted by the wider Prometheus community and is ready to be implemented.
A closed issue means it was rejected.
Formal proposals
Compared to the whole Prometheus community, OpenMetrics maintainers and contributors are a relatively small group. However, whatever is decided in OpenMetrics impacts several SDKs, Prometheus Server itself, and several other projects in the ecosystem, e.g. Thanos, Cortex, and OpenTelemetry.
We follow Prometheus's proposal process to ensure we don't make changes that could harm the ecosystem.
When writing a formal proposal, the author needs to cover all the changes the ecosystem will need to make. If a proposal touches several parts of the ecosystem, such as parsers, storage, and SDKs, being as detailed as possible in all aspects will accelerate the approval needed to start the implementation.
Don't hesitate to create PoCs to better illustrate the final outcome.
Accepted Proposals
To finalize the process, a PR is necessary to update the spec in: https://github.com/prometheus/OpenMetrics/blob/main/specification/OpenMetrics.md
Top Related Projects
The Prometheus monitoring system and time series database.
Evolving the Prometheus exposition format into a standard.
Specifications for OpenTelemetry
Like Prometheus, but for logs.
Agent for collecting, processing, aggregating, and writing metrics, logs, and other arbitrary data.
Main repository for Datadog Agent
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot