TracingJedisSentinelPool extends JedisSentinelPool { @Override public Jedis getResource() { Jedis resource = super.getResource(); return new TracingJedisWrapper(resource, tracingConfiguration); } TracingJedisSentinelPool(TracingConfiguration tracingConfiguration, String masterName,
      Set<String> sentinels,
      final GenericObjectPoolConfig poolConfig);  TracingJedisSentinelPool(TracingConfiguration tracingConfiguration, String masterName,
      Set<String> sentinels);  TracingJedisSentinelPool(TracingConfiguration tracingConfiguration, String masterName,
      Set<String> sentinels, String password);  TracingJedisSentinelPool(TracingConfiguration tracingConfiguration, String masterName,
      Set<String> sentinels,
      final GenericObjectPoolConfig poolConfig, int timeout, final String password);  TracingJedisSentinelPool(TracingConfiguration tracingConfiguration, String masterName,
      Set<String> sentinels,
      final GenericObjectPoolConfig poolConfig, final int timeout);  TracingJedisSentinelPool(TracingConfiguration tracingConfiguration, String masterName,
      Set<String> sentinels,
      final GenericObjectPoolConfig poolConfig, final String password);  TracingJedisSentinelPool(TracingConfiguration tracingConfiguration, String masterName,
      Set<String> sentinels,
      final GenericObjectPoolConfig poolConfig, int timeout, final String password,
      final int database);  TracingJedisSentinelPool(TracingConfiguration tracingConfiguration, String masterName,
      Set<String> sentinels,
      final GenericObjectPoolConfig poolConfig, int timeout, final String password,
      final int database, Function<String, String> customSpanName);  TracingJedisSentinelPool(TracingConfiguration tracingConfiguration, String masterName,
      Set<String> sentinels,
      final GenericObjectPoolConfig poolConfig, int timeout, final String password,
      final int database, final String clientName);  TracingJedisSentinelPool(TracingConfiguration tracingConfiguration, String masterName,
      Set<String> sentinels,
      final GenericObjectPoolConfig poolConfig, final int timeout, final int soTimeout,
      final String password, final int database);  TracingJedisSentinelPool(TracingConfiguration tracingConfiguration, String masterName,
      Set<String> sentinels,
      final GenericObjectPoolConfig poolConfig, final int connectionTimeout, final int soTimeout,
      final String password, final int database, final String clientName); @Override Jedis getResource(); @Override @Deprecated void returnBrokenResource(final Jedis resource); @Override @Deprecated void returnResource(final Jedis resource);  }
@Test public void testSentinelPoolReturnsTracedJedis() { JedisSentinelPool pool = new TracingJedisSentinelPool( new TracingConfiguration.Builder(mockTracer).build(), MASTER_NAME, sentinels, new GenericObjectPoolConfig()); Jedis jedis = pool.getResource(); assertEquals("OK", jedis.set("key", "value")); assertEquals("value", jedis.get("key")); jedis.close(); pool.destroy(); List<MockSpan> spans = mockTracer.finishedSpans(); assertEquals(2, spans.size()); }
@Test public void testClosingTracedJedisClosesUnderlyingJedis() { JedisSentinelPool pool = new TracingJedisSentinelPool( new TracingConfiguration.Builder(mockTracer).build(), MASTER_NAME, sentinels, new GenericObjectPoolConfig()); Jedis resource = pool.getResource(); assertEquals(1, pool.getNumActive()); resource.close(); assertEquals(0, pool.getNumActive()); assertEquals(1, pool.getNumIdle()); Jedis nextResource = pool.getResource(); assertEquals(1, pool.getNumActive()); assertEquals(0, pool.getNumIdle()); nextResource.close(); pool.destroy(); }