An open API service indexing awesome lists of open source software.

https://github.com/redis-field-engineering/redis-micrometer

Micrometer registry for Redis
https://github.com/redis-field-engineering/redis-micrometer

Last synced: 9 days ago
JSON representation

Micrometer registry for Redis

Awesome Lists containing this project

README

        

= Redis Micrometer Registry
:linkattrs:
:project-owner: redis-field-engineering
:project-name: redis-micrometer
:project-group: com.redis
:project-version: 0.5.1
:project-url: https://github.com/{project-owner}/{project-name}
:product-name: Redis Micrometer Registry
:artifact-id: micrometer-registry-redis

image:{project-url}/actions/workflows/early-access.yml/badge.svg["Build Status", link="{project-url}/actions/workflows/early-access.yml"]
image:https://img.shields.io/maven-central/v/{project-group}/{artifact-id}[Download, link="https://search.maven.org/#search|ga|1|{artifact-id}"]
image:https://codecov.io/gh/{project-owner}/{project-name}/branch/master/graph/badge.svg["Coverage", link="https://codecov.io/gh/{project-owner}/{project-name}"]

{product-name} is a https://micrometer.io[Micrometer] registry for sending metrics to https://redis.io[Redis].

This registry can be used in any application that uses Micrometer for recording metrics.

== Getting Started

Add {artifact-id} to your application dependencies:

.Maven
[source,xml,subs="verbatim,attributes"]
----

{project-group}
{artifact-id}
{project-version}

----

.Gradle
[source,groovy,subs="verbatim,attributes"]
----
dependencies {
implementation '{project-group}:{artifact-id}:{project-version}'
}
----

== Usage

[source,java]
----
RedisConfig config = new RedisConfig() { // <1>
@Override
public String get(String key) {
return null;
}

@Override
public String uri() {
return "redis://example.redis.cloud:12000";
}
};
MeterRegistry registry = new RedisMeterRegistry(config, Clock.SYSTEM); // <2>
Timer timer = registry.timer("mytimer"); // <3>
timer.record(() -> doSomeWork()); // <4>
----

<1> Create a config object
<2> Instantiate a `MeterRegistry` with the previously created config
<3> Register a meter
<4> Instrument a part of your application using the meter

== Configuration

The following properties can be used to specify how the registry connects to Redis.

=== `uri`

* Type: `string`
* *Required*

Connect to a Redis Cluster.

Redis URI for your Redis instance, for example:
----
redis://example.redis.cloud:6379
----

See https://github.com/lettuce-io/lettuce-core/wiki/Redis-URI-and-connection-details#uri-syntax[Lettuce's URI syntax] for all of the possible URI parameters you can use here.

=== `cluster`

* Type: `boolean`
* Default value: `false`

Connect to a Redis Cluster.

=== `keyspace`

* Type: `string`
* Default value: `null` (no keyspace prefix)

Prefix for all Redis keys used by {product-name}.