Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
Added README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
user1 committed Nov 7, 2020
1 parent abe348d commit fb2f70e
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 55 deletions.
13 changes: 13 additions & 0 deletions examples/tracing-test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Tracing test

## Intro
This Mule project runs as a Mule engine instrumented with the Mule APM agent and it serves a HTML page with Elastic RUM agent that both participate in a distributed trace. The RUM agent in the browser starts a transaction and sends a `traceparent` header containing the `trace.id` back to the Mule runtime that records its own transaction using the sent `trace.id` which results in a complete trace populated in Kibana APM UI:
![kibana-apm](images/kibana.png)

## How to run
Start the Mule project with the following additional parameters to initialise the APM agent:
```
-M-Delastic.apm.server_urls=https://XXXXX.elastic-cloud.com -M-Delastic.apm.secret_token=YYYYYY -M-Delastic.apm.service_name=component1 -M-Delastic.apm.service_version=v1.0.0 -M-Delastic.apm.log_level=INFO
```

Open the browser at http://localhost:8081 and press the `Press me` button a couple of times.
Binary file added examples/tracing-test/images/kibana.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
99 changes: 53 additions & 46 deletions examples/tracing-test/pom.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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/maven-v4_0_0.xsd">
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.mycompany</groupId>
<artifactId>tracing-test</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>mule-application</packaging>
<version>1.0.0-SNAPSHOT</version>
<packaging>mule-application</packaging>

<name>tracing-test</name>

<properties>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

Expand All @@ -36,50 +38,55 @@
</build>

<dependencies>
<dependency>
<groupId>org.mule.connectors</groupId>
<artifactId>mule-http-connector</artifactId>
<version>1.5.22</version>
<classifier>mule-plugin</classifier>
</dependency>
<dependency>
<groupId>org.mule.connectors</groupId>
<artifactId>mule-sockets-connector</artifactId>
<version>1.2.0</version>
<classifier>mule-plugin</classifier>
</dependency>
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-scripting-module</artifactId>
<version>1.1.7</version>
<classifier>mule-plugin</classifier>
</dependency>
</dependencies>
<groupId>org.mule.connectors</groupId>
<artifactId>mule-http-connector</artifactId>
<version>1.5.22</version>
<classifier>mule-plugin</classifier>
</dependency>
<dependency>
<groupId>org.mule.connectors</groupId>
<artifactId>mule-sockets-connector</artifactId>
<version>1.2.0</version>
<classifier>mule-plugin</classifier>
</dependency>
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-scripting-module</artifactId>
<version>1.1.7</version>
<classifier>mule-plugin</classifier>
</dependency>
<dependency>
<groupId>co.elastic.apm</groupId>
<artifactId>mule4-agent</artifactId>
<version>0.4.0</version>
</dependency>
</dependencies>

<repositories>
<repository>
<id>anypoint-exchange-v2</id>
<name>Anypoint Exchange</name>
<url>https://maven.anypoint.mulesoft.com/api/v2/maven</url>
<layout>default</layout>
</repository>
<repository>
<id>mulesoft-releases</id>
<name>MuleSoft Releases Repository</name>
<url>https://repository.mulesoft.org/releases/</url>
<layout>default</layout>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>mulesoft-releases</id>
<name>mulesoft release repository</name>
<layout>default</layout>
<url>https://repository.mulesoft.org/releases/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<repository>
<id>anypoint-exchange-v2</id>
<name>Anypoint Exchange</name>
<url>https://maven.anypoint.mulesoft.com/api/v2/maven</url>
<layout>default</layout>
</repository>
<repository>
<id>mulesoft-releases</id>
<name>MuleSoft Releases Repository</name>
<url>https://repository.mulesoft.org/releases/</url>
<layout>default</layout>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>mulesoft-releases</id>
<name>mulesoft release repository</name>
<layout>default</layout>
<url>https://repository.mulesoft.org/releases/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>

</project>
12 changes: 3 additions & 9 deletions examples/tracing-test/src/main/mule/tracing-test.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd">

<import file="tracer.xml" doc:name="Import" doc:id="de18c1fa-b6c5-46c2-a7db-b7005fb42a0e" />

<http:listener-config name="HTTP_Listener_config" doc:name="HTTP Listener config" doc:id="22564b6c-9cbc-4efc-90f0-2d6658121a7f" >
<http:listener-connection host="0.0.0.0" port="8081" />
</http:listener-config>
Expand All @@ -18,7 +21,6 @@ http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mul
<http:headers ><![CDATA[#[output application/java
---
{
"cache-control" : "no-cache",
"Content-Type" : "text/html"
}]]]></http:headers>
</http:response>
Expand Down Expand Up @@ -85,14 +87,6 @@ http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mul
</flow>
<flow name="tracing-testFlow1" doc:id="77e5d1b6-6582-4000-98bb-ca274e239b1f" >
<http:listener doc:name="Listener" doc:id="25c6f811-1356-4c51-ad4e-84ef9fb70cd1" config-ref="HTTP_Listener_config" path="/form">
<http:response statusCode="301">
<http:headers ><![CDATA[#[output application/java
---
{
"cache-control" : "no-store",
"location" : "/"
}]]]></http:headers>
</http:response>
</http:listener>
<logger level="WARN" doc:name="Logger" doc:id="62a0b6fe-84f8-4c1f-bd24-3f1637b7ae77" message="submit pressed"/>
</flow>
Expand Down

0 comments on commit fb2f70e

Please sign in to comment.