本文整理了Java中zipkin2.codec.Encoding.name()
方法的一些代码示例,展示了Encoding.name()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Encoding.name()
方法的具体详情如下:
包路径:zipkin2.codec.Encoding
类名称:Encoding
方法名:name
暂无
代码示例来源:origin: spring-cloud/spring-cloud-sleuth
RestTemplateSender(RestTemplate restTemplate, String baseUrl,
BytesEncoder<Span> encoder) {
this.restTemplate = restTemplate;
this.encoding = encoder.encoding();
if (encoder.equals(JSON_V2)) {
this.mediaType = MediaType.APPLICATION_JSON;
this.url = baseUrl + (baseUrl.endsWith("/") ? "" : "/") + "api/v2/spans";
}
else if (this.encoding == Encoding.PROTO3) {
this.mediaType = MediaType.parseMediaType("application/x-protobuf");
this.url = baseUrl + (baseUrl.endsWith("/") ? "" : "/") + "api/v2/spans";
}
else if (this.encoding == Encoding.JSON) {
this.mediaType = MediaType.APPLICATION_JSON;
this.url = baseUrl + (baseUrl.endsWith("/") ? "" : "/") + "api/v1/spans";
}
else {
throw new UnsupportedOperationException(
"Unsupported encoding: " + this.encoding.name());
}
this.messageEncoder = BytesMessageEncoder.forEncoding(this.encoding);
}
代码示例来源:origin: io.zipkin.reporter2/zipkin-reporter
public static BytesMessageEncoder forEncoding(Encoding encoding) {
if (encoding == null) throw new NullPointerException("encoding == null");
switch (encoding) {
case JSON:
return JSON;
case PROTO3:
return PROTO3;
case THRIFT:
return THRIFT;
default:
throw new UnsupportedOperationException(encoding.name());
}
}
}
代码示例来源:origin: io.zipkin.reporter2/zipkin-sender-urlconnection
URLConnectionSender(Builder builder) {
if (builder.endpoint == null) throw new NullPointerException("endpoint == null");
this.endpoint = builder.endpoint;
this.encoding = builder.encoding;
switch (builder.encoding) {
case JSON:
this.mediaType = "application/json";
this.encoder = BytesMessageEncoder.JSON;
break;
case THRIFT:
this.mediaType = "application/x-thrift";
this.encoder = BytesMessageEncoder.THRIFT;
break;
case PROTO3:
this.mediaType = "application/x-protobuf";
this.encoder = BytesMessageEncoder.PROTO3;
break;
default:
throw new UnsupportedOperationException("Unsupported encoding: " + encoding.name());
}
this.messageMaxBytes = builder.messageMaxBytes;
this.connectTimeout = builder.connectTimeout;
this.readTimeout = builder.readTimeout;
this.compressionEnabled = builder.compressionEnabled;
}
代码示例来源:origin: org.springframework.cloud/spring-cloud-sleuth-zipkin2
RestTemplateSender(RestTemplate restTemplate, String baseUrl, BytesEncoder<Span> encoder) {
this.restTemplate = restTemplate;
this.encoding = encoder.encoding();
if (encoder.equals(JSON_V2)) {
this.mediaType = MediaType.APPLICATION_JSON;
this.url = baseUrl + (baseUrl.endsWith("/") ? "" : "/") + "api/v2/spans";
} else if (this.encoding == Encoding.JSON) {
this.mediaType = MediaType.APPLICATION_JSON;
this.url = baseUrl + (baseUrl.endsWith("/") ? "" : "/") + "api/v1/spans";
} else {
throw new UnsupportedOperationException("Unsupported encoding: " + this.encoding.name());
}
this.messageEncoder = BytesMessageEncoder.forEncoding(this.encoding);
}
代码示例来源:origin: org.springframework.cloud/spring-cloud-sleuth-zipkin
RestTemplateSender(RestTemplate restTemplate, String baseUrl,
BytesEncoder<Span> encoder) {
this.restTemplate = restTemplate;
this.encoding = encoder.encoding();
if (encoder.equals(JSON_V2)) {
this.mediaType = MediaType.APPLICATION_JSON;
this.url = baseUrl + (baseUrl.endsWith("/") ? "" : "/") + "api/v2/spans";
}
else if (this.encoding == Encoding.PROTO3) {
this.mediaType = MediaType.parseMediaType("application/x-protobuf");
this.url = baseUrl + (baseUrl.endsWith("/") ? "" : "/") + "api/v2/spans";
}
else if (this.encoding == Encoding.JSON) {
this.mediaType = MediaType.APPLICATION_JSON;
this.url = baseUrl + (baseUrl.endsWith("/") ? "" : "/") + "api/v1/spans";
}
else {
throw new UnsupportedOperationException(
"Unsupported encoding: " + this.encoding.name());
}
this.messageEncoder = BytesMessageEncoder.forEncoding(this.encoding);
}
代码示例来源:origin: io.zipkin.reporter2/zipkin-sender-okhttp3
OkHttpSender(Builder builder) {
if (builder.endpoint == null) throw new NullPointerException("endpoint == null");
endpoint = builder.endpoint;
encoding = builder.encoding;
switch (encoding) {
case JSON:
encoder = RequestBodyMessageEncoder.JSON;
break;
case THRIFT:
this.encoder = RequestBodyMessageEncoder.THRIFT;
break;
case PROTO3:
encoder = RequestBodyMessageEncoder.PROTO3;
break;
default:
throw new UnsupportedOperationException("Unsupported encoding: " + encoding.name());
}
maxRequests = builder.maxRequests;
messageMaxBytes = builder.messageMaxBytes;
compressionEnabled = builder.compressionEnabled;
Dispatcher dispatcher = newDispatcher(maxRequests);
// doing the extra "build" here prevents us from leaking our dispatcher to the builder
client = builder.clientBuilder().build().newBuilder().dispatcher(dispatcher).build();
}
代码示例来源:origin: io.zipkin.reporter2/zipkin-reporter
/** Builds an async reporter that encodes zipkin spans as they are reported. */
public AsyncReporter<Span> build() {
switch (sender.encoding()) {
case JSON:
return build(SpanBytesEncoder.JSON_V2);
case PROTO3:
return build(SpanBytesEncoder.PROTO3);
case THRIFT:
return build(SpanBytesEncoder.THRIFT);
default:
throw new UnsupportedOperationException(sender.encoding().name());
}
}
内容来源于网络,如有侵权,请联系作者删除!