Skip to content

Commit 31aa8fe

Browse files
committed
Fixing issue #317 - RUM section of workshop
1 parent 116cbc2 commit 31aa8fe

File tree

6 files changed

+16
-87
lines changed

6 files changed

+16
-87
lines changed

content/en/ninja-workshops/1-automatic-discovery/2-petclinic-kubernetes/8-rum/1-rebuild-app.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
title: Rebuild PetClinic with RUM enabled
33
linkTitle: 1. Rebuild PetClinic
44
weight: 1
5+
hidden: true
56
---
67

78
At the top of the previous code snippet, there is a reference to the file `/static/env.js`, which contains/sets the variables used by RUM, currently these are not configured and therefore no RUM traces are currently being sent.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Select the RUM view for the Petclinic App
3-
linkTitle: 2. Verify RUM Data
4-
weight: 2
3+
linkTitle: 1. Verify RUM Data
4+
weight: 1
55
---
66

77
Once RUM has been configured and you have added a visit for a pet, you can log in to **Splunk Observability Cloud** and verify that RUM traces are flowing in.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: RUM trace Waterfall view & linking to APM
33
linkTitle: 2. Follow RUM Traces
4-
weight: 3
4+
weight: 2
55
---
66
In the TAG Spotlight view, you are presented with all the tags associated with the RUM data. Tags are key-value pairs that are used to identify the data. In this case, the tags are automatically generated by the OpenTelemetry instrumentation. The tags are used to filter the data and to create the charts and tables. The Tag Spotlight view allows you detect trends in behavior and to drill down into a user session.
77

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: RUM trace Waterfall view & linking to APM
3-
linkTitle: 2. RUM Waterfall
4-
weight: 4
3+
linkTitle: 3. RUM Waterfall
4+
weight: 3
55
---
66

77
We are now looking at the RUM Trace waterfall, this will tell you what happened during the session on the user device as they visited the page of our petclinic application.

content/en/ninja-workshops/1-automatic-discovery/2-petclinic-kubernetes/8-rum/_index.md

Lines changed: 9 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -5,84 +5,16 @@ weight: 9
55
time: 10 minutes
66
---
77

