Skip to content

Commit

Permalink
upgrade opentracing api to 0.32.0
Browse files Browse the repository at this point in the history
Signed-off-by: Sergei Malafeev <sergeymalafeev@gmail.com>
  • Loading branch information
malafeev committed Apr 2, 2019
1 parent c6321bd commit b8f6b70
Show file tree
Hide file tree
Showing 109 changed files with 52,653 additions and 52,734 deletions.
48 changes: 24 additions & 24 deletions .settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,29 @@
-->
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>sonatype</id>
<username>${env.SONATYPE_USER}</username>
<password>${env.SONATYPE_PASSWORD}</password>
</server>
<server>
<id>bintray</id>
<username>${env.BINTRAY_USER}</username>
<password>${env.BINTRAY_KEY}</password>
</server>
<server>
<id>jfrog-snapshots</id>
<username>${env.BINTRAY_USER}</username>
<password>${env.BINTRAY_KEY}</password>
</server>
<server>
<id>github.com</id>
<username>${env.GH_USER}</username>
<password>${env.GH_TOKEN}</password>
</server>
</servers>
<servers>
<server>
<id>sonatype</id>
<username>${env.SONATYPE_USER}</username>
<password>${env.SONATYPE_PASSWORD}</password>
</server>
<server>
<id>bintray</id>
<username>${env.BINTRAY_USER}</username>
<password>${env.BINTRAY_KEY}</password>
</server>
<server>
<id>jfrog-snapshots</id>
<username>${env.BINTRAY_USER}</username>
<password>${env.BINTRAY_KEY}</password>
</server>
<server>
<id>github.com</id>
<username>${env.GH_USER}</username>
<password>${env.GH_TOKEN}</password>
</server>
</servers>
</settings>
36 changes: 19 additions & 17 deletions opentracing-redis-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,25 @@
the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>opentracing-redis-parent</artifactId>
<groupId>io.opentracing.contrib</groupId>
<version>0.0.17-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>opentracing-redis-common</artifactId>

<dependencies>
<dependency>
<groupId>com.github.kstyrc</groupId>
<artifactId>embedded-redis</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>opentracing-redis-parent</artifactId>
<groupId>io.opentracing.contrib</groupId>
<version>0.1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>opentracing-redis-common</artifactId>

<dependencies>
<dependency>
<groupId>com.github.kstyrc</groupId>
<artifactId>embedded-redis</artifactId>
<scope>test</scope>
</dependency>
</dependencies>


