Skip to content

Commit 8a44d3b

Browse files
authored
Add browser-detector plugin (#52)
* add browser detector * update spanProcessing * add configuration option * update README * fix README
1 parent 5253e4f commit 8a44d3b

7 files changed

Lines changed: 126 additions & 96 deletions

File tree

README.md

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ A list of OpenTelemetry instrumentation and non-instrumentation plugins that are
3838
* [@opentelemetry/instrumentation-fetch](https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation-fetch)
3939
* [@opentelemetry/instrumentation-document-load](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/web/opentelemetry-instrumentation-document-load)
4040
* [@opentelemetry/instrumentation-user-interaction](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/web/opentelemetry-instrumentation-user-interaction)
41+
* [@opentelemetry/browser-detector](https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-browser-detector)
4142

4243
## Setup
4344

@@ -103,7 +104,8 @@ BOOMR.init({
103104
instrument_fetch: true,
104105
instrument_xhr: true,
105106
instrument_document_load: true,
106-
instrument_user_interaction: true
107+
instrument_user_interaction: true,
108+
browser_detector: true
107109
},
108110
// Additional instrumentation config, which will be applied to all plugins
109111
global_instrumentation: {
@@ -130,27 +132,28 @@ BOOMR.init({
130132
```
131133
Available options are:
132134

133-
| Option | Description | Default value |
134-
|-------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
135-
| `samplingRate` | Sampling rate to use when collecting spans. Value must be between `0` and `1`. | `1` |
136-
| `corsUrls` | Array of CORS URLs to take into consideration when propagating trace information. By default, CORS URLs are excluded from the propagation. | `[]` |
137-
| `collectorConfiguration` | Object that defines the OpenTelemetry collector configuration, like the URL to send spans to. See [OTLPExporterNodeConfigBase](https://www.npmjs.com/package/@opentelemetry/exporter-trace-otlp-http) interface for all options. | `undefined` |
138-
| `consoleOnly` | If `true` spans will be logged on the console and not sent to the collector endpoint. | `false` |
139-
| `plugins` | Object for enabling and disabling OpenTelemetry plugins. | |
140-
| `plugins.instrument_fetch` | Enabling the [OpenTelemetry plugin](https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation-fetch) for instrumentation of the fetch API. This will only be used in case the `fetch` API exists. | `true` |
141-
| `plugins.instrument_xhr` | Enabling the [OpenTelemetry plugin](https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation-xml-http-request) for instrumentation of the XMLHttpRequest API. | `true` |
142-
| `plugins.instrument_document_load` | Enabling the [OpenTelemetry plugin](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/web/opentelemetry-instrumentation-document-load) for instrumentation of the document load (initial request). | `true` |
143-
| `plugins.instrument_user_interaction` | Enabling the [OpenTelemetry plugin](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/web/opentelemetry-instrumentation-user-interaction) for instrumentation of user interactions. | `true` |
144-
| `global_instrumentation` | Object for configuring additional instrumentations, which will be applied to every OpenTelemetry plugin. ||
145-
| `global_instrumentation.requestParameter` | If enabled, existing request parameters will be added as attributes to spans and, if not excluded, will be added to the corresponding beacon as well. ||
146-
| `exporter` | Object for configuring the span exporter. Only used if `consoleOnly` is not enabled. ||
147-
| `exporter.maxQueueSize` | The maximum queue size. After the size is reached spans are dropped. | `100` |
148-
| `exporter.maxExportBatchSize` | The maximum batch size of every export. It must be smaller or equal to `maxQueueSize`. | `10` |
149-
| `exporter.scheduledDelayMillis` | The interval between two consecutive exports. | `500` |
150-
| `exporter.exportTimeoutMillis` | How long the export can run before it is cancelled. | `30000` |
151-
| `commonAttributes` | An Object defining common span attributes which will be added to each recorded span. | `{}` |
152-
| `serviceName` | A `string` or function which can be used to set the spans' service name. A function can be defined for dynamically providing the service name, e.g. based on Boomerang values. | `undefined` |
153-
| `propagationHeader` | Defines the format of the context propagation header. Available formats: `TRACE_CONTEXT`, `B3_SINGLE`, `B3_MULTI` | `TRACE_CONTEXT` |
135+
| Option | Description | Default value |
136+
|-------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------|
137+
| `samplingRate` | Sampling rate to use when collecting spans. Value must be between `0` and `1`. | `1` |
138+
| `corsUrls` | Array of CORS URLs to take into consideration when propagating trace information. By default, CORS URLs are excluded from the propagation. | `[]` |
139+
| `collectorConfiguration` | Object that defines the OpenTelemetry collector configuration, like the URL to send spans to. See [OTLPExporterNodeConfigBase](https://www.npmjs.com/package/@opentelemetry/exporter-trace-otlp-http) interface for all options. | `undefined` |
140+
| `consoleOnly` | If `true` spans will be logged on the console and not sent to the collector endpoint. | `false` |
141+
| `plugins` | Object for enabling and disabling OpenTelemetry plugins. | |
142+
| `plugins.instrument_fetch` | Enabling the [OpenTelemetry plugin](https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation-fetch) for instrumentation of the fetch API. This will only be used in case the `fetch` API exists. | `true` |
143+
| `plugins.instrument_xhr` | Enabling the [OpenTelemetry plugin](https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation-xml-http-request) for instrumentation of the XMLHttpRequest API. | `true` |
144+
| `plugins.instrument_document_load` | Enabling the [OpenTelemetry plugin](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/web/opentelemetry-instrumentation-document-load) for instrumentation of the document load (initial request). | `true` |
145+
| `plugins.instrument_user_interaction` | Enabling the [OpenTelemetry plugin](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/web/opentelemetry-instrumentation-user-interaction) for instrumentation of user interactions. | `true` |
146+
| `plugins.browser_detector` | Enabling the [OpenTelemetry plugin](https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-browser-detector) for detecting browser attributes. | `true` |
147+
| `global_instrumentation` | Object for configuring additional instrumentations, which will be applied to every OpenTelemetry plugin. | |
148+
| `global_instrumentation.requestParameter` | If enabled, existing request parameters will be added as attributes to spans and, if not excluded, will be added to the corresponding beacon as well. | |
149+
| `exporter` | Object for configuring the span exporter. Only used if `consoleOnly` is not enabled. | |
150+
| `exporter.maxQueueSize` | The maximum queue size. After the size is reached spans are dropped. | `100` |
151+
| `exporter.maxExportBatchSize` | The maximum batch size of every export. It must be smaller or equal to `maxQueueSize`. | `10` |
152+
| `exporter.scheduledDelayMillis` | The interval between two consecutive exports. | `500` |
153+
| `exporter.exportTimeoutMillis` | How long the export can run before it is cancelled. | `30000` |
154+
| `commonAttributes` | An Object defining common span attributes which will be added to each recorded span. | `{}` |
155+
| `serviceName` | A `string` or function which can be used to set the spans' service name. A function can be defined for dynamically providing the service name, e.g. based on Boomerang values. | `undefined` |
156+
| `propagationHeader` | Defines the format of the context propagation header. Available formats: `TRACE_CONTEXT`, `B3_SINGLE`, `B3_MULTI` | `TRACE_CONTEXT` |
154157

155158
## Manual Instrumentation
156159

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"@opentelemetry/instrumentation-fetch": "^0.48.0",
2121
"@opentelemetry/instrumentation-user-interaction": "^0.35.0",
2222
"@opentelemetry/instrumentation-xml-http-request": "^0.48.0",
23+
"@opentelemetry/opentelemetry-browser-detector": "^0.48.0",
2324
"@opentelemetry/propagator-b3": "^1.21.0",
2425
"@opentelemetry/sdk-trace-web": "^1.21.0",
2526
"regenerator-runtime": "^0.14.1",

0 commit comments

Comments
 (0)