Skip to content

Commit c5401ba

Browse files
committed
feat: adding otel-js and rhosdt example to main branch
1 parent 5736be5 commit c5401ba

File tree

11 files changed

+838
-30
lines changed

11 files changed

+838
-30
lines changed

OTEL.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
## OpenTelemetry with OpenShift Distributed Tracing Platform
2+
3+
Start OpenShift local and create a new project.
4+
5+
```
6+
$ crc setup
7+
$ crc start
8+
$ eval $(crc oc-env)
9+
$ oc login -u developer
10+
$ oc new-project opentelemetry-js-rhosdt
11+
```
12+
### Install the OpenShift Distributed Tracing Platform Operator
13+
14+
1. Login as kubeadmin
15+
2. Go to OperatorHub
16+
3. Search for Jaeger
17+
4. Click on `Red Hat OpenShift distributed tracing platform` and follow the instructions to install.
18+
19+
![kubeadmin-login-operatorhub](images/kubeadmin.png)
20+
21+
5. Login as developer, go to Topology and add the Jaeger Operator to the project.
22+
23+
![operator](images/operator.png)
24+
25+
![jaeger](images/jaeger.png)
26+
27+
![topology](images/topology.png)
28+
29+
6. Configure the URL for the JaegerExporter endpoint
30+
31+
```
32+
❯ oc get svc
33+
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
34+
jaeger-all-in-one-inmemory-agent ClusterIP None <none> 5775/UDP,5778/TCP,6831/UDP,6832/UDP 2m16s
35+
jaeger-all-in-one-inmemory-collector ClusterIP 10.217.5.57 <none> 9411/TCP,14250/TCP,14267/TCP,14268/TCP,4317/TCP,4318/TCP 2m16s
36+
jaeger-all-in-one-inmemory-collector-headless ClusterIP None <none> 9411/TCP,14250/TCP,14267/TCP,14268/TCP,4317/TCP,4318/TCP 2m16s
37+
jaeger-all-in-one-inmemory-query ClusterIP 10.217.5.219 <none> 443/TCP,16685/TCP 2m16s
38+
```
39+
40+
We are going to use `jaeger-all-in-one-inmemory-collector` +
41+
our namespace service `opentelemetry-js-rhosdt.svc` for the
42+
`JaegerExporter` endpoint.
43+
44+
Resulting in the following:
45+
46+
(content from the [tracing.js](./tracing.js) file)
47+
```js
48+
const exporter = new JaegerExporter({
49+
endpoint: 'http://jaeger-all-in-one-inmemory-collector.opentelemetry-js-rhosdt.svc:14268/api/traces'
50+
});
51+
```
52+
53+
7. Deploy the example to OpenShift local
54+
55+
* Uncomment the `require('./tracing.js');` on `app.js`
56+
57+
```
58+
npm install
59+
npm run openshift
60+
```
61+
62+
8. When you login on Jaeger UI you can see the result like this:
63+
64+
![result](images/result.png)

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,5 @@ $ npm run openshift # Deploys the example app
3838

3939
### OpenTelemetry with OpenShift Distributed Tracing Platform
4040

41-
Clone this repository, switch the branch to `opentelemetry-js-rhosdt`
42-
and follow the instructions on README.md
43-
44-
Or visualize the instructions via github https://github.com/nodeshift-starters/nodejs-rest-http/tree/opentelemetry-js-rhosdt#opentelemetry-with-openshift-distributed-tracing-platform
41+
This [link](./OTEL.md) contains instructions on how to install the
42+
OpenShift Distributed Tracing Platform and enable tracing.

app.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
*
1919
*/
2020

21+
// require('./tracing.js');
22+
2123
const path = require('path');
2224
const express = require('express');
2325
const bodyParser = require('body-parser');

images/jaeger.png

73.7 KB
Loading

images/kubeadmin.png

115 KB
Loading

images/operator.png

63.4 KB
Loading

images/result.png

85 KB
Loading

images/topology.png

56.2 KB
Loading

0 commit comments

Comments
 (0)