Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/opentracing-contrib/java-hprose
OpenTracing instrumentation for the Hprose Remote Object Service Engine
https://github.com/opentracing-contrib/java-hprose
hprose java-hprose tracer
Last synced: about 1 month ago
JSON representation
OpenTracing instrumentation for the Hprose Remote Object Service Engine
- Host: GitHub
- URL: https://github.com/opentracing-contrib/java-hprose
- Owner: opentracing-contrib
- License: apache-2.0
- Created: 2016-12-22T23:59:41.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-16T23:30:28.000Z (almost 8 years ago)
- Last Synced: 2024-05-02T05:51:50.424Z (8 months ago)
- Topics: hprose, java-hprose, tracer
- Language: Java
- Size: 90.8 KB
- Stars: 4
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# java-hprose
OpenTracing instrumentation for the Hprose Remote Object Service Engine[![Build Status](https://travis-ci.org/opentracing-contrib/java-hprose.svg?branch=master)](https://travis-ci.org/opentracing-contrib/java-hprose)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.opentracing.contrib/opentracing-hprose/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.opentracing.contrib/opentracing-hprose/)## Quick start
This repo support the opentracing in hprose-java, if hprose-java use http or https as network protocol.### Server side
#### Using config
* If you use `hprose servlet` to open hprose services. Add `init-param` on the `hprose servlet`.
```xmlinvoke
io.opentracing.contrib.hprose.HttpServiceTracingInvokeHandler```
_If you use other InvokeHandlers, except `HttpServiceTracingInvokeHandler`, you should use comma(`,`) between these InvokeHandlers._
#### Using code
```java
package hprose.exam.server;
import hprose.common.HproseMethods;
import hprose.server.HproseServlet;
import io.opentracing.contrib.hprose.HttpServiceTracingInvokeHandler;public class MyHproseServlet extends HproseServlet {
public String hello(String name) {
return "Hello " + name;
}
@Override
public void init(ServletConfig config) throws ServletException {
super.init(config);
service.use(new HttpServiceTracingInvokeHandler());
service.add("hello", this);
}
}
```* By default, `HttpServiceTracingInvokeHandler` use java `ServiceLoader` to locate OpenTracing tracer implementation. The implementation must be **unique**, if more than one implemetations are found, `HttpServiceTracingInvokeHandler` don't use any of them, but swtich to NoopTracer.
* if you want to use the particular tracer implementation, you can use `HttpServiceTracingInvokeHandler`'constructor to set the tracer instance. like this:
```java
service.use(new HttpServiceTracingInvokeHandler(tracer));
```### Client side
* Use hprose_for_java_x edition, choose `HttpClientTracingExInvokeHandler`.
```java
client.use(new HttpClientTracingExInvokeHandler(tracer));
```* Use pure client edition, hprose_client_for_java_x edition, choose `HttpClientTracingInvokeHandler`.
```java
client.use(new HttpClientTracingInvokeHandler(tracer));
```* Also, like server side, you can use java `ServiceLoader` to locate OpenTracing tracer implementation, or use `HttpClientTracingExInvokeHandler` or `HttpClientTracingInvokeHandler` constructor to set the tracer instance.