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
- Host: GitHub
- URL: https://github.com/redis-field-engineering/redis-micrometer
- Owner: redis-field-engineering
- License: apache-2.0
- Created: 2020-11-29T00:37:21.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-07-22T05:20:36.000Z (almost 2 years ago)
- Last Synced: 2025-05-12T14:13:56.356Z (9 days ago)
- Language: Java
- Homepage:
- Size: 313 KB
- Stars: 3
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.adoc
- License: LICENSE
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-redisimage:{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}.