Skip to content

Commit

Permalink
api: add the role implementation
Browse files Browse the repository at this point in the history
The role is generally similar in functionality to
`cartridge-metrics-role`. But there is also a difference. The key
difference - the role does not support `health` format.

The role name is `roles.metrics-export` it could be configured in the
Tarantool 3 cluster configuration like this:

```yaml
roles: [roles.metrics-export]
roles_cfg:
  roles.metrics-export:
    http:
    - listen: 8081
      endpoints:
      - path: /metrics/json
        format: json
      - path: /metrics/prometheus/
        format: prometheus
    - listen: '127.0.0.1:8082'
      endpoints:
      - path: /metrics/prometheus
        format: prometheus
      - path: /metrics/json/
        format: json
```

* `http` - is an export type name. The `http` is only supported at
  now. It allows to export metrics via a list of HTTP servers.
  * `listen` - is an address/port to listen via a HTTP server.
  * `endpoints` - is a list of endpoints to share via the HTTP server.
    * `path` - is an endpoint path.
    * `format` - is an export format for the endpoint, at now the role
      supports only `json` and `prometheus`.

Closes #6
  • Loading branch information
oleg-jukovec committed Jul 9, 2024
1 parent c940f9a commit d41cdc7
Show file tree
Hide file tree
Showing 17 changed files with 1,264 additions and 403 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@ jobs:
id: cache-rocks
with:
path: .rocks/
key: "cache-rocks-${{ matrix.tarantool }}${{ env.VERSION_POSTFIX }}-\
${{ matrix.cartridge-version }}-\
${{ matrix.metrics-version }}"
key: "cache-rocks-${{ matrix.tarantool }}${{ env.VERSION_POSTFIX }}"

- name: Setup tt
run: |
Expand Down
2 changes: 1 addition & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ many contributions from the community.

Below follows a list of people, who contributed their code.

Fedor Terekhin
Fedor Terekhin, Oleg Jukovec

NOTE: If you can commit a change to this list, please do not hesitate
to add your name to it.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- The role implementation (#6).

### Fixed

### Changed
Expand Down
19 changes: 19 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@
MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
PROJECT_DIR := $(patsubst %/,%,$(dir $(MAKEFILE_PATH)))

# Look for .rocks/bin directories upward starting from the project
# directory.
#
# It is useful for luacheck and luatest.
#
# Note: The PROJECT_DIR holds a real path.
define ENABLE_ROCKS_BIN
$(if $(wildcard $1/.rocks/bin),
$(eval ROCKS_PATH := $(if $(ROCKS_PATH),$(ROCKS_PATH):,)$1/.rocks/bin)
)
$(if $1,
$(eval $(call ENABLE_ROCKS_BIN,$(patsubst %/,%,$(dir $1))))
)
endef
$(eval $(call ENABLE_ROCKS_BIN,$(PROJECT_DIR)))

# Add found .rocks/bin to PATH.
PATH := $(if $(ROCKS_PATH),$(ROCKS_PATH):$(PATH),$(PATH))

SHELL := $(shell which bash)
SEED ?= $(shell /bin/bash -c "echo $$RANDOM")

Expand Down
6 changes: 6 additions & 0 deletions metrics-export-role-scm-1.rockspec
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
package = "metrics-export-role"
version = "scm-1"

source = {
url = "git+https://github.com/tarantool/metrics-export-role",
branch = "master",
}

description = {
summary = "The Tarantool 3 role for metrics export via HTTP",
homepage = "https://github.com/tarantool/metrics-export-role",
license = "BSD2",
maintainer = "Fedor Terekhin <[email protected]>"
}

dependencies = {
"lua >= 5.1",
"tarantool >= 3.0",
"http >= 1.5.0",
}

build = {
type = "builtin",
modules = {
Expand Down
Loading

0 comments on commit d41cdc7

Please sign in to comment.