aboutsummaryrefslogtreecommitdiff
path: root/services
diff options
context:
space:
mode:
authorzpencer <spencerfang@google.com>2018-10-08 15:44:18 -0700
committerGitHub <noreply@github.com>2018-10-08 15:44:18 -0700
commitf10676c2b4ac6fa614000fbc306c25c6fabc25c9 (patch)
tree6bbeefe027d1ebfb71ac4da0257257c0c77e4a39 /services
parentfc908e2dcc85e58bfd281d44b168da352aefd813 (diff)
downloadgrpc-grpc-java-f10676c2b4ac6fa614000fbc306c25c6fabc25c9.tar.gz
services: allow config str to be passed into binlog object (#4919)
Do not require binlog str to be defined by env var. This allows --flag=value styled configuration, which is more common internally.
Diffstat (limited to 'services')
-rw-r--r--services/src/main/java/io/grpc/services/BinaryLogProviderImpl.java6
-rw-r--r--services/src/main/java/io/grpc/services/BinaryLogs.java13
2 files changed, 17 insertions, 2 deletions
diff --git a/services/src/main/java/io/grpc/services/BinaryLogProviderImpl.java b/services/src/main/java/io/grpc/services/BinaryLogProviderImpl.java
index 39fee44d3..dee13a924 100644
--- a/services/src/main/java/io/grpc/services/BinaryLogProviderImpl.java
+++ b/services/src/main/java/io/grpc/services/BinaryLogProviderImpl.java
@@ -38,6 +38,10 @@ class BinaryLogProviderImpl extends BinaryLogProvider {
this(new TempFileSink(), System.getenv("GRPC_BINARY_LOG_CONFIG"));
}
+ /**
+ * Deprecated and will be removed in a future version of gRPC.
+ */
+ @Deprecated
public BinaryLogProviderImpl(BinaryLogSink sink) throws IOException {
this(sink, System.getenv("GRPC_BINARY_LOG_CONFIG"));
}
@@ -48,7 +52,7 @@ class BinaryLogProviderImpl extends BinaryLogProvider {
* @param configStr config string to parse to determine logged methods and msg size limits.
* @throws IOException if initialization failed.
*/
- BinaryLogProviderImpl(BinaryLogSink sink, String configStr) throws IOException {
+ public BinaryLogProviderImpl(BinaryLogSink sink, String configStr) throws IOException {
this.sink = Preconditions.checkNotNull(sink);
try {
factory = new BinlogHelper.FactoryImpl(sink, configStr);
diff --git a/services/src/main/java/io/grpc/services/BinaryLogs.java b/services/src/main/java/io/grpc/services/BinaryLogs.java
index de7f79116..fc2d8d84a 100644
--- a/services/src/main/java/io/grpc/services/BinaryLogs.java
+++ b/services/src/main/java/io/grpc/services/BinaryLogs.java
@@ -32,11 +32,22 @@ public final class BinaryLogs {
}
/**
- * Creates a binary log with a custom {@link BinaryLogSink} for receiving the logged data.
+ * Deprecated and will be removed in a future version of gRPC.
*/
+ @Deprecated
public static BinaryLog createBinaryLog(BinaryLogSink sink) throws IOException {
return new BinaryLogProviderImpl(sink);
}
+ /**
+ * Creates a binary log with a custom {@link BinaryLogSink} for receiving the logged data,
+ * and a config string as defined by
+ * <a href="https://github.com/grpc/proposal/blob/master/A16-binary-logging.md">
+ * A16-binary-logging</a>.
+ */
+ public static BinaryLog createBinaryLog(BinaryLogSink sink, String configStr) throws IOException {
+ return new BinaryLogProviderImpl(sink, configStr);
+ }
+
private BinaryLogs() {}
}