Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: RED metrics #7994

Merged
merged 3 commits into from
Dec 21, 2023
Merged

feat: RED metrics #7994

merged 3 commits into from
Dec 21, 2023

Conversation

micbar
Copy link
Contributor

@micbar micbar commented Dec 15, 2023

Description

1703171078210

Metrics

The proxy service in ocis has the ability to expose metrics in the prometheus format. The metrics are exposed on the /metrics endpoint. There are two ways to run the ocis proxy service which has an impact on the number of metrics exposed.

1) Single Process Mode

In the single process mode, all ocis services are running inside a single process. This is the default mode when using the ocis server command to start the services. In this mode, the proxy service exposes metrics about the proxy service itself and about the ocis services it is proxying. This is due to the nature of the prometheus registry which is a singleton. The metrics exposed by the proxy service itself are prefixed with ocis_proxy_ and the metrics exposed by other ocis services are prefixed with ocis_<service-name>_.

2) Standalone Mode

In this mode, the proxy service only exposes its own metrics. The metrics of the other ocis services are exposed on their own metrics endpoints.

Available Metrics

The following metrics are exposed by the proxy service:

Metric Name Description Labels
ocis_proxy_requests_total Counter metric which reports the total number of HTTP requests. method: HTTP method of the request
ocis_proxy_errors_total Counter metric which reports the total number of HTTP requests which have failed. That counts all response codes >= 500 method: HTTP method of the request
ocis_proxy_duration_seconds Histogram of the time (in seconds) each request took. A histogram metric uses buckets to count the number of events that fall into each bucket. method: HTTP method of the request
ocis_proxy_build_info{version} A metric with a constant 1 value labeled by version, exposing the version of the ocis proxy service. version: Build version of the proxy

Prometheus Configuration

The following is an example prometheus configuration for the single process mode. It assumes that the proxy service is configured to bind on all interfaces PROXY_HTTP_ADDR=0.0.0.0:9205 and that the proxy is available via the ocis service name (typically in docker-compose). The prometheus service detects the /metrics endpoint automatically and scrapes it every 15 seconds.

global:
  scrape_interval: 15s
scrape_configs:
  - job_name: ocis_proxy
    static_configs:
    - targets: ["ocis:9205"]

Related Issue

  • Fixes <issue_link>

Motivation and Context

How Has This Been Tested?

  • test environment:
  • test case 1:
  • test case 2:
  • ...

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:

Copy link

update-docs bot commented Dec 15, 2023

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@micbar micbar marked this pull request as ready for review December 21, 2023 14:33
@micbar micbar requested a review from butonic December 21, 2023 14:34
Copy link

sonarcloud bot commented Dec 21, 2023

@micbar micbar merged commit a17b65c into master Dec 21, 2023
4 checks passed
@delete-merged-branch delete-merged-branch bot deleted the proxy-metrics branch December 21, 2023 15:27
ownclouders pushed a commit that referenced this pull request Dec 21, 2023
This was referenced Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants