{"id":21152962,"url":"https://github.com/opentracing-contrib/java-redis-client","last_synced_at":"2025-07-29T11:06:28.727Z","repository":{"id":47730210,"uuid":"111915134","full_name":"opentracing-contrib/java-redis-client","owner":"opentracing-contrib","description":"OpenTracing Instrumentation for Redis Client","archived":false,"fork":false,"pushed_at":"2022-11-17T12:18:51.000Z","size":749,"stargazers_count":40,"open_issues_count":7,"forks_count":28,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-04T22:11:17.541Z","etag":null,"topics":["java","jedis","lettuce","opentracing","redis-client","redisson","spring-data-redis"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/opentracing-contrib.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-24T12:17:54.000Z","updated_at":"2024-11-24T16:24:20.000Z","dependencies_parsed_at":"2022-08-24T03:01:07.449Z","dependency_job_id":null,"html_url":"https://github.com/opentracing-contrib/java-redis-client","commit_stats":null,"previous_names":[],"tags_count":66,"template":false,"template_full_name":null,"purl":"pkg:github/opentracing-contrib/java-redis-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentracing-contrib%2Fjava-redis-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentracing-contrib%2Fjava-redis-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentracing-contrib%2Fjava-redis-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentracing-contrib%2Fjava-redis-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/opentracing-contrib","download_url":"https://codeload.github.com/opentracing-contrib/java-redis-client/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentracing-contrib%2Fjava-redis-client/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263604308,"owners_count":23487239,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","jedis","lettuce","opentracing","redis-client","redisson","spring-data-redis"],"created_at":"2024-11-20T10:47:48.776Z","updated_at":"2025-07-09T10:33:16.514Z","avatar_url":"https://github.com/opentracing-contrib.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov] [![Released Version][maven-img]][maven] [![Apache-2.0 license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n\n# OpenTracing Redis Client Instrumentation\nOpenTracing instrumentation for Redis Client\n\n## Requirements\n\n- Java 8\n\n## Installation\n\n### Jedis\n\n#### Jedis 2\n\npom.xml\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.opentracing.contrib\u003c/groupId\u003e\n    \u003cartifactId\u003eopentracing-redis-jedis\u003c/artifactId\u003e\n    \u003cversion\u003eVERSION\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n#### Jedis 3\n\npom.xml\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.opentracing.contrib\u003c/groupId\u003e\n    \u003cartifactId\u003eopentracing-redis-jedis3\u003c/artifactId\u003e\n    \u003cversion\u003eVERSION\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### Lettuce\n\npom.xml\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.opentracing.contrib\u003c/groupId\u003e\n    \u003cartifactId\u003eopentracing-redis-lettuce-5.2\u003c/artifactId\u003e\n    \u003cversion\u003eVERSION\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### Redisson\npom.xml\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.opentracing.contrib\u003c/groupId\u003e\n    \u003cartifactId\u003eopentracing-redis-redisson\u003c/artifactId\u003e\n    \u003cversion\u003eVERSION\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### Spring Data Redis 1.x\n\npom.xml\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.opentracing.contrib\u003c/groupId\u003e\n    \u003cartifactId\u003eopentracing-redis-spring-data\u003c/artifactId\u003e\n    \u003cversion\u003eVERSION\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### Spring Data Redis 2.x\n\npom.xml\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.opentracing.contrib\u003c/groupId\u003e\n    \u003cartifactId\u003eopentracing-redis-spring-data2\u003c/artifactId\u003e\n    \u003cversion\u003eVERSION\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## Usage\n\n```java\n\n// Instantiate tracer\nTracer tracer = ...\n\n// Create TracingConfiguration\nTracingConfiguration tracingConfiguration = new TracingConfiguration.Builder(tracer).build(); \n\n```\n\n### Jedis\n```java\n\n// Create Tracing Jedis\nJedis jedis = new TracingJedis(tracingConfiguration);\n\njedis.set(\"foo\", \"bar\");\nString value = jedis.get(\"foo\");\n\n```\n\n### Jedis Cluster\n```java\nSet\u003cHostAndPort\u003e jedisClusterNodes = new HashSet\u003cHostAndPort\u003e();\njedisClusterNodes.add(new HostAndPort(\"127.0.0.1\", 7379));\n\n// Create Tracing Jedis Cluster\nJedisCluster jc = new TracingJedisCluster(jedisClusterNodes, tracingConfiguration);\njc.set(\"foo\", \"bar\");\nString value = jc.get(\"foo\");\n\n```\n\n### Jedis Pool\n```java\n// Configure the pool\nJedisPoolConfig poolConfig = new JedisPoolConfig();\npoolConfig.setMaxIdle(10);\npoolConfig.setTestOnBorrow(false);\n\n// Create Tracing Jedis Pool\nJedisPool pool = new TracingJedisPool(poolConfig, \"127.0.0.1\", 6379, tracingConfiguration);\n\ntry (Jedis jedis = pool.getResource()) {\n    // jedis will be automatically closed and returned to the pool at the end of \"try\" block\n    jedis.set(\"foo\", \"bar\");\n    String value = jedis.get(\"foo\");\n}\n```\n\n### Jedis Sentinel Pool\n```java\n// Create Tracing Jedis Sentinel Pool\nJedisSentinelPool pool = new TracingJedisSentinelPool(tracingConfiguration, MASTER_NAME, sentinels, poolConfig);\n\ntry (Jedis jedis = pool.getResource()) {\n// jedis will be automatically closed and returned to the pool at the end of \"try\" block\n   jedis.set(\"foo\", \"bar\"));\n   String value = jedis.get(\"foo\"));\n}\n```\n\n### Jedis Span Name\nBy default, span names are set to the operation performed by the Jedis object. \nTo customize the span name, provide a Function to the TracingConfiguration object that alters the span name. \nIf a function is not provided, the span name will remain the default. \nRefer to the RedisSpanNameProvider class for a function that prefixes the operation name. \n```java\nTracingConfiguration tracingConfiguration = new TracingConfiguration.Builder(tracer)\n    .withSpanNameProvider(RedisSpanNameProvider.PREFIX_OPERATION_NAME(\"redis.\"))\n    .build(); \n//Create Tracing Jedis with custom span name\nJedis jedis = new TracingJedis(tracingConfiguration);\njedis.set(\"foo\", \"bar\");\n//Span name is now set to \"redis.set\"\n\n```\n\n### Lettuce\n\n```java\n\n// Create client\nRedisClient client = RedisClient.create(\"redis://localhost\");\n\n// Decorate StatefulRedisConnection with TracingStatefulRedisConnection\nStatefulRedisConnection\u003cString, String\u003e connection = \n    new TracingStatefulRedisConnection(client.connect(), tracingConfiguration);\n\n// Get sync redis commands\nRedisCommands\u003cString, String\u003e commands = connection.sync();\n\n// Get async redis commands\nRedisAsyncCommands\u003cString, String\u003e commandsAsync = connection.async();\n\n```\n\n### Redisson\n\n```java\n// Create Redisson config object\nConfig = ...\n\n// Create Redisson instance\nRedissonClient redissonClient = Redisson.create(config);\n\n// Decorate RedissonClient with TracingRedissonClient\nRedissonClient tracingRedissonClient =  new TracingRedissonClient(redissonClient, tracingConfiguration);\n\n// Get object you need using TracingRedissonClient\nRMap\u003cMyKey, MyValue\u003e map = tracingRedissonClient.getMap(\"myMap\");\n```\n\n### Spring\n\n```java\n\n// Create tracing connection factory bean\n@Bean\npublic RedisConnectionFactory redisConnectionFactory() {\n    LettuceConnectionFactory lettuceConnectionFactory = new LettuceConnectionFactory();\n    lettuceConnectionFactory.afterPropertiesSet();\n    return new TracingRedisConnectionFactory(lettuceConnectionFactory,\n        new TracingConfiguration.Builder(tracer()).build());\n}\n```\n\nNote: if you use Lettuce/Jedis you could achieve the same result using the Lettuce/Jedis support when \nconfiguring LettuceConnectionFactory/JedisConnectionFactory instead of using a wrapping TracingRedisConnectionFactory.\n\n## License\n\n[Apache 2.0 License](./LICENSE).\n\n[ci-img]: https://travis-ci.org/opentracing-contrib/java-redis-client.svg?branch=master\n[ci]: https://travis-ci.org/opentracing-contrib/java-redis-client\n[cov-img]: https://coveralls.io/repos/github/opentracing-contrib/java-redis-client/badge.svg?branch=master\n[cov]: https://coveralls.io/github/opentracing-contrib/java-redis-client?branch=master\n[maven-img]: https://img.shields.io/maven-central/v/io.opentracing.contrib/opentracing-redis-parent.svg\n[maven]: http://search.maven.org/#search%7Cga%7C1%7Copentracing-redis-parent\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopentracing-contrib%2Fjava-redis-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopentracing-contrib%2Fjava-redis-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopentracing-contrib%2Fjava-redis-client/lists"}