NO-JIRA Renaming example as opentelemetry
This commit is contained in:
parent
73e57e5ea8
commit
a72d894cb7
|
@ -27,7 +27,7 @@ under the License.
|
|||
<version>2.25.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>opentracing</artifactId>
|
||||
<artifactId>opentelemetry</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>ActiveMQ Artemis Broker Plugin Example</name>
|
||||
|
||||
|
@ -123,7 +123,7 @@ under the License.
|
|||
<configuration>
|
||||
<!-- The broker plugin will install this library on the server's classpath -->
|
||||
<libList>
|
||||
<arg>org.apache.activemq.examples.broker:opentracing:${project.version}</arg>
|
||||
<arg>org.apache.activemq.examples.broker:opentelemetry:${project.version}</arg>
|
||||
</libList>
|
||||
<libListWithDeps>
|
||||
<arg>io.opentelemetry:opentelemetry-api:${opentelemetry.version}</arg>
|
||||
|
@ -167,7 +167,7 @@ under the License.
|
|||
<goal>runClient</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<clientClass>org.apache.activemq.artemis.jms.example.OpenTracingPluginExample</clientClass>
|
||||
<clientClass>org.apache.activemq.artemis.jms.example.OpenTelemetryPluginExample</clientClass>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
|
@ -186,7 +186,7 @@ under the License.
|
|||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.activemq.examples.broker</groupId>
|
||||
<artifactId>opentracing</artifactId>
|
||||
<artifactId>opentelemetry</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
|
@ -1,10 +1,10 @@
|
|||
# Opentracing Plugin Example
|
||||
# opentelemetry Plugin Example
|
||||
|
||||
This plugin
|
||||
embraces [OpenTelemetry Autoconfiguration](https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/autoconfigure)
|
||||
using environment-based properties to configure OpenTelemetry SDK.
|
||||
|
||||
## Run Opentracing Plugin Example
|
||||
## Run OpenTelemetry Plugin Example
|
||||
|
||||
[![Running the Example Demo](https://img.youtube.com/vi/MVGx7QrztZQ/0.jpg)](https://www.youtube.com/watch?v=MVGx7QrztZQ)
|
||||
|
||||
|
@ -16,7 +16,7 @@ and create the broker manually.
|
|||
|
||||
After seeing a **`Build Success`**, open the browser, connect to your Jeager running instance and check for spans.
|
||||
|
||||
## Customise Opentracing Plugin Example
|
||||
## Customise OpenTelemetry Plugin Example
|
||||
|
||||
The [`tracing.properties`](./src/main/resources/tracing.properties) has configuration properties that
|
||||
autoconfigure [Opentelemetry Exporter](https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/autoconfigure#exporters)
|
||||
|
@ -40,7 +40,7 @@ You can change this by choosing to use:
|
|||
> **Note:** command to start Zipkin instance `docker run -p 9411:9411 openzipkin/zipkin`
|
||||
|
||||
|
||||
You can also change the default service name from `opentracing_plugin` to any string by changing the value
|
||||
You can also change the default service name from `opentelemetry_plugin` to any string by changing the value
|
||||
of `otel.service.name`
|
||||
|
||||
## How to start exporters
|
|
@ -36,15 +36,15 @@ import org.apache.activemq.artemis.core.server.ServerSession;
|
|||
import org.apache.activemq.artemis.core.server.plugin.ActiveMQServerPlugin;
|
||||
import org.apache.activemq.artemis.core.transaction.Transaction;
|
||||
|
||||
public class OpenTracingPlugin implements ActiveMQServerPlugin {
|
||||
public class OpenTelemetryPlugin implements ActiveMQServerPlugin {
|
||||
|
||||
private static final String OPERATION_NAME = "ArtemisMessageDelivery";
|
||||
private static OpenTelemetrySdk sdk = initOpenTracing();
|
||||
private static Tracer tracer = GlobalOpenTelemetry.getTracer(OpenTracingPlugin.class.getName());
|
||||
private static OpenTelemetrySdk sdk = initopentelemetry();
|
||||
private static Tracer tracer = GlobalOpenTelemetry.getTracer(OpenTelemetryPlugin.class.getName());
|
||||
|
||||
public static OpenTelemetrySdk initOpenTracing() {
|
||||
public static OpenTelemetrySdk initopentelemetry() {
|
||||
try {
|
||||
InputStream input = OpenTracingPlugin.class.getClassLoader().getResourceAsStream("tracing.properties");
|
||||
InputStream input = OpenTelemetryPlugin.class.getClassLoader().getResourceAsStream("tracing.properties");
|
||||
if (input == null) {
|
||||
throw new NullPointerException("Unable to find tracing.properties file");
|
||||
}
|
||||
|
@ -66,6 +66,10 @@ public class OpenTracingPlugin implements ActiveMQServerPlugin {
|
|||
Message message,
|
||||
boolean direct,
|
||||
boolean noAutoCreateQueue) throws ActiveMQException {
|
||||
|
||||
// TODO: find a way to inject a context based in https://github.com/kittylyst/OTel/blob/8faea2aab7b19680f78804ddff3d59b7b1135aab/src/main/java/io/opentelemetry/examples/utils/OpenTelemetryConfig.java#L96-L100
|
||||
// if a client has the metadata, we should get the parent context here
|
||||
|
||||
SpanBuilder spanBuilder = getTracer().spanBuilder(OPERATION_NAME).setAttribute("message", message.toString()).setSpanKind(SpanKind.SERVER);
|
||||
Span span = spanBuilder.startSpan();
|
||||
message.setUserContext(Span.class, span);
|
|
@ -32,7 +32,7 @@ import org.apache.qpid.jms.JmsConnectionFactory;
|
|||
/**
|
||||
* A simple example which shows how to use a QueueBrowser to look at messages of a queue without removing them from the queue
|
||||
*/
|
||||
public class OpenTracingPluginExample {
|
||||
public class OpenTelemetryPluginExample {
|
||||
|
||||
public static void main(final String[] args) throws Exception {
|
||||
|
|
@ -107,7 +107,7 @@ under the License.
|
|||
-->
|
||||
|
||||
<broker-plugins>
|
||||
<broker-plugin class-name="org.apache.activemq.artemis.jms.example.OpenTracingPlugin"/>
|
||||
<broker-plugin class-name="org.apache.activemq.artemis.jms.example.OpenTelemetryPlugin"/>
|
||||
</broker-plugins>
|
||||
|
||||
<acceptors>
|
|
@ -25,7 +25,7 @@
|
|||
#otel.exporter.otlp.traces.protocol=grpc
|
||||
|
||||
# service name
|
||||
otel.service.name=artemis_opentracing
|
||||
otel.service.name=artemis_opentelemetry
|
||||
|
||||
# Jaeger exporter
|
||||
otel.traces.exporter=jaeger
|
|
@ -49,11 +49,11 @@ import static org.mockito.Mockito.verify;
|
|||
import static org.mockito.Mockito.when;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class OpenTracingPluginTest {
|
||||
public class OpenTelemetryPluginTest {
|
||||
|
||||
private final InMemorySpanExporter exporter = InMemorySpanExporter.create();
|
||||
@InjectMocks
|
||||
private OpenTracingPlugin plugin;
|
||||
private OpenTelemetryPlugin plugin;
|
||||
|
||||
@Mock
|
||||
private SpanBuilder spanBuilder;
|
|
@ -80,7 +80,7 @@ under the License.
|
|||
<module>message-priority</module>
|
||||
<module>netty-openssl</module>
|
||||
<module>no-consumer-buffering</module>
|
||||
<module>opentracing</module>
|
||||
<module>opentelemetry</module>
|
||||
<module>paging</module>
|
||||
<module>pre-acknowledge</module>
|
||||
<module>producer-rate-limit</module>
|
||||
|
@ -157,7 +157,7 @@ under the License.
|
|||
<module>message-priority</module>
|
||||
<module>netty-openssl</module>
|
||||
<module>no-consumer-buffering</module>
|
||||
<module>opentracing</module>
|
||||
<module>opentelemetry</module>
|
||||
<module>paging</module>
|
||||
<module>pre-acknowledge</module>
|
||||
<module>producer-rate-limit</module>
|
||||
|
|
Loading…
Reference in New Issue