</project>
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
@FunctionalInterface
public interface Action {

void execute();
void execute();
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@

public class RedisSpanNameProvider {

public static Function<String, String> OPERATION_NAME = (operationName) ->
((operationName == null) ? "unknown" : operationName);
public static Function<String, String> OPERATION_NAME = (operationName) ->
((operationName == null) ? "unknown" : operationName);


public static Function<String, String> PREFIX_OPERATION_NAME(final String prefix) {
return (operationName) ->
((prefix == null) ? "" : prefix)
+ ((operationName == null) ? "unknown" : operationName);
}
public static Function<String, String> PREFIX_OPERATION_NAME(final String prefix) {
return (operationName) ->
((prefix == null) ? "" : prefix)
+ ((operationName == null) ? "unknown" : operationName);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
@FunctionalInterface
public interface ThrowingAction<T extends Exception> {

void execute() throws T;
void execute() throws T;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
@FunctionalInterface
public interface ThrowingSupplier<T extends Exception, V> {

V get() throws T;
V get() throws T;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,88 +14,87 @@
package io.opentracing.contrib.redis.common;

import io.opentracing.Tracer;

import java.util.function.Function;

public class TracingConfiguration {
static final int DEFAULT_KEYS_MAX_LENGTH = 100;
private final Tracer tracer;
private final boolean traceWithActiveSpanOnly;
private final int keysMaxLength;
private final Function<String, String> spanNameProvider;
static final int DEFAULT_KEYS_MAX_LENGTH = 100;
private final Tracer tracer;
private final boolean traceWithActiveSpanOnly;
private final int keysMaxLength;
private final Function<String, String> spanNameProvider;

private TracingConfiguration(Tracer tracer, boolean traceWithActiveSpanOnly, int keysMaxLength,
Function<String, String> spanNameProvider) {
this.tracer = tracer;
this.traceWithActiveSpanOnly = traceWithActiveSpanOnly;
this.keysMaxLength = keysMaxLength;
this.spanNameProvider = spanNameProvider;
}
private TracingConfiguration(Tracer tracer, boolean traceWithActiveSpanOnly, int keysMaxLength,
Function<String, String> spanNameProvider) {
this.tracer = tracer;
this.traceWithActiveSpanOnly = traceWithActiveSpanOnly;
this.keysMaxLength = keysMaxLength;
this.spanNameProvider = spanNameProvider;
}

public Tracer getTracer() {
return tracer;
}
public Tracer getTracer() {
return tracer;
}

public boolean isTraceWithActiveSpanOnly() {
return traceWithActiveSpanOnly;
}
public boolean isTraceWithActiveSpanOnly() {
return traceWithActiveSpanOnly;
}

public int getKeysMaxLength() {
return keysMaxLength;
}
public int getKeysMaxLength() {
return keysMaxLength;
}

public Function<String, String> getSpanNameProvider() {
return spanNameProvider;
}
public Function<String, String> getSpanNameProvider() {
return spanNameProvider;
}

public static class Builder {
private final Tracer tracer;
private boolean traceWithActiveSpanOnly;
private int keysMaxLength = DEFAULT_KEYS_MAX_LENGTH;
private Function<String, String> spanNameProvider = RedisSpanNameProvider.OPERATION_NAME;
public static class Builder {
private final Tracer tracer;
private boolean traceWithActiveSpanOnly;
private int keysMaxLength = DEFAULT_KEYS_MAX_LENGTH;
private Function<String, String> spanNameProvider = RedisSpanNameProvider.OPERATION_NAME;

public Builder(Tracer tracer) {
this.tracer = tracer;
}
public Builder(Tracer tracer) {
this.tracer = tracer;
}

/**
* @param traceWithActiveSpanOnly if <code>true</code> then create new spans only if there is
* an active span
*/
public Builder traceWithActiveSpanOnly(boolean traceWithActiveSpanOnly) {
this.traceWithActiveSpanOnly = traceWithActiveSpanOnly;
return this;
}
/**
* @param traceWithActiveSpanOnly if <code>true</code> then create new spans only if there is an
* active span
*/
public Builder traceWithActiveSpanOnly(boolean traceWithActiveSpanOnly) {
this.traceWithActiveSpanOnly = traceWithActiveSpanOnly;
return this;
}

/**
* Customize the span name, default is operation name ({@link RedisSpanNameProvider#OPERATION_NAME})
*
* @param spanNameProvider function to customize the span name
*/
public Builder withSpanNameProvider(Function<String, String> spanNameProvider) {
this.spanNameProvider = spanNameProvider;
return this;
}
/**
* Customize the span name, default is operation name ({@link RedisSpanNameProvider#OPERATION_NAME})
*
* @param spanNameProvider function to customize the span name
*/
public Builder withSpanNameProvider(Function<String, String> spanNameProvider) {
this.spanNameProvider = spanNameProvider;
return this;
}

/**
* Limit number of keys to add to span (default is 100)
*
* @param keysMaxLength max keys length to add to span
*/
public Builder withKeysMaxLength(int keysMaxLength) {
this.keysMaxLength = keysMaxLength;
return this;
}
/**
* Limit number of keys to add to span (default is 100)
*
* @param keysMaxLength max keys length to add to span
*/
public Builder withKeysMaxLength(int keysMaxLength) {
this.keysMaxLength = keysMaxLength;
return this;
}

public TracingConfiguration build() {
if (spanNameProvider == null) {
spanNameProvider = RedisSpanNameProvider.OPERATION_NAME;
}
if (keysMaxLength <= 0) {
keysMaxLength = DEFAULT_KEYS_MAX_LENGTH;
}
return new TracingConfiguration(tracer, traceWithActiveSpanOnly, keysMaxLength,
spanNameProvider);
}
public TracingConfiguration build() {
if (spanNameProvider == null) {
spanNameProvider = RedisSpanNameProvider.OPERATION_NAME;
}
if (keysMaxLength <= 0) {
keysMaxLength = DEFAULT_KEYS_MAX_LENGTH;
}
return new TracingConfiguration(tracer, traceWithActiveSpanOnly, keysMaxLength,
spanNameProvider);
}
}
}
Loading

0 comments on commit b8f6b70

Please sign in to comment.