8-
To enable Real User Monitoring (RUM) instrumentation for your application, you need to add the Open Telemetry Javascript [**https://github.com/signalfx/splunk-otel-js-web**](https://github.com/signalfx/splunk-otel-js-web) snippet to your code.
8+
To enable Real User Monitoring (RUM) instrumentation for an application, you need to add the Open Telemetry Javascript [**https://github.com/signalfx/splunk-otel-js-web**](https://github.com/signalfx/splunk-otel-js-web) snippet to the code base.
99

10-
The Spring PetClinic application uses a single HTML page as the "index" page, that is reused across all pages of the application. This is the perfect location to insert the Splunk RUM Instrumentation Library as it will be loaded for all pages automatically.
10+
The Spring PetClinic application uses a single [**index**](https://github.com/spring-petclinic/spring-petclinic-microservices/blob/main/spring-petclinic-api-gateway/src/main/resources/static/index.html) HTML page, that is reused across all views of the application. This is the perfect location to insert the Splunk RUM instrumentation library as it will be loaded for all pages automatically.
1111

12-
The following snippet is inserted into the **<head>** section of the `index.html` page:
12+
The `api-gateway` service is already running the instrumentation and sending RUM traces to Splunk Observability Cloud and we will review the data in the next section.
1313

14-
``` html
15-
<script src="/static/env.js"></script>
16-
<script src="https://cdn.signalfx.com/o11y-gdi-rum/latest/splunk-otel-web.js" crossorigin="anonymous"></script>
17-
<script src="https://cdn.signalfx.com/o11y-gdi-rum/latest/splunk-otel-web-session-recorder.js" crossorigin="anonymous"></script>
18-
<script>
19-
var realm = env.RUM_REALM;
20-
console.log('Realm:', realm);
21-
var auth = env.RUM_AUTH;
22-
var appName = env.RUM_APP_NAME;
23-
var environmentName = env.RUM_ENVIRONMENT
24-
if (realm && auth) {
25-
SplunkRum.init({
26-
realm: realm,
27-
rumAccessToken: auth,
28-
applicationName: appName,
29-
deploymentEnvironment: environmentName,
30-
version: '1.0.0',
31-
});
32-
33-
SplunkSessionRecorder.init({
34-
app: appName,
35-
realm: realm,
36-
rumAccessToken: auth
37-
});
38-
const Provider = SplunkRum.provider;
39-
var tracer=Provider.getTracer('appModuleLoader');
40-
} else {
41-
// Realm or auth is empty, provide default values or skip initialization
42-
console.log("Realm or auth is empty. Skipping Splunk Rum initialization.");
43-
}
44-
</script>
45-
```
46-
47-
The above snippet of code has already been added to `index.html` in the repository you cloned earlier, but it is not yet activated, we will do that in the next section.
48-
49-
If you want you can verify the snippet, we added to the index.html by viewing the file:
50-
51-
{{< tabs >}}
52-
{{% tab title="View index.html" %}}
53-
54-
``` bash
55-
more ~/spring-petclinic-microservices/spring-petclinic-api-gateway/src/main/resources/static/index.html
56-
```
57-
58-
{{% /tab %}}
59-
{{% tab title="Output" %}}
60-
61-
```text
62-
<!DOCTYPE html>
14+
If you want you can verify the snippet, you can view the page source in your browser by right-clicking on the page and selecting **View Page Source**.
6315

64-
<html ng-app="petClinicApp" lang="en">
65-
66-
<head>
67-
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
68-
<meta charset="utf-8"/>
69-
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
70-
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0, minimal-ui"/>
71-
<!-- The above 4 meta tags *must* come first in the head; any other head content must come *after* these tags -->
72-
73-
<link rel="shortcut icon" type="image/x-icon" href="/images/favicon.png"/>
74-
75-
<title>PetClinic :: a Spring Framework demonstration</title>
76-
<link rel="stylesheet" href="/webjars/bootstrap/css/bootstrap.min.css"/>
77-
<link rel="stylesheet" href="/css/petclinic.css"/>
78-
79-
<script src="/webjars/jquery/jquery.min.js"></script>
80-
<script src="/webjars/bootstrap/js/bootstrap.min.js"></script>
81-
82-
<script src="/webjars/angularjs/angular.min.js"></script>
83-
<script src="/webjars/angular-ui-router/angular-ui-router.min.js"></script>
84-
<!-- Section added for RUM -->
85-
<script src="/scripts/env.js"></script>
16+
``` html
17+
<script src="/env.js"></script>
8618
<script src="https://cdn.signalfx.com/o11y-gdi-rum/latest/splunk-otel-web.js" crossorigin="anonymous"></script>
8719
<script src="https://cdn.signalfx.com/o11y-gdi-rum/latest/splunk-otel-web-session-recorder.js" crossorigin="anonymous"></script>
8820
<script>
@@ -99,22 +31,18 @@ If you want you can verify the snippet, we added to the index.html by viewing th
9931
deploymentEnvironment: environmentName,
10032
version: '1.0.0',
10133
});
102-
34+
10335
SplunkSessionRecorder.init({
10436
app: appName,
10537
realm: realm,
10638
rumAccessToken: auth
10739
});
108-
const Provider = SplunkRum.provider;
40+
const Provider = SplunkRum.provider;
10941
var tracer=Provider.getTracer('appModuleLoader');
11042
} else {
11143
// Realm or auth is empty, provide default values or skip initialization
11244
console.log("Realm or auth is empty. Skipping Splunk Rum initialization.");
11345
}
11446
</script>
11547
<!-- Section added for RUM -->
116-
<script src="/scripts/app.js"></script>
117-
```
118-
119-
{{% /tab %}}
120-
{{< /tabs >}}
48+
```

workshop/petclinic/petclinic-deploy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ spec:
155155
- java
156156
- org.springframework.boot.loader.JarLauncher
157157
name: api-gateway
158-
image: quay.io/phagen/spring-petclinic-api-gateway:0.1 #Multi-arch
158+
image: quay.io/phagen/spring-petclinic-api-gateway:0.0.7
159159
#image: localhost:9999/spring-petclinic-api-gateway:local
160160
imagePullPolicy: Always
161161
ports:

0 commit comments

Comments
 (0)