Skip to content

Commit ef94c8b

Browse files
committed
rebase and add all changes for browser navigation instrumentation
1 parent 510d091 commit ef94c8b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+3546
-117
lines changed

.github/component-label-map.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,10 @@ pkg:propagator-aws-xray-lambda:
291291
- changed-files:
292292
- any-glob-to-any-file:
293293
- packages/propagator-aws-xray-lambda/**
294+
pkg:instrumentation-browser-navigation:
295+
- changed-files:
296+
- any-glob-to-any-file:
297+
- packages/instrumentation-browser-navigation/**
294298
pkg-status:unmaintained:
295299
- changed-files:
296300
- any-glob-to-any-file:

.github/component_owners.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,9 @@ components:
166166
- wolfgangcodes
167167
packages/plugin-react-load:
168168
- martinkuba
169+
packages/instrumentation-browser-navigation:
170+
- Abinet18
171+
- martinkuba
169172
packages/propagator-instana:
170173
- kirrg001
171174
packages/propagator-ot-trace: []
@@ -174,6 +177,5 @@ components:
174177
- jj22ee
175178
packages/propagator-aws-xray-lambda: [ ]
176179
# Unmaintained
177-
178180
ignored-authors:
179181
- renovate-bot

.github/workflows/lint.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jobs:
1919
node-version: 18
2020
cache: npm
2121
- run: npm ci --ignore-scripts
22+
- name: Compile
23+
run: npm run compile
2224
- name: Lint
2325
run: |
2426
npm run lint

.release-please-manifest.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,6 @@
6868
"packages/propagator-instana": "0.4.3",
6969
"packages/propagator-ot-trace": "0.28.3",
7070
"packages/propagator-aws-xray": "2.1.4",
71-
"packages/propagator-aws-xray-lambda": "0.55.4"
71+
"packages/propagator-aws-xray-lambda": "0.55.4",
72+
"packages/instrumentation-browser-navigation": "0.54.0"
7273
}

examples/web/.babelrc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"presets": [
3+
["@babel/preset-env", {
4+
"targets": {
5+
"browsers": ["last 2 versions"]
6+
}
7+
}],
8+
["@babel/preset-react", {
9+
"runtime": "automatic"
10+
}]
11+
]
12+
}

examples/web/DEPENDENCIES.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Dependencies Notes
2+
3+
## Local Development Dependencies
4+
5+
- `@opentelemetry/instrumentation-browser-navigation`: Currently using `file:../../packages/instrumentation-browser-navigation`
6+
- **TODO**: Change to npm version (e.g., `"^0.54.0"`) when package is published to npm registry
7+
- This is a temporary local file reference for development and testing
Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
<!DOCTYPE html>
22
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>Document Load Plugin Example</title>
6+
<base href="/" />
37

4-
<head>
5-
<meta charset="utf-8">
6-
<title>Document Load Plugin Example</title>
7-
<base href="/">
8-
9-
<!--
8+
<!--
109
https://www.w3.org/TR/trace-context/
1110
Set the `traceparent` in the server's HTML template code. It should be
1211
dynamically generated server side to have the server's request trace Id,
@@ -15,17 +14,24 @@
1514
(01 = sampled, 00 = notsampled).
1615
'{version}-{traceId}-{spanId}-{sampleDecision}'
1716
-->
18-
<!-- <meta name="traceparent" content="00-ab42124a3c573678d4d8b21ba52df3bf-d21f7bc17caa5aba-01">-->
19-
20-
<meta name="viewport" content="width=device-width, initial-scale=1">
21-
</head>
17+
<!-- <meta name="traceparent" content="00-ab42124a3c573678d4d8b21ba52df3bf-d21f7bc17caa5aba-01">-->
2218

23-
<body>
24-
Example of using Web Tracer with document load plugin with console exporter and collector exporter
25-
<script type="text/javascript" src="document-load.js"></script>
26-
<br/>
27-
<button id="button1">Test WebTracer with ZoneContextManager - async</button>
19+
<meta name="viewport" content="width=device-width, initial-scale=1" />
20+
</head>
2821

29-
</body>
22+
<body>
23+
Example of using Web Tracer with document load plugin with console exporter
24+
and collector exporter
25+
<script type="text/javascript" src="document-load.js"></script>
26+
<br />
27+
<button id="button1">Test WebTracer with ZoneContextManager - async</button>
28+
<nav>
29+
<a href="document-load/route1" data-link>Route 1</a>
30+
<a href="document-load/route2" data-link>Route 2</a>
31+
</nav>
3032

33+
<div id="content">
34+
<!-- Content will be loaded here -->
35+
</div>
36+
</body>
3137
</html>

examples/web/examples/document-load/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ import {
3232
W3CTraceContextPropagator,
3333
} from '@opentelemetry/core';
3434
import { registerInstrumentations } from '@opentelemetry/instrumentation';
35-
import { Resource } from '@opentelemetry/resources';
35+
import { resourceFromAttributes } from '@opentelemetry/resources';
3636
import { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';
3737

3838
const provider = new WebTracerProvider({
39-
resource: new Resource({
39+
resource: resourceFromAttributes({
4040
[ATTR_SERVICE_NAME]: 'web-service-dl',
4141
}),
4242
spanProcessors: [

examples/web/examples/index.html

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>OpenTelemetry Web Examples</title>
7+
<style>
8+
body {
9+
font-family: Arial, sans-serif;
10+
margin: 40px;
11+
}
12+
h1 {
13+
color: #333;
14+
}
15+
ul {
16+
list-style-type: none;
17+
padding: 0;
18+
}
19+
li {
20+
margin: 10px 0;
21+
}
22+
a {
23+
text-decoration: none;
24+
color: #0066cc;
25+
font-size: 18px;
26+
}
27+
a:hover {
28+
text-decoration: underline;
29+
}
30+
</style>
31+
</head>
32+
<body>
33+
<h1>OpenTelemetry Web Examples</h1>
34+
<p>Choose an example to explore:</p>
35+
<ul>
36+
<li><a href="/document-load/">📄 Document Load Instrumentation</a></li>
37+
<li><a href="/navigation/">🧭 Navigation Instrumentation</a></li>
38+
<li><a href="/react-spa/">⚛️ React SPA Navigation Demo</a></li>
39+
<li>
40+
<a href="/user-interaction/">👆 User Interaction Instrumentation</a>
41+
</li>
42+
<li><a href="/meta/">🏷️ Meta Instrumentation</a></li>
43+
</ul>
44+
</body>
45+
</html>
Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
<!DOCTYPE html>
22
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>User Interaction Example</title>
6+
<base href="/" />
37

4-
<head>
5-
<meta charset="utf-8">
6-
<title>User Interaction Example</title>
7-
<base href="/">
8-
9-
<!--
8+
<!--
109
https://www.w3.org/TR/trace-context/
1110
Set the `traceparent` in the server's HTML template code. It should be
1211
dynamically generated server side to have the server's request trace Id,
@@ -15,25 +14,24 @@
1514
(01 = sampled, 00 = notsampled).
1615
'{version}-{traceId}-{spanId}-{sampleDecision}'
1716
-->
18-
<!-- <meta name="traceparent" content="00-ab42124a3c573678d4d8b21ba52df3bf-d21f7bc17caa5aba-01">-->
19-
20-
<meta name="viewport" content="width=device-width, initial-scale=1">
21-
</head>
22-
23-
<body>
24-
Example of using Web Tracer with meta package and with console exporter and collector exporter
25-
<script type="text/javascript" src="meta.js"></script>
26-
<br/>
27-
<button id="btnAdd" class="btnAddClass">Add button</button>
28-
<div>
29-
<div></div>
30-
<div></div>
31-
<div></div>
32-
<div id="buttons"></div>
33-
<div></div>
34-
</div>
35-
<br/>
17+
<!-- <meta name="traceparent" content="00-ab42124a3c573678d4d8b21ba52df3bf-d21f7bc17caa5aba-01">-->
3618

37-
</body>
19+
<meta name="viewport" content="width=device-width, initial-scale=1" />
20+
</head>
3821

22+
<body>
23+
Example of using Web Tracer with meta package and with console exporter and
24+
collector exporter
25+
<script type="text/javascript" src="meta.js"></script>
26+
<br />
27+
<button id="btnAdd" class="btnAddClass">Add button</button>
28+
<div>
29+
<div></div>
30+
<div></div>
31+
<div></div>
32+
<div id="buttons"></div>
33+
<div></div>
34+
</div>
35+
<br />
36+
</body>
3937
</html>

0 commit comments

Comments
 (0)