diff --git a/.github/component-label-map.yml b/.github/component-label-map.yml index ae5125613e..3f3f833825 100644 --- a/.github/component-label-map.yml +++ b/.github/component-label-map.yml @@ -274,6 +274,10 @@ pkg:sql-common: - changed-files: - any-glob-to-any-file: - packages/opentelemetry-sql-common/** +pkg:instrumentation-page-view: + - changed-files: + - any-glob-to-any-file: + - plugins/web/opentelemetry-instrumentation-page-view/** pkg-status:unmaintained: - changed-files: - any-glob-to-any-file: diff --git a/.github/component_owners.yml b/.github/component_owners.yml index 9102833c14..6633a80f99 100644 --- a/.github/component_owners.yml +++ b/.github/component_owners.yml @@ -145,6 +145,9 @@ components: - kirrg001 propagators/opentelemetry-propagator-ot-trace: [] # Unmaintained + plugins/web/opentelemetry-instrumentation-page-view: + - Abinet18 + - martinkuba ignored-authors: - renovate-bot diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 37d4d5b53d..46c3b8d53a 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -60,5 +60,6 @@ "plugins/web/opentelemetry-instrumentation-user-interaction": "0.40.0", "plugins/web/opentelemetry-plugin-react-load": "0.31.0", "propagators/opentelemetry-propagator-instana": "0.3.2", - "propagators/opentelemetry-propagator-ot-trace": "0.27.2" + "propagators/opentelemetry-propagator-ot-trace": "0.27.2", + "plugins/web/opentelemetry-instrumentation-page-view": "0.39.0" } diff --git a/examples/web/examples/document-load/index.html b/examples/web/examples/document-load/index.html index b0362bc449..d896513e03 100644 --- a/examples/web/examples/document-load/index.html +++ b/examples/web/examples/document-load/index.html @@ -25,6 +25,14 @@
+ + +
+ +
diff --git a/examples/web/examples/document-load/index.js b/examples/web/examples/document-load/index.js index 65db02bba3..77c46fb127 100644 --- a/examples/web/examples/document-load/index.js +++ b/examples/web/examples/document-load/index.js @@ -112,3 +112,4 @@ const prepareClickEvent = () => { }; window.addEventListener('load', prepareClickEvent); + diff --git a/examples/web/examples/page-view/index.html b/examples/web/examples/page-view/index.html new file mode 100644 index 0000000000..124a7c4e8e --- /dev/null +++ b/examples/web/examples/page-view/index.html @@ -0,0 +1,38 @@ + + + + + + Page View Plugin Example + + + + + + + + + + Example of using Web Tracer with document load plugin with console exporter and collector exporter + +
+ + +
+ +
+ + + + diff --git a/examples/web/examples/page-view/index.js b/examples/web/examples/page-view/index.js new file mode 100644 index 0000000000..9033b56864 --- /dev/null +++ b/examples/web/examples/page-view/index.js @@ -0,0 +1,62 @@ +import { context, trace } from '@opentelemetry/api'; +import { events } from '@opentelemetry/api-events'; +import { EventLoggerProvider } from '@opentelemetry/sdk-events'; +import { LoggerProvider,SimpleLogRecordProcessor,ConsoleLogRecordExporter } from '@opentelemetry/sdk-logs'; +import { OTLPLogExporter } from '@opentelemetry/exporter-logs-otlp-http' +import { registerInstrumentations } from '@opentelemetry/instrumentation'; +import { Resource } from '@opentelemetry/resources'; +import { SEMRESATTRS_SERVICE_NAME } from '@opentelemetry/semantic-conventions'; +import { PageViewInstrumentation } from "@opentelemetry/instrumentation-page-view"; + +const loggerProvider = new LoggerProvider({resource: new Resource({[SEMRESATTRS_SERVICE_NAME]: 'web-service-dl'})}); + +loggerProvider.addLogRecordProcessor(new SimpleLogRecordProcessor(new ConsoleLogRecordExporter())); +loggerProvider.addLogRecordProcessor(new SimpleLogRecordProcessor(new OTLPLogExporter())); +const eventLoggerProvider = new EventLoggerProvider(loggerProvider); +events.setGlobalEventLoggerProvider(eventLoggerProvider); + +registerInstrumentations({ + instrumentations: [ + new PageViewInstrumentation({enabled:false}) + ], +}); + +// Define routes and their content +const routes = { + '/page-view/route1': '

Welcome to Route 1

This is the content for Route 1.

', + '/page-view/route2': '

Welcome to Route 2

This is the content for Route 2.

' +}; + +// Function to navigate to a route +function navigateTo(url) { + console.log('Navigating to', url); + history.pushState(null, null, url); + handleRouteChange(); +} + +// Function to handle the route change +function handleRouteChange() { + const path = window.location.pathname; // Get current path + const routeContent = routes[path] || `

Not on Route

`; + document.getElementById('content').innerHTML = routeContent; +} + +// Attach event listeners to navigation links + +const attachEventListenersToLinks = () => { + document.querySelectorAll('a[data-link]').forEach(link => { + console.log('attach event listener to link', link.href) + link.addEventListener('click', (event) => { + console.log('Link clicked', event.target.href) + event.preventDefault(); + navigateTo(event.target.href); + }); + }); +} + +window.addEventListener('popstate', handleRouteChange); +const loadTimeSetup = () => { + handleRouteChange(); + attachEventListenersToLinks(); +} +window.addEventListener('load', loadTimeSetup); diff --git a/examples/web/package.json b/examples/web/package.json index af7ca620c9..4532b823c8 100644 --- a/examples/web/package.json +++ b/examples/web/package.json @@ -7,7 +7,7 @@ "scripts": { "docker:start": "cd ./docker && docker-compose down && docker-compose up", "docker:startd": "cd ./docker && docker-compose down && docker-compose up -d", - "start": "webpack-dev-server -d --progress --colors --port 8090 --config webpack.config.js --hot --inline --host 0.0.0.0 --content-base examples" + "start": "webpack serve --mode development --progress --port 8090 --config webpack.config.js --hot --host 0.0.0.0 --static examples" }, "repository": { "type": "git", @@ -30,21 +30,24 @@ "@babel/core": "^7.21.8", "babel-loader": "^8.3.0", "ts-loader": "^6.2.2", - "webpack": "5.89.0", - "webpack-cli": "^3.3.12", - "webpack-dev-server": "^3.11.3", - "webpack-merge": "^4.2.2" + "webpack": "^5.93.0", + "webpack-cli": "^5.1.4", + "webpack-dev-server": "^5.0.4", + "webpack-merge": "^6.0.1" }, "dependencies": { "@opentelemetry/api": "^1.4.1", + "@opentelemetry/api-events": "^0.52.1", "@opentelemetry/auto-instrumentations-web": "^0.32.2", "@opentelemetry/context-zone": "^1.13.0", + "@opentelemetry/exporter-logs-otlp-http": "^0.52.1", "@opentelemetry/exporter-trace-otlp-http": "^0.39.1", "@opentelemetry/instrumentation": "^0.39.1", - "@opentelemetry/instrumentation-document-load": "^0.32.2", "@opentelemetry/instrumentation-user-interaction": "^0.32.3", "@opentelemetry/instrumentation-xml-http-request": "^0.39.1", "@opentelemetry/propagator-b3": "^1.13.0", + "@opentelemetry/sdk-events": "^0.52.1", + "@opentelemetry/sdk-logs": "^0.52.1", "@opentelemetry/sdk-trace-web": "^1.13.0", "@opentelemetry/semantic-conventions": "^1.27.0" }, diff --git a/examples/web/webpack.config.js b/examples/web/webpack.config.js index fd3de03bb4..0136028c9a 100644 --- a/examples/web/webpack.config.js +++ b/examples/web/webpack.config.js @@ -1,7 +1,7 @@ 'use strict'; const webpack = require('webpack'); -const webpackMerge = require('webpack-merge'); +const { merge } = require('webpack-merge'); const path = require('path'); const directory = path.resolve(__dirname); @@ -9,9 +9,10 @@ const directory = path.resolve(__dirname); const common = { mode: 'development', entry: { - 'document-load': 'examples/document-load/index.js', - meta: 'examples/meta/index.js', - 'user-interaction': 'examples/user-interaction/index.js', + 'document-load': path.resolve(__dirname, 'examples/document-load/index.js'), + meta: path.resolve(__dirname, 'examples/meta/index.js'), + 'user-interaction': path.resolve(__dirname, 'examples/user-interaction/index.js'), + 'page-view': path.resolve(__dirname, 'examples/page-view/index.js'), }, output: { path: path.resolve(__dirname, 'dist'), @@ -22,15 +23,15 @@ const common = { module: { rules: [ { - test: /\.js[x]?$/, - exclude: /(node_modules)/, + test: /\.jsx?$/, + exclude: /node_modules/, use: { loader: 'babel-loader', }, }, { test: /\.ts$/, - exclude: /(node_modules)/, + exclude: /node_modules/, use: { loader: 'ts-loader', }, @@ -46,14 +47,22 @@ const common = { }, }; -module.exports = webpackMerge(common, { +const devConfig = { devtool: 'eval-source-map', devServer: { - contentBase: path.resolve(__dirname), + static: { + directory: path.resolve(__dirname, 'examples'), + }, + compress: true, + port: 8090, + hot: true, + host: '0.0.0.0', }, plugins: [ new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify('development'), }), ], -}); +}; + +module.exports = merge(common, devConfig); diff --git a/package-lock.json b/package-lock.json index 29f5e7c6cb..2dbeb294fe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -925,35 +925,6 @@ "node": ">=8" } }, - "metapackages/auto-instrumentations-web/node_modules/source-map": { - "version": "0.7.4", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", - "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, - "metapackages/auto-instrumentations-web/node_modules/ts-loader": { - "version": "9.5.1", - "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.5.1.tgz", - "integrity": "sha512-rNH3sK9kGZcH9dYzC7CewQm4NtxJTjSEVRJ2DyBZR7f8/wcta+iV44UPCXc5+nzDzivKtlzV6c9P4e+oFhDLYg==", - "dev": true, - "dependencies": { - "chalk": "^4.1.0", - "enhanced-resolve": "^5.0.0", - "micromatch": "^4.0.0", - "semver": "^7.3.4", - "source-map": "^0.7.4" - }, - "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "typescript": "*", - "webpack": "^5.0.0" - } - }, "metapackages/auto-instrumentations-web/node_modules/yargs": { "version": "16.2.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", @@ -10256,6 +10227,29 @@ "node": ">=8.0.0" } }, + "node_modules/@opentelemetry/api-events": { + "version": "0.52.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/api-events/-/api-events-0.52.1.tgz", + "integrity": "sha512-+0cSqUigzpYvpCRdXPSnGs1ZomxSR1CzoqEnEfqlke20nm//ZEmhs0WEaT5oJWByYvQqENW3zUTslPnordk82w==", + "dependencies": { + "@opentelemetry/api": "^1.0.0", + "@opentelemetry/api-logs": "0.52.1" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@opentelemetry/api-events/node_modules/@opentelemetry/api-logs": { + "version": "0.52.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/api-logs/-/api-logs-0.52.1.tgz", + "integrity": "sha512-qnSqB2DQ9TPP96dl8cDubDvrUyWc0/sK81xHTK8eSUspzDM3bsewX903qclQFvVhgStjRWdC5bLb3kQqMkfV5A==", + "dependencies": { + "@opentelemetry/api": "^1.0.0" + }, + "engines": { + "node": ">=14" + } + }, "node_modules/@opentelemetry/api-logs": { "version": "0.53.0", "resolved": "https://registry.npmjs.org/@opentelemetry/api-logs/-/api-logs-0.53.0.tgz", @@ -10674,6 +10668,10 @@ "resolved": "plugins/node/opentelemetry-instrumentation-net", "link": true }, + "node_modules/@opentelemetry/instrumentation-page-view": { + "resolved": "plugins/web/opentelemetry-instrumentation-page-view", + "link": true + }, "node_modules/@opentelemetry/instrumentation-pg": { "resolved": "plugins/node/opentelemetry-instrumentation-pg", "link": true @@ -10916,6 +10914,92 @@ "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, + "node_modules/@opentelemetry/sdk-events": { + "version": "0.52.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-events/-/sdk-events-0.52.1.tgz", + "integrity": "sha512-1CHx56QOltNg3Zwvi812uCmDVfNB1faVOXazf5pqmAX1Ys09Mu50D4ntDb5SZ6GDV8FNilHBtv5WkpZNzeXLdQ==", + "dev": true, + "dependencies": { + "@opentelemetry/api-events": "0.52.1", + "@opentelemetry/api-logs": "0.52.1", + "@opentelemetry/sdk-logs": "0.52.1" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.4.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/sdk-events/node_modules/@opentelemetry/api-logs": { + "version": "0.52.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/api-logs/-/api-logs-0.52.1.tgz", + "integrity": "sha512-qnSqB2DQ9TPP96dl8cDubDvrUyWc0/sK81xHTK8eSUspzDM3bsewX903qclQFvVhgStjRWdC5bLb3kQqMkfV5A==", + "dev": true, + "dependencies": { + "@opentelemetry/api": "^1.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@opentelemetry/sdk-events/node_modules/@opentelemetry/core": { + "version": "1.25.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.25.1.tgz", + "integrity": "sha512-GeT/l6rBYWVQ4XArluLVB6WWQ8flHbdb6r2FCHC3smtdOAbrJBIv35tpV/yp9bmYUJf+xmZpu9DRTIeJVhFbEQ==", + "dev": true, + "dependencies": { + "@opentelemetry/semantic-conventions": "1.25.1" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/sdk-events/node_modules/@opentelemetry/resources": { + "version": "1.25.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-1.25.1.tgz", + "integrity": "sha512-pkZT+iFYIZsVn6+GzM0kSX+u3MSLCY9md+lIJOoKl/P+gJFfxJte/60Usdp8Ce4rOs8GduUpSPNe1ddGyDT1sQ==", + "dev": true, + "dependencies": { + "@opentelemetry/core": "1.25.1", + "@opentelemetry/semantic-conventions": "1.25.1" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/sdk-events/node_modules/@opentelemetry/sdk-logs": { + "version": "0.52.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-logs/-/sdk-logs-0.52.1.tgz", + "integrity": "sha512-MBYh+WcPPsN8YpRHRmK1Hsca9pVlyyKd4BxOC4SsgHACnl/bPp4Cri9hWhVm5+2tiQ9Zf4qSc1Jshw9tOLGWQA==", + "dev": true, + "dependencies": { + "@opentelemetry/api-logs": "0.52.1", + "@opentelemetry/core": "1.25.1", + "@opentelemetry/resources": "1.25.1" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.4.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/sdk-events/node_modules/@opentelemetry/semantic-conventions": { + "version": "1.25.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.25.1.tgz", + "integrity": "sha512-ZDjMJJQRlyk8A1KZFCc+bCbsyrn1wTwdNt56F7twdfUfnHUZUq77/WfONCj8p72NZOyP7pNTdUWSTYC3GTbuuQ==", + "dev": true, + "engines": { + "node": ">=14" + } + }, "node_modules/@opentelemetry/sdk-logs": { "version": "0.53.0", "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-logs/-/sdk-logs-0.53.0.tgz", @@ -13027,8 +13111,7 @@ "node_modules/@types/shimmer": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@types/shimmer/-/shimmer-1.0.3.tgz", - "integrity": "sha512-F/IjUGnV6pIN7R4ZV4npHJVoNtaLZWvb+2/9gctxjb99wkpI7Ozg8VPogwDiTRyjLwZXAYxjvdg1KS8LTHKdDA==", - "dev": true + "integrity": "sha512-F/IjUGnV6pIN7R4ZV4npHJVoNtaLZWvb+2/9gctxjb99wkpI7Ozg8VPogwDiTRyjLwZXAYxjvdg1KS8LTHKdDA==" }, "node_modules/@types/sinon": { "version": "10.0.20", @@ -35132,6 +35215,96 @@ "node": ">= 14.0.0" } }, + "node_modules/ts-loader": { + "version": "9.5.1", + "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.5.1.tgz", + "integrity": "sha512-rNH3sK9kGZcH9dYzC7CewQm4NtxJTjSEVRJ2DyBZR7f8/wcta+iV44UPCXc5+nzDzivKtlzV6c9P4e+oFhDLYg==", + "dev": true, + "dependencies": { + "chalk": "^4.1.0", + "enhanced-resolve": "^5.0.0", + "micromatch": "^4.0.0", + "semver": "^7.3.4", + "source-map": "^0.7.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "typescript": "*", + "webpack": "^5.0.0" + } + }, + "node_modules/ts-loader/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/ts-loader/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/ts-loader/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/ts-loader/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/ts-loader/node_modules/source-map": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", + "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/ts-loader/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/ts-mocha": { "version": "10.0.0", "resolved": "https://registry.npmjs.org/ts-mocha/-/ts-mocha-10.0.0.tgz", @@ -37712,35 +37885,6 @@ "node": ">=8" } }, - "packages/opentelemetry-id-generator-aws-xray/node_modules/source-map": { - "version": "0.7.4", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", - "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, - "packages/opentelemetry-id-generator-aws-xray/node_modules/ts-loader": { - "version": "9.5.1", - "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.5.1.tgz", - "integrity": "sha512-rNH3sK9kGZcH9dYzC7CewQm4NtxJTjSEVRJ2DyBZR7f8/wcta+iV44UPCXc5+nzDzivKtlzV6c9P4e+oFhDLYg==", - "dev": true, - "dependencies": { - "chalk": "^4.1.0", - "enhanced-resolve": "^5.0.0", - "micromatch": "^4.0.0", - "semver": "^7.3.4", - "source-map": "^0.7.4" - }, - "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "typescript": "*", - "webpack": "^5.0.0" - } - }, "packages/opentelemetry-id-generator-aws-xray/node_modules/yargs": { "version": "16.2.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", @@ -40647,35 +40791,6 @@ "node": ">=8" } }, - "plugins/web/opentelemetry-instrumentation-long-task/node_modules/source-map": { - "version": "0.7.4", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", - "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, - "plugins/web/opentelemetry-instrumentation-long-task/node_modules/ts-loader": { - "version": "9.5.1", - "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.5.1.tgz", - "integrity": "sha512-rNH3sK9kGZcH9dYzC7CewQm4NtxJTjSEVRJ2DyBZR7f8/wcta+iV44UPCXc5+nzDzivKtlzV6c9P4e+oFhDLYg==", - "dev": true, - "dependencies": { - "chalk": "^4.1.0", - "enhanced-resolve": "^5.0.0", - "micromatch": "^4.0.0", - "semver": "^7.3.4", - "source-map": "^0.7.4" - }, - "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "typescript": "*", - "webpack": "^5.0.0" - } - }, "plugins/web/opentelemetry-instrumentation-long-task/node_modules/yargs": { "version": "16.2.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", @@ -40709,6 +40824,186 @@ "node": ">=10" } }, + "plugins/web/opentelemetry-instrumentation-page-view": { + "name": "@opentelemetry/instrumentation-page-view", + "version": "0.39.0", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/api-events": "^0.52.1", + "@opentelemetry/core": "^1.8.0", + "@opentelemetry/instrumentation": "^0.52.1" + }, + "devDependencies": { + "@babel/core": "7.22.17", + "@jsdevtools/coverage-istanbul-loader": "3.0.5", + "@opentelemetry/api": "^1.3.0", + "@opentelemetry/api-logs": "^0.52.1", + "@opentelemetry/sdk-events": "^0.52.1", + "@opentelemetry/sdk-logs": "^0.52.1", + "@types/node": "18.6.5", + "@types/sinon": "10.0.18", + "karma": "6.4.4", + "karma-chrome-launcher": "3.1.0", + "karma-coverage": "2.2.1", + "karma-jquery": "0.2.4", + "karma-mocha": "2.0.1", + "karma-spec-reporter": "0.0.36", + "karma-webpack": "5.0.1", + "sinon": "15.1.2", + "ts-loader": "9.5.1", + "ts-mocha": "10.0.0", + "typescript": "4.4.4" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "plugins/web/opentelemetry-instrumentation-page-view/node_modules/@opentelemetry/api-logs": { + "version": "0.52.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/api-logs/-/api-logs-0.52.1.tgz", + "integrity": "sha512-qnSqB2DQ9TPP96dl8cDubDvrUyWc0/sK81xHTK8eSUspzDM3bsewX903qclQFvVhgStjRWdC5bLb3kQqMkfV5A==", + "dependencies": { + "@opentelemetry/api": "^1.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "plugins/web/opentelemetry-instrumentation-page-view/node_modules/@opentelemetry/core": { + "version": "1.25.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.25.1.tgz", + "integrity": "sha512-GeT/l6rBYWVQ4XArluLVB6WWQ8flHbdb6r2FCHC3smtdOAbrJBIv35tpV/yp9bmYUJf+xmZpu9DRTIeJVhFbEQ==", + "dependencies": { + "@opentelemetry/semantic-conventions": "1.25.1" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "plugins/web/opentelemetry-instrumentation-page-view/node_modules/@opentelemetry/instrumentation": { + "version": "0.52.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation/-/instrumentation-0.52.1.tgz", + "integrity": "sha512-uXJbYU/5/MBHjMp1FqrILLRuiJCs3Ofk0MeRDk8g1S1gD47U8X3JnSwcMO1rtRo1x1a7zKaQHaoYu49p/4eSKw==", + "dependencies": { + "@opentelemetry/api-logs": "0.52.1", + "@types/shimmer": "^1.0.2", + "import-in-the-middle": "^1.8.1", + "require-in-the-middle": "^7.1.1", + "semver": "^7.5.2", + "shimmer": "^1.2.1" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "plugins/web/opentelemetry-instrumentation-page-view/node_modules/@opentelemetry/resources": { + "version": "1.25.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-1.25.1.tgz", + "integrity": "sha512-pkZT+iFYIZsVn6+GzM0kSX+u3MSLCY9md+lIJOoKl/P+gJFfxJte/60Usdp8Ce4rOs8GduUpSPNe1ddGyDT1sQ==", + "dev": true, + "dependencies": { + "@opentelemetry/core": "1.25.1", + "@opentelemetry/semantic-conventions": "1.25.1" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "plugins/web/opentelemetry-instrumentation-page-view/node_modules/@opentelemetry/sdk-logs": { + "version": "0.52.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-logs/-/sdk-logs-0.52.1.tgz", + "integrity": "sha512-MBYh+WcPPsN8YpRHRmK1Hsca9pVlyyKd4BxOC4SsgHACnl/bPp4Cri9hWhVm5+2tiQ9Zf4qSc1Jshw9tOLGWQA==", + "dev": true, + "dependencies": { + "@opentelemetry/api-logs": "0.52.1", + "@opentelemetry/core": "1.25.1", + "@opentelemetry/resources": "1.25.1" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.4.0 <1.10.0" + } + }, + "plugins/web/opentelemetry-instrumentation-page-view/node_modules/@opentelemetry/semantic-conventions": { + "version": "1.25.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.25.1.tgz", + "integrity": "sha512-ZDjMJJQRlyk8A1KZFCc+bCbsyrn1wTwdNt56F7twdfUfnHUZUq77/WfONCj8p72NZOyP7pNTdUWSTYC3GTbuuQ==", + "engines": { + "node": ">=14" + } + }, + "plugins/web/opentelemetry-instrumentation-page-view/node_modules/@sinonjs/commons": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.1.tgz", + "integrity": "sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==", + "dev": true, + "dependencies": { + "type-detect": "4.0.8" + } + }, + "plugins/web/opentelemetry-instrumentation-page-view/node_modules/@types/sinon": { + "version": "10.0.18", + "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-10.0.18.tgz", + "integrity": "sha512-OpQC9ug8BcnNxue2WF5aTruMaDRFn6NyfaE4DmAKOlQMn54b7CnCvDFV3wj5fk/HbSSTYmOYs2bTb5ShANjyQg==", + "dev": true, + "dependencies": { + "@types/sinonjs__fake-timers": "*" + } + }, + "plugins/web/opentelemetry-instrumentation-page-view/node_modules/diff": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz", + "integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, + "plugins/web/opentelemetry-instrumentation-page-view/node_modules/sinon": { + "version": "15.1.2", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-15.1.2.tgz", + "integrity": "sha512-uG1pU54Fis4EfYOPoEi13fmRHgZNg/u+3aReSEzHsN52Bpf+bMVfsBQS5MjouI+rTuG6UBIINlpuuO2Epr7SiA==", + "deprecated": "16.1.1", + "dev": true, + "dependencies": { + "@sinonjs/commons": "^3.0.0", + "@sinonjs/fake-timers": "^10.1.0", + "@sinonjs/samsam": "^8.0.0", + "diff": "^5.1.0", + "nise": "^5.1.4", + "supports-color": "^7.2.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/sinon" + } + }, + "plugins/web/opentelemetry-instrumentation-page-view/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "plugins/web/opentelemetry-instrumentation-user-interaction": { "name": "@opentelemetry/instrumentation-user-interaction", "version": "0.40.0", @@ -41169,35 +41464,6 @@ "node": ">=8" } }, - "plugins/web/opentelemetry-instrumentation-user-interaction/node_modules/source-map": { - "version": "0.7.4", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", - "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, - "plugins/web/opentelemetry-instrumentation-user-interaction/node_modules/ts-loader": { - "version": "9.5.1", - "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.5.1.tgz", - "integrity": "sha512-rNH3sK9kGZcH9dYzC7CewQm4NtxJTjSEVRJ2DyBZR7f8/wcta+iV44UPCXc5+nzDzivKtlzV6c9P4e+oFhDLYg==", - "dev": true, - "dependencies": { - "chalk": "^4.1.0", - "enhanced-resolve": "^5.0.0", - "micromatch": "^4.0.0", - "semver": "^7.3.4", - "source-map": "^0.7.4" - }, - "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "typescript": "*", - "webpack": "^5.0.0" - } - }, "plugins/web/opentelemetry-instrumentation-user-interaction/node_modules/yargs": { "version": "16.2.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", @@ -41694,35 +41960,6 @@ "node": ">=8" } }, - "plugins/web/opentelemetry-plugin-react-load/node_modules/source-map": { - "version": "0.7.4", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", - "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, - "plugins/web/opentelemetry-plugin-react-load/node_modules/ts-loader": { - "version": "9.5.1", - "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.5.1.tgz", - "integrity": "sha512-rNH3sK9kGZcH9dYzC7CewQm4NtxJTjSEVRJ2DyBZR7f8/wcta+iV44UPCXc5+nzDzivKtlzV6c9P4e+oFhDLYg==", - "dev": true, - "dependencies": { - "chalk": "^4.1.0", - "enhanced-resolve": "^5.0.0", - "micromatch": "^4.0.0", - "semver": "^7.3.4", - "source-map": "^0.7.4" - }, - "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "typescript": "*", - "webpack": "^5.0.0" - } - }, "plugins/web/opentelemetry-plugin-react-load/node_modules/yargs": { "version": "16.2.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", @@ -42188,35 +42425,6 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, - "propagators/opentelemetry-propagator-instana/node_modules/source-map": { - "version": "0.7.4", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", - "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, - "propagators/opentelemetry-propagator-instana/node_modules/ts-loader": { - "version": "9.5.1", - "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.5.1.tgz", - "integrity": "sha512-rNH3sK9kGZcH9dYzC7CewQm4NtxJTjSEVRJ2DyBZR7f8/wcta+iV44UPCXc5+nzDzivKtlzV6c9P4e+oFhDLYg==", - "dev": true, - "dependencies": { - "chalk": "^4.1.0", - "enhanced-resolve": "^5.0.0", - "micromatch": "^4.0.0", - "semver": "^7.3.4", - "source-map": "^0.7.4" - }, - "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "typescript": "*", - "webpack": "^5.0.0" - } - }, "propagators/opentelemetry-propagator-instana/node_modules/which": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", @@ -42710,35 +42918,6 @@ "node": ">=8" } }, - "propagators/opentelemetry-propagator-ot-trace/node_modules/source-map": { - "version": "0.7.4", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", - "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, - "propagators/opentelemetry-propagator-ot-trace/node_modules/ts-loader": { - "version": "9.5.1", - "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.5.1.tgz", - "integrity": "sha512-rNH3sK9kGZcH9dYzC7CewQm4NtxJTjSEVRJ2DyBZR7f8/wcta+iV44UPCXc5+nzDzivKtlzV6c9P4e+oFhDLYg==", - "dev": true, - "dependencies": { - "chalk": "^4.1.0", - "enhanced-resolve": "^5.0.0", - "micromatch": "^4.0.0", - "semver": "^7.3.4", - "source-map": "^0.7.4" - }, - "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "typescript": "*", - "webpack": "^5.0.0" - } - }, "propagators/opentelemetry-propagator-ot-trace/node_modules/yargs": { "version": "16.2.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", @@ -50139,6 +50318,25 @@ "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.9.0.tgz", "integrity": "sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg==" }, + "@opentelemetry/api-events": { + "version": "0.52.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/api-events/-/api-events-0.52.1.tgz", + "integrity": "sha512-+0cSqUigzpYvpCRdXPSnGs1ZomxSR1CzoqEnEfqlke20nm//ZEmhs0WEaT5oJWByYvQqENW3zUTslPnordk82w==", + "requires": { + "@opentelemetry/api": "^1.0.0", + "@opentelemetry/api-logs": "0.52.1" + }, + "dependencies": { + "@opentelemetry/api-logs": { + "version": "0.52.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/api-logs/-/api-logs-0.52.1.tgz", + "integrity": "sha512-qnSqB2DQ9TPP96dl8cDubDvrUyWc0/sK81xHTK8eSUspzDM3bsewX903qclQFvVhgStjRWdC5bLb3kQqMkfV5A==", + "requires": { + "@opentelemetry/api": "^1.0.0" + } + } + } + }, "@opentelemetry/api-logs": { "version": "0.53.0", "resolved": "https://registry.npmjs.org/@opentelemetry/api-logs/-/api-logs-0.53.0.tgz", @@ -50591,25 +50789,6 @@ } } }, - "source-map": { - "version": "0.7.4", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", - "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", - "dev": true - }, - "ts-loader": { - "version": "9.5.1", - "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.5.1.tgz", - "integrity": "sha512-rNH3sK9kGZcH9dYzC7CewQm4NtxJTjSEVRJ2DyBZR7f8/wcta+iV44UPCXc5+nzDzivKtlzV6c9P4e+oFhDLYg==", - "dev": true, - "requires": { - "chalk": "^4.1.0", - "enhanced-resolve": "^5.0.0", - "micromatch": "^4.0.0", - "semver": "^7.3.4", - "source-map": "^0.7.4" - } - }, "yargs": { "version": "16.2.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", @@ -51193,25 +51372,6 @@ } } }, - "source-map": { - "version": "0.7.4", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", - "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", - "dev": true - }, - "ts-loader": { - "version": "9.5.1", - "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.5.1.tgz", - "integrity": "sha512-rNH3sK9kGZcH9dYzC7CewQm4NtxJTjSEVRJ2DyBZR7f8/wcta+iV44UPCXc5+nzDzivKtlzV6c9P4e+oFhDLYg==", - "dev": true, - "requires": { - "chalk": "^4.1.0", - "enhanced-resolve": "^5.0.0", - "micromatch": "^4.0.0", - "semver": "^7.3.4", - "source-map": "^0.7.4" - } - }, "yargs": { "version": "16.2.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", @@ -52341,25 +52501,6 @@ } } }, - "source-map": { - "version": "0.7.4", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", - "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", - "dev": true - }, - "ts-loader": { - "version": "9.5.1", - "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.5.1.tgz", - "integrity": "sha512-rNH3sK9kGZcH9dYzC7CewQm4NtxJTjSEVRJ2DyBZR7f8/wcta+iV44UPCXc5+nzDzivKtlzV6c9P4e+oFhDLYg==", - "dev": true, - "requires": { - "chalk": "^4.1.0", - "enhanced-resolve": "^5.0.0", - "micromatch": "^4.0.0", - "semver": "^7.3.4", - "source-map": "^0.7.4" - } - }, "yargs": { "version": "16.2.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", @@ -52771,6 +52912,137 @@ } } }, + "@opentelemetry/instrumentation-page-view": { + "version": "file:plugins/web/opentelemetry-instrumentation-page-view", + "requires": { + "@babel/core": "7.22.17", + "@jsdevtools/coverage-istanbul-loader": "3.0.5", + "@opentelemetry/api": "^1.3.0", + "@opentelemetry/api-events": "^0.52.1", + "@opentelemetry/api-logs": "^0.52.1", + "@opentelemetry/core": "^1.8.0", + "@opentelemetry/instrumentation": "^0.52.1", + "@opentelemetry/sdk-events": "^0.52.1", + "@opentelemetry/sdk-logs": "^0.52.1", + "@types/node": "18.6.5", + "@types/sinon": "10.0.18", + "karma": "6.4.4", + "karma-chrome-launcher": "3.1.0", + "karma-coverage": "2.2.1", + "karma-jquery": "0.2.4", + "karma-mocha": "2.0.1", + "karma-spec-reporter": "0.0.36", + "karma-webpack": "5.0.1", + "sinon": "15.1.2", + "ts-loader": "9.5.1", + "ts-mocha": "10.0.0", + "typescript": "4.4.4" + }, + "dependencies": { + "@opentelemetry/api-logs": { + "version": "0.52.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/api-logs/-/api-logs-0.52.1.tgz", + "integrity": "sha512-qnSqB2DQ9TPP96dl8cDubDvrUyWc0/sK81xHTK8eSUspzDM3bsewX903qclQFvVhgStjRWdC5bLb3kQqMkfV5A==", + "requires": { + "@opentelemetry/api": "^1.0.0" + } + }, + "@opentelemetry/core": { + "version": "1.25.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.25.1.tgz", + "integrity": "sha512-GeT/l6rBYWVQ4XArluLVB6WWQ8flHbdb6r2FCHC3smtdOAbrJBIv35tpV/yp9bmYUJf+xmZpu9DRTIeJVhFbEQ==", + "requires": { + "@opentelemetry/semantic-conventions": "1.25.1" + } + }, + "@opentelemetry/instrumentation": { + "version": "0.52.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation/-/instrumentation-0.52.1.tgz", + "integrity": "sha512-uXJbYU/5/MBHjMp1FqrILLRuiJCs3Ofk0MeRDk8g1S1gD47U8X3JnSwcMO1rtRo1x1a7zKaQHaoYu49p/4eSKw==", + "requires": { + "@opentelemetry/api-logs": "0.52.1", + "@types/shimmer": "^1.0.2", + "import-in-the-middle": "^1.8.1", + "require-in-the-middle": "^7.1.1", + "semver": "^7.5.2", + "shimmer": "^1.2.1" + } + }, + "@opentelemetry/resources": { + "version": "1.25.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-1.25.1.tgz", + "integrity": "sha512-pkZT+iFYIZsVn6+GzM0kSX+u3MSLCY9md+lIJOoKl/P+gJFfxJte/60Usdp8Ce4rOs8GduUpSPNe1ddGyDT1sQ==", + "dev": true, + "requires": { + "@opentelemetry/core": "1.25.1", + "@opentelemetry/semantic-conventions": "1.25.1" + } + }, + "@opentelemetry/sdk-logs": { + "version": "0.52.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-logs/-/sdk-logs-0.52.1.tgz", + "integrity": "sha512-MBYh+WcPPsN8YpRHRmK1Hsca9pVlyyKd4BxOC4SsgHACnl/bPp4Cri9hWhVm5+2tiQ9Zf4qSc1Jshw9tOLGWQA==", + "dev": true, + "requires": { + "@opentelemetry/api-logs": "0.52.1", + "@opentelemetry/core": "1.25.1", + "@opentelemetry/resources": "1.25.1" + } + }, + "@opentelemetry/semantic-conventions": { + "version": "1.25.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.25.1.tgz", + "integrity": "sha512-ZDjMJJQRlyk8A1KZFCc+bCbsyrn1wTwdNt56F7twdfUfnHUZUq77/WfONCj8p72NZOyP7pNTdUWSTYC3GTbuuQ==" + }, + "@sinonjs/commons": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.1.tgz", + "integrity": "sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==", + "dev": true, + "requires": { + "type-detect": "4.0.8" + } + }, + "@types/sinon": { + "version": "10.0.18", + "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-10.0.18.tgz", + "integrity": "sha512-OpQC9ug8BcnNxue2WF5aTruMaDRFn6NyfaE4DmAKOlQMn54b7CnCvDFV3wj5fk/HbSSTYmOYs2bTb5ShANjyQg==", + "dev": true, + "requires": { + "@types/sinonjs__fake-timers": "*" + } + }, + "diff": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz", + "integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==", + "dev": true + }, + "sinon": { + "version": "15.1.2", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-15.1.2.tgz", + "integrity": "sha512-uG1pU54Fis4EfYOPoEi13fmRHgZNg/u+3aReSEzHsN52Bpf+bMVfsBQS5MjouI+rTuG6UBIINlpuuO2Epr7SiA==", + "dev": true, + "requires": { + "@sinonjs/commons": "^3.0.0", + "@sinonjs/fake-timers": "^10.1.0", + "@sinonjs/samsam": "^8.0.0", + "diff": "^5.1.0", + "nise": "^5.1.4", + "supports-color": "^7.2.0" + } + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, "@opentelemetry/instrumentation-pg": { "version": "file:plugins/node/opentelemetry-instrumentation-pg", "requires": { @@ -53740,25 +54012,6 @@ } } }, - "source-map": { - "version": "0.7.4", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", - "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", - "dev": true - }, - "ts-loader": { - "version": "9.5.1", - "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.5.1.tgz", - "integrity": "sha512-rNH3sK9kGZcH9dYzC7CewQm4NtxJTjSEVRJ2DyBZR7f8/wcta+iV44UPCXc5+nzDzivKtlzV6c9P4e+oFhDLYg==", - "dev": true, - "requires": { - "chalk": "^4.1.0", - "enhanced-resolve": "^5.0.0", - "micromatch": "^4.0.0", - "semver": "^7.3.4", - "source-map": "^0.7.4" - } - }, "yargs": { "version": "16.2.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", @@ -54214,25 +54467,6 @@ } } }, - "source-map": { - "version": "0.7.4", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", - "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", - "dev": true - }, - "ts-loader": { - "version": "9.5.1", - "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.5.1.tgz", - "integrity": "sha512-rNH3sK9kGZcH9dYzC7CewQm4NtxJTjSEVRJ2DyBZR7f8/wcta+iV44UPCXc5+nzDzivKtlzV6c9P4e+oFhDLYg==", - "dev": true, - "requires": { - "chalk": "^4.1.0", - "enhanced-resolve": "^5.0.0", - "micromatch": "^4.0.0", - "semver": "^7.3.4", - "source-map": "^0.7.4" - } - }, "yargs": { "version": "16.2.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", @@ -54620,25 +54854,6 @@ "integrity": "sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==", "dev": true }, - "source-map": { - "version": "0.7.4", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", - "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", - "dev": true - }, - "ts-loader": { - "version": "9.5.1", - "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.5.1.tgz", - "integrity": "sha512-rNH3sK9kGZcH9dYzC7CewQm4NtxJTjSEVRJ2DyBZR7f8/wcta+iV44UPCXc5+nzDzivKtlzV6c9P4e+oFhDLYg==", - "dev": true, - "requires": { - "chalk": "^4.1.0", - "enhanced-resolve": "^5.0.0", - "micromatch": "^4.0.0", - "semver": "^7.3.4", - "source-map": "^0.7.4" - } - }, "which": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", @@ -55018,25 +55233,6 @@ } } }, - "source-map": { - "version": "0.7.4", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", - "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", - "dev": true - }, - "ts-loader": { - "version": "9.5.1", - "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.5.1.tgz", - "integrity": "sha512-rNH3sK9kGZcH9dYzC7CewQm4NtxJTjSEVRJ2DyBZR7f8/wcta+iV44UPCXc5+nzDzivKtlzV6c9P4e+oFhDLYg==", - "dev": true, - "requires": { - "chalk": "^4.1.0", - "enhanced-resolve": "^5.0.0", - "micromatch": "^4.0.0", - "semver": "^7.3.4", - "source-map": "^0.7.4" - } - }, "yargs": { "version": "16.2.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", @@ -55357,6 +55553,64 @@ "@opentelemetry/semantic-conventions": "1.27.0" } }, + "@opentelemetry/sdk-events": { + "version": "0.52.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-events/-/sdk-events-0.52.1.tgz", + "integrity": "sha512-1CHx56QOltNg3Zwvi812uCmDVfNB1faVOXazf5pqmAX1Ys09Mu50D4ntDb5SZ6GDV8FNilHBtv5WkpZNzeXLdQ==", + "dev": true, + "requires": { + "@opentelemetry/api-events": "0.52.1", + "@opentelemetry/api-logs": "0.52.1", + "@opentelemetry/sdk-logs": "0.52.1" + }, + "dependencies": { + "@opentelemetry/api-logs": { + "version": "0.52.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/api-logs/-/api-logs-0.52.1.tgz", + "integrity": "sha512-qnSqB2DQ9TPP96dl8cDubDvrUyWc0/sK81xHTK8eSUspzDM3bsewX903qclQFvVhgStjRWdC5bLb3kQqMkfV5A==", + "dev": true, + "requires": { + "@opentelemetry/api": "^1.0.0" + } + }, + "@opentelemetry/core": { + "version": "1.25.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.25.1.tgz", + "integrity": "sha512-GeT/l6rBYWVQ4XArluLVB6WWQ8flHbdb6r2FCHC3smtdOAbrJBIv35tpV/yp9bmYUJf+xmZpu9DRTIeJVhFbEQ==", + "dev": true, + "requires": { + "@opentelemetry/semantic-conventions": "1.25.1" + } + }, + "@opentelemetry/resources": { + "version": "1.25.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-1.25.1.tgz", + "integrity": "sha512-pkZT+iFYIZsVn6+GzM0kSX+u3MSLCY9md+lIJOoKl/P+gJFfxJte/60Usdp8Ce4rOs8GduUpSPNe1ddGyDT1sQ==", + "dev": true, + "requires": { + "@opentelemetry/core": "1.25.1", + "@opentelemetry/semantic-conventions": "1.25.1" + } + }, + "@opentelemetry/sdk-logs": { + "version": "0.52.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-logs/-/sdk-logs-0.52.1.tgz", + "integrity": "sha512-MBYh+WcPPsN8YpRHRmK1Hsca9pVlyyKd4BxOC4SsgHACnl/bPp4Cri9hWhVm5+2tiQ9Zf4qSc1Jshw9tOLGWQA==", + "dev": true, + "requires": { + "@opentelemetry/api-logs": "0.52.1", + "@opentelemetry/core": "1.25.1", + "@opentelemetry/resources": "1.25.1" + } + }, + "@opentelemetry/semantic-conventions": { + "version": "1.25.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.25.1.tgz", + "integrity": "sha512-ZDjMJJQRlyk8A1KZFCc+bCbsyrn1wTwdNt56F7twdfUfnHUZUq77/WfONCj8p72NZOyP7pNTdUWSTYC3GTbuuQ==", + "dev": true + } + } + }, "@opentelemetry/sdk-logs": { "version": "0.53.0", "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-logs/-/sdk-logs-0.53.0.tgz", @@ -57162,8 +57416,7 @@ "@types/shimmer": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@types/shimmer/-/shimmer-1.0.3.tgz", - "integrity": "sha512-F/IjUGnV6pIN7R4ZV4npHJVoNtaLZWvb+2/9gctxjb99wkpI7Ozg8VPogwDiTRyjLwZXAYxjvdg1KS8LTHKdDA==", - "dev": true + "integrity": "sha512-F/IjUGnV6pIN7R4ZV4npHJVoNtaLZWvb+2/9gctxjb99wkpI7Ozg8VPogwDiTRyjLwZXAYxjvdg1KS8LTHKdDA==" }, "@types/sinon": { "version": "10.0.20", @@ -74519,6 +74772,70 @@ "resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.4.1.tgz", "integrity": "sha512-aZbgViZrg1QNcG+LULa7nhZpJTZSLm/mXnHXnbAbjmN5aSa0y7V+wvv6+4WaBtpISJzThKy+PIPxc1Nq1EJ9mg==" }, + "ts-loader": { + "version": "9.5.1", + "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.5.1.tgz", + "integrity": "sha512-rNH3sK9kGZcH9dYzC7CewQm4NtxJTjSEVRJ2DyBZR7f8/wcta+iV44UPCXc5+nzDzivKtlzV6c9P4e+oFhDLYg==", + "dev": true, + "requires": { + "chalk": "^4.1.0", + "enhanced-resolve": "^5.0.0", + "micromatch": "^4.0.0", + "semver": "^7.3.4", + "source-map": "^0.7.4" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "source-map": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", + "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, "ts-mocha": { "version": "10.0.0", "resolved": "https://registry.npmjs.org/ts-mocha/-/ts-mocha-10.0.0.tgz", diff --git a/plugins/web/opentelemetry-instrumentation-page-view/.eslintignore b/plugins/web/opentelemetry-instrumentation-page-view/.eslintignore new file mode 100644 index 0000000000..378eac25d3 --- /dev/null +++ b/plugins/web/opentelemetry-instrumentation-page-view/.eslintignore @@ -0,0 +1 @@ +build diff --git a/plugins/web/opentelemetry-instrumentation-page-view/.eslintrc.js b/plugins/web/opentelemetry-instrumentation-page-view/.eslintrc.js new file mode 100644 index 0000000000..6ad6c9f216 --- /dev/null +++ b/plugins/web/opentelemetry-instrumentation-page-view/.eslintrc.js @@ -0,0 +1,9 @@ +module.exports = { + "env": { + "mocha": true, + "commonjs": true, + "browser": true, + "jquery": true + }, + ...require('../../../eslint.config.js') +} diff --git a/plugins/web/opentelemetry-instrumentation-page-view/LICENSE b/plugins/web/opentelemetry-instrumentation-page-view/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/plugins/web/opentelemetry-instrumentation-page-view/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/plugins/web/opentelemetry-instrumentation-page-view/README.md b/plugins/web/opentelemetry-instrumentation-page-view/README.md new file mode 100644 index 0000000000..3e61d04b33 --- /dev/null +++ b/plugins/web/opentelemetry-instrumentation-page-view/README.md @@ -0,0 +1,84 @@ +# OpenTelemetry Instrumentation Page View + +[![NPM Published Version][npm-img]][npm-url] +[![Apache License][license-image]][license-image] + +This module provides automatic instrumentation for *page view* for Web applications. It uses the events sdk to create a page view event and sends it to the configured log processor. The page view event is created when the page is loaded or a route change occurs. +The event contains the following attributes: + +- `name`: The name of the page view event. +- `timestamp`: The timestamp of the event. +- `data`: The data of the event. The data contains the following attributes: + - `location`: The location of the page. + - `referrer`: The referrer of the page. + - `title`: The title of the page. + - `url`: The url of the page. + - `type`: The type of the page, either `page-load(base_page)` or `route-change(virtual_page)`. + - `customAttributes`: The custom attributes added to the event. The custom attributes are added by the user. +Compatible with OpenTelemetry JS API and SDK `1.0+`. + +## Installation + +```bash +npm install --save @opentelemetry/instrumentation-page-view +``` + +## Usage + +```js +import { events } from '@opentelemetry/api-events'; +import { EventLoggerProvider } from '@opentelemetry/sdk-events'; +import { ConsoleLogRecordExporter, SimpleLogRecordProcessor, LoggerProvider } from '@opentelemetry/sdk-logs'; +import { PageViewInstrumentation } from '@opentelemetry/instrumentation-page-view'; +import { registerInstrumentations } from '@opentelemetry/instrumentation'; + +const loggerProvider = new LoggerProvider({resource: new Resource({[SEMRESATTRS_SERVICE_NAME]: ''})}); +loggerProvider.addLogRecordProcessor(new SimpleLogRecordProcessor(new ConsoleLogRecordExporter())); +const eventLoggerProvider = new EventLoggerProvider(loggerProvider); +events.setGlobalEventLoggerProvider(eventLoggerProvider); + +registerInstrumentations({ + instrumentations : [ + new PageViewInstrumentation() + ], +}); + +``` + + +## Optional : Add custom attributes to events if needed + +If it is needed to add custom data to the page view event, the following function needs to be provided +as a config to the Page View Event Instrumentation as shown below. The attributes will be added to the event data. If the function throws an error , no attributes will be added to the event. +the rest of the process continues. + +```js +const addCustomDataToEvent = (event: Event) => { + event.data[''] = ''; +} + +registerInstrumentations({ + instrumentations: [ + new PageViewEventInstrumentation({ + applyCustomEventData:addCustomDataToEvent + }) + ] +}) +``` + +## Useful links + +- For more information on OpenTelemetry, visit: +- For more about OpenTelemetry JavaScript: +- For help or feedback on this project, join us in [GitHub Discussions][discussions-url] + +## License + +Apache 2.0 - See [LICENSE][license-url] for more information. + +[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions +[license-url]: https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/LICENSE +[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat +[npm-url]: https://www.npmjs.com/package/@opentelemetry/instrumentation-page-view +[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Finstrumentation-page-view.svg + diff --git a/plugins/web/opentelemetry-instrumentation-page-view/karma.conf.js b/plugins/web/opentelemetry-instrumentation-page-view/karma.conf.js new file mode 100644 index 0000000000..4a4bd49791 --- /dev/null +++ b/plugins/web/opentelemetry-instrumentation-page-view/karma.conf.js @@ -0,0 +1,25 @@ +/*! + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const karmaWebpackConfig = require('../../../karma.webpack'); +const karmaBaseConfig = require('../../../karma.base'); + +module.exports = (config) => { + config.set(Object.assign({}, karmaBaseConfig, { + frameworks: karmaBaseConfig.frameworks.concat(['jquery-1.8.3']), + webpack: karmaWebpackConfig, + })) +}; diff --git a/plugins/web/opentelemetry-instrumentation-page-view/package.json b/plugins/web/opentelemetry-instrumentation-page-view/package.json new file mode 100644 index 0000000000..9772d6cf98 --- /dev/null +++ b/plugins/web/opentelemetry-instrumentation-page-view/package.json @@ -0,0 +1,81 @@ +{ + "name": "@opentelemetry/instrumentation-page-view", + "version": "0.39.0", + "description": "OpenTelemetry instrumentation for page view operations in browser applications", + "main": "build/src/index.js", + "module": "build/esm/index.js", + "esnext": "build/esnext/index.js", + "types": "build/src/index.d.ts", + "repository": "open-telemetry/opentelemetry-js-contrib", + "scripts": { + "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json tsconfig.esnext.json", + "lint": "eslint . --ext .ts", + "lint:fix": "eslint . --ext .ts --fix", + "lint:readme": "node ../../../scripts/lint-readme.js", + "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-page-view --include-dependencies", + "prewatch": "npm run precompile", + "version:update": "node ../../../scripts/version-update.js", + "compile": "tsc --build tsconfig.json tsconfig.esm.json tsconfig.esnext.json", + "prepublishOnly": "npm run compile", + "tdd": "wtr --watch", + "test:browser": "karma start --single-run", + "watch": "tsc --build -watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json" + }, + "keywords": [ + "opentelemetry", + "page-view", + "web", + "tracing", + "profiling", + "plugin" + ], + "author": "OpenTelemetry Authors", + "license": "Apache-2.0", + "engines": { + "node": ">=14" + }, + "files": [ + "build/esm/**/*.js", + "build/esm/**/*.map", + "build/esm/**/*.d.ts", + "build/esnext/**/*.js", + "build/esnext/**/*.map", + "build/esnext/**/*.d.ts", + "build/src/**/*.js", + "build/src/**/*.map", + "build/src/**/*.d.ts" + ], + "publishConfig": { + "access": "public" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + }, + "devDependencies": { + "@babel/core": "7.22.17", + "@jsdevtools/coverage-istanbul-loader": "3.0.5", + "@opentelemetry/api": "^1.3.0", + "@opentelemetry/api-logs": "^0.52.1", + "@opentelemetry/sdk-events": "^0.52.1", + "@opentelemetry/sdk-logs": "^0.52.1", + "@types/node": "18.6.5", + "@types/sinon": "10.0.18", + "karma": "6.4.4", + "karma-chrome-launcher": "3.1.0", + "karma-coverage": "2.2.1", + "karma-jquery": "0.2.4", + "karma-mocha": "2.0.1", + "karma-spec-reporter": "0.0.36", + "karma-webpack": "5.0.1", + "sinon": "15.1.2", + "ts-loader": "9.5.1", + "ts-mocha": "10.0.0", + "typescript": "4.4.4" + }, + "dependencies": { + "@opentelemetry/api-events": "^0.52.1", + "@opentelemetry/core": "^1.8.0", + "@opentelemetry/instrumentation": "^0.52.1" + }, + "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/web/opentelemetry-instrumentation-page-view#readme" +} diff --git a/plugins/web/opentelemetry-instrumentation-page-view/src/enums/PageTypes.ts b/plugins/web/opentelemetry-instrumentation-page-view/src/enums/PageTypes.ts new file mode 100644 index 0000000000..596a4b806a --- /dev/null +++ b/plugins/web/opentelemetry-instrumentation-page-view/src/enums/PageTypes.ts @@ -0,0 +1,19 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export enum PageTypes { + BASE_PAGE, + VIRTUAL_PAGE, +} diff --git a/plugins/web/opentelemetry-instrumentation-page-view/src/index.ts b/plugins/web/opentelemetry-instrumentation-page-view/src/index.ts new file mode 100644 index 0000000000..1c290b36f2 --- /dev/null +++ b/plugins/web/opentelemetry-instrumentation-page-view/src/index.ts @@ -0,0 +1,19 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from './instrumentation'; +export * from './enums/PageTypes'; +export * from './types'; diff --git a/plugins/web/opentelemetry-instrumentation-page-view/src/instrumentation.ts b/plugins/web/opentelemetry-instrumentation-page-view/src/instrumentation.ts new file mode 100644 index 0000000000..53f8f5e025 --- /dev/null +++ b/plugins/web/opentelemetry-instrumentation-page-view/src/instrumentation.ts @@ -0,0 +1,174 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { InstrumentationBase, isWrapped } from '@opentelemetry/instrumentation'; +import { Event, events, EventLogger } from '@opentelemetry/api-events'; +import { PACKAGE_NAME, PACKAGE_VERSION } from './version'; +import { + ApplyCustomEventDataFunction, + PageViewInstrumentationConfig, +} from './types'; +import { PageTypes } from './enums/PageTypes'; +/** + * This class represents a page view instrumentation plugin + */ +const EVENT_NAME = 'browser.page_view'; +export class PageViewInstrumentation extends InstrumentationBase { + eventLogger: EventLogger | null = null; + oldUrl = location.href; + applyCustomEventData: ApplyCustomEventDataFunction | undefined = undefined; + + /** + * + * @param config + */ + constructor(config: PageViewInstrumentationConfig) { + super(PACKAGE_NAME, PACKAGE_VERSION, config); + this.eventLogger = events.getEventLogger(PACKAGE_NAME, PACKAGE_VERSION); + this.applyCustomEventData = config?.applyCustomEventData; + } + + init() {} + + /** + * callback to be executed when using hard navigation + */ + private _onPageView() { + const pageViewEvent: Event = { + name: EVENT_NAME, + data: { + url: document.documentURI as string, + referrer: document.referrer, + title: document.title, + type: PageTypes.BASE_PAGE, + }, + }; + this._applyCustomEventData(pageViewEvent, this.applyCustomEventData); + this.eventLogger?.emit(pageViewEvent); + } + + /** + * callback to be executed when using soft navigation + */ + private _onVirtualPageView(changeState: string | null | undefined) { + const title = document.title; + const referrer = this.oldUrl; + // Don't emit an event if the route didn't change + if (referrer === location.href) { + return; + } + const vPageViewEvent: Event = { + name: EVENT_NAME, + data: { + url: window.location.href, + title, + changeState: changeState || '', + referrer, + type: PageTypes.VIRTUAL_PAGE, + }, + }; + this._applyCustomEventData(vPageViewEvent, this.applyCustomEventData); + this.eventLogger?.emit(vPageViewEvent); + } + + public _seteventLogger(eventLogger: EventLogger) { + this.eventLogger = eventLogger; + } + + /** + * executes callback {_onDOMContentLoaded } when the page is viewed + */ + private _waitForPageLoad() { + document.addEventListener('DOMContentLoaded', this._onPageView.bind(this)); + } + + /** + * implements enable function + */ + override enable() { + this._patchHistoryApi(); + // remove previously attached load to avoid adding the same event twice + // in case of multiple enable calling. + document.removeEventListener( + 'DOMContentLoaded', + this._onPageView.bind(this) + ); + this._waitForPageLoad(); + } + + /** + * implements disable function + */ + override disable() { + this._unpatchHistoryApi(); + document.removeEventListener( + 'DOMContentLoaded', + this._onPageView.bind(this) + ); + } + + /** + * Patches the history api method + */ + _patchHistoryMethod(changeState: string) { + const plugin = this; + return (original: any) => { + return function patchHistoryMethod(this: History, ...args: unknown[]) { + const result = original.apply(this, args); + const url = location.href; + const oldUrl = plugin.oldUrl; + if (url !== oldUrl) { + plugin._onVirtualPageView(changeState); + plugin.oldUrl = location.href; + } + return result; + }; + }; + } + + private _patchHistoryApi(): void { + // unpatching here disables other instrumentation that use the same api to wrap history, commenting it out + // this._unpatchHistoryApi(); + this._wrap( + history, + 'replaceState', + this._patchHistoryMethod('replaceState') + ); + this._wrap(history, 'pushState', this._patchHistoryMethod('pushState')); + } + /** + * unpatch the history api methods + */ + _unpatchHistoryApi() { + if (isWrapped(history.replaceState)) this._unwrap(history, 'replaceState'); + if (isWrapped(history.pushState)) this._unwrap(history, 'pushState'); + } + + /** + * + * @param logRecord + * @param applyCustomEventData + * Add custom data to the event + */ + _applyCustomEventData( + event: Event, + applyCustomEventData: ApplyCustomEventDataFunction | undefined + ) { + if (applyCustomEventData) { + applyCustomEventData(event); + } + } +} diff --git a/plugins/web/opentelemetry-instrumentation-page-view/src/types.ts b/plugins/web/opentelemetry-instrumentation-page-view/src/types.ts new file mode 100644 index 0000000000..3296dd75b4 --- /dev/null +++ b/plugins/web/opentelemetry-instrumentation-page-view/src/types.ts @@ -0,0 +1,28 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { InstrumentationConfig } from '@opentelemetry/instrumentation'; +import { Event } from '@opentelemetry/api-events'; + +/** + * PageViewInstrumentationConfig + */ +export interface PageViewInstrumentationConfig extends InstrumentationConfig { + applyCustomEventData?: ApplyCustomEventDataFunction; +} + +export interface ApplyCustomEventDataFunction { + (event: Event): void; +} diff --git a/plugins/web/opentelemetry-instrumentation-page-view/test/index-webpack.ts b/plugins/web/opentelemetry-instrumentation-page-view/test/index-webpack.ts new file mode 100644 index 0000000000..061a48ccfa --- /dev/null +++ b/plugins/web/opentelemetry-instrumentation-page-view/test/index-webpack.ts @@ -0,0 +1,20 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +const testsContext = require.context('.', true, /test$/); +testsContext.keys().forEach(testsContext); + +const srcContext = require.context('.', true, /src$/); +srcContext.keys().forEach(srcContext); diff --git a/plugins/web/opentelemetry-instrumentation-page-view/test/pageView.test.ts b/plugins/web/opentelemetry-instrumentation-page-view/test/pageView.test.ts new file mode 100644 index 0000000000..2bc391b343 --- /dev/null +++ b/plugins/web/opentelemetry-instrumentation-page-view/test/pageView.test.ts @@ -0,0 +1,221 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { + LoggerProvider, + InMemoryLogRecordExporter, + SimpleLogRecordProcessor, + ReadableLogRecord, +} from '@opentelemetry/sdk-logs'; +import { EventLoggerProvider } from '@opentelemetry/sdk-events'; +import * as sinon from 'sinon'; +import { PageViewInstrumentation } from '../src'; +import { logs } from '@opentelemetry/api-logs'; +import { events } from '@opentelemetry/api-events'; +import { PageTypes } from '../src/enums/PageTypes'; +import * as assert from 'assert'; +import { registerInstrumentations } from '@opentelemetry/instrumentation'; + +describe('PageView Instrumentation', () => { + let plugin: PageViewInstrumentation; + const sandbox = sinon.createSandbox(); + + const exporter = new InMemoryLogRecordExporter(); + const provider = new LoggerProvider(); + const logRecordProcessor = new SimpleLogRecordProcessor(exporter); + provider.addLogRecordProcessor(logRecordProcessor); + logs.setGlobalLoggerProvider(provider); + events.setGlobalEventLoggerProvider(new EventLoggerProvider(provider)); + + afterEach(() => { + exporter.reset(); + plugin.disable(); + }); + + describe('constructor', () => { + it('should construct an instance', () => { + plugin = new PageViewInstrumentation({ + enabled: false, + }); + + assert.strictEqual(exporter.getFinishedLogRecords().length, 0); + assert.ok(plugin instanceof PageViewInstrumentation); + }); + }); + + describe('export page_view LogRecord', () => { + it("should export LogRecord for page_view event type 0 when 'DOMContentLoaded' event is fired", done => { + plugin = new PageViewInstrumentation({ + enabled: false, + }); + + const spy = sandbox.spy(document, 'addEventListener'); + // plugin.enable(); + registerInstrumentations({ instrumentations: [plugin] }); + + setTimeout(() => { + assert.ok(spy.calledOnce); + + document.dispatchEvent(new Event('DOMContentLoaded')); + + assert.strictEqual(exporter.getFinishedLogRecords().length, 1); + + const pageViewLogRecord = + exporter.getFinishedLogRecords()[0] as ReadableLogRecord; + assert.strictEqual( + pageViewLogRecord.attributes['event.name'], + 'browser.page_view' + ); + assert.deepEqual(pageViewLogRecord.body, { + type: PageTypes.BASE_PAGE, + url: document.documentURI as string, + referrer: document.referrer, + title: document.title, + }); + done(); + }); + }); + + it('should export LogRecord for page_view event type 1 when history.pushState() is called', done => { + const vpStartTime = 16842729000 * 1000000; + const referrer = location.href; + + plugin = new PageViewInstrumentation({ + enabled: true, + applyCustomEventData: event => { + if (event.data) { + (event.data as any)['vp.startTime'] = vpStartTime; + } + }, + }); + + history.pushState({}, '', '/dummy1.html'); + assert.strictEqual(exporter.getFinishedLogRecords().length, 1); + + const pageViewLogRecord = + exporter.getFinishedLogRecords()[0] as ReadableLogRecord; + assert.strictEqual( + pageViewLogRecord.attributes['event.name'], + 'browser.page_view' + ); + + assert.deepEqual(pageViewLogRecord.body, { + url: document.documentURI as string, + referrer: referrer, + title: document.title, + changeState: 'pushState', + 'vp.startTime': vpStartTime, + type: PageTypes.VIRTUAL_PAGE, + }); + done(); + }); + + it('should export LogRecord for page_view event type 1 when history.replaceState() is called', done => { + const vpStartTime = 16842729000 * 1000000; + const referrer = location.href; + + plugin = new PageViewInstrumentation({ + enabled: true, + applyCustomEventData: event => { + if (event.data) { + (event.data as any)['vp.startTime'] = vpStartTime; + } + }, + }); + + history.replaceState({}, '', '/dummy2.html'); + + assert.strictEqual(exporter.getFinishedLogRecords().length, 1); + + const pageViewLogRecord = + exporter.getFinishedLogRecords()[0] as ReadableLogRecord; + assert.strictEqual( + pageViewLogRecord.attributes['event.name'], + 'browser.page_view' + ); + + assert.deepEqual(pageViewLogRecord.body, { + url: document.documentURI as string, + referrer: referrer, + title: document.title, + changeState: 'replaceState', + 'vp.startTime': vpStartTime, + type: PageTypes.VIRTUAL_PAGE, + }); + done(); + }); + + it('should not export LogRecord for page_view event type 1 if the referrer is not changed.', done => { + const vpStartTime = 16842729000 * 1000000; + + plugin = new PageViewInstrumentation({ + enabled: true, + applyCustomEventData: event => { + if (event.data) { + (event.data as any)['vp.startTime'] = vpStartTime; + } + }, + }); + + const firstReferrer = location.href; + history.pushState({}, '', '/dummy3.html'); + assert.strictEqual(exporter.getFinishedLogRecords().length, 1); + + const pageViewLogRecord = + exporter.getFinishedLogRecords()[0] as ReadableLogRecord; + assert.strictEqual( + pageViewLogRecord.attributes['event.name'], + 'browser.page_view' + ); + + assert.deepEqual(pageViewLogRecord.body, { + url: document.documentURI as string, + referrer: firstReferrer, + title: document.title, + changeState: 'pushState', + 'vp.startTime': vpStartTime, + type: PageTypes.VIRTUAL_PAGE, + }); + + const secondReferrer = location.href; + history.pushState({}, '', '/dummy3.html'); + assert.strictEqual(exporter.getFinishedLogRecords().length, 1); + + const pageViewLogRecord2 = + exporter.getFinishedLogRecords()[0] as ReadableLogRecord; + + assert.strictEqual( + pageViewLogRecord2.attributes['event.name'], + 'browser.page_view' + ); + + assert.deepEqual(pageViewLogRecord2.body, { + url: document.documentURI as string, + referrer: firstReferrer, + title: document.title, + changeState: 'pushState', + 'vp.startTime': vpStartTime, + type: PageTypes.VIRTUAL_PAGE, + }); + + assert.notStrictEqual( + (pageViewLogRecord2.body)['referrer'], + secondReferrer + ); + done(); + }); + }); +}); diff --git a/plugins/web/opentelemetry-instrumentation-page-view/tsconfig.esm.json b/plugins/web/opentelemetry-instrumentation-page-view/tsconfig.esm.json new file mode 100644 index 0000000000..379f547a46 --- /dev/null +++ b/plugins/web/opentelemetry-instrumentation-page-view/tsconfig.esm.json @@ -0,0 +1,11 @@ +{ + "extends": "../../../tsconfig.base.esm.json", + "compilerOptions": { + "rootDir": "src", + "outDir": "build/esm", + "tsBuildInfoFile": "build/esm/tsconfig.esm.tsbuildinfo" + }, + "include": [ + "src/**/*.ts" + ] +} diff --git a/plugins/web/opentelemetry-instrumentation-page-view/tsconfig.esnext.json b/plugins/web/opentelemetry-instrumentation-page-view/tsconfig.esnext.json new file mode 100644 index 0000000000..cb78dd6ff3 --- /dev/null +++ b/plugins/web/opentelemetry-instrumentation-page-view/tsconfig.esnext.json @@ -0,0 +1,11 @@ +{ + "extends": "../../../tsconfig.base.esnext.json", + "compilerOptions": { + "rootDir": "src", + "outDir": "build/esnext", + "tsBuildInfoFile": "build/esnext/tsconfig.esnext.tsbuildinfo" + }, + "include": [ + "src/**/*.ts" + ] +} diff --git a/plugins/web/opentelemetry-instrumentation-page-view/tsconfig.json b/plugins/web/opentelemetry-instrumentation-page-view/tsconfig.json new file mode 100644 index 0000000000..28be80d266 --- /dev/null +++ b/plugins/web/opentelemetry-instrumentation-page-view/tsconfig.json @@ -0,0 +1,11 @@ +{ + "extends": "../../../tsconfig.base", + "compilerOptions": { + "rootDir": ".", + "outDir": "build" + }, + "include": [ + "src/**/*.ts", + "test/**/*.ts" + ] +} diff --git a/plugins/web/opentelemetry-instrumentation-page-view/web-test-runner.config.mjs b/plugins/web/opentelemetry-instrumentation-page-view/web-test-runner.config.mjs new file mode 100644 index 0000000000..0cf5849105 --- /dev/null +++ b/plugins/web/opentelemetry-instrumentation-page-view/web-test-runner.config.mjs @@ -0,0 +1,45 @@ +/*! + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { nodeResolve as nodeResolveRollup } from '@rollup/plugin-node-resolve'; +import commonjsRollup from '@rollup/plugin-commonjs'; +import { esbuildPlugin } from '@web/dev-server-esbuild'; +import { fromRollup } from '@web/dev-server-rollup'; +import { chromeLauncher } from '@web/test-runner'; + +const nodeResolve = fromRollup(nodeResolveRollup); +const commonjs = fromRollup(commonjsRollup); + +export default { + files: ['test/**/*.test.ts'], + browsers: [chromeLauncher({ launchOptions: { args: ['--no-sandbox'] } })], + plugins: [ + esbuildPlugin({ ts: true }), + nodeResolve({ + browser: true, + preferBuiltins: false, + modulePaths: ['node_modules','../../../node_modules'], + }), + commonjs({ + extensions: ['.js', '.ts'], + include: [/node_modules/], + }), + ], + preserveSymlinks: true, + logLevel: 'debug', +}; + + diff --git a/release-please-config.json b/release-please-config.json index b8fb45cd90..c9a217c410 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -67,6 +67,7 @@ "plugins/web/opentelemetry-instrumentation-user-interaction": {}, "plugins/web/opentelemetry-plugin-react-load": {}, "propagators/opentelemetry-propagator-instana": {}, - "propagators/opentelemetry-propagator-ot-trace": {} + "propagators/opentelemetry-propagator-ot-trace": {}, + "plugins/web/opentelemetry-instrumentation-page-view": {} + } } -}