-
Notifications
You must be signed in to change notification settings - Fork 805
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update
trace-web
example and rename it to opentelemetry-web
(
#3145) * chore: update trace-web metrics sample. * update versions to 0.31.0. * fix(changelog): add changelog entry. * fix(changelog): move changlog entry. * fix(opentelemetry-web): make stopMetrics() non-async.
- Loading branch information
1 parent
dc2d093
commit f882b71
Showing
25 changed files
with
286 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
# Overview | ||
|
||
This example shows how to | ||
use [@opentelemetry/sdk-trace-web](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-web) | ||
with different plugins and setup to instrument your JavaScript code running in the browser. | ||
|
||
## Installation | ||
|
||
```sh | ||
# from this directory | ||
npm install | ||
``` | ||
|
||
## Run the Application | ||
|
||
```sh | ||
# from this directory | ||
npm start | ||
``` | ||
|
||
By default, the application will run on port `8090`. | ||
|
||
Other options for running the application, this serves the same examples using different source file processing, so you | ||
can review the different effects on the resulting bundle sizes that are loaded via the browser. | ||
|
||
| Command | Description | | ||
|------------------------|-----------------------------------------------------------| | ||
| `npm start` (Default) | Serve the raw development bundles compressed via GZip | | ||
| `npm run start-nc` | Serve the raw development bundles uncompressed | | ||
| `npm run start-prod` | Serve the minified production bundles compressed via GZip | | ||
| `npm run start-prodnc` | Serve the minified production bundles uncompressed | | ||
|
||
The development modes includes source maps via the webpack devtool `eval-source-map` mode which substantially increases | ||
the size of the bundles. | ||
|
||
## Examples | ||
|
||
The examples include several variants so that you can see how to mix and match individual components and the impact this | ||
can have on the resulting bundle size. | ||
|
||
### XMLHttpRequest | ||
|
||
This example shows how to use the XMLHttpRequest Instrumentation with the OTLP (`http/json`) Trace exporter and with the | ||
B3 Propagator. | ||
|
||
Included Components | ||
|
||
- XMLHttpRequestInstrumentation | ||
- ZoneContextManager | ||
- OTLPTraceExporter | ||
- WebTracerProvider | ||
- B3Propagator | ||
|
||
To see the results, open the browser at <http://localhost:8090/xml-http-request/> and make sure you have the browser | ||
console open. The application is using the `ConsoleSpanExporter` and will post the created spans to the browser console. | ||
The screen will look as follows: | ||
|
||
![Screenshot of the running example](images/xml-http-request.png) | ||
|
||
### Fetch | ||
|
||
This example shows how to use the Fetch Instrumentation with the OTLP (`http/json`) Trace exporter and with the B3 | ||
Propagator. | ||
|
||
Included Components | ||
|
||
- FetchInstrumentation | ||
- ZoneContextManager | ||
- OTLPTraceExporter | ||
- WebTracerProvider | ||
- B3Propagator | ||
|
||
To see the results, open the browser at <http://localhost:8090/fetch/> and make sure you have the browser console open. | ||
The application is using the `ConsoleSpanExporter` and will post the created spans to the browser console. | ||
|
||
### FetchXhr | ||
|
||
This example shows how to use both the XMLHttpRequest and Fetch Instrumentations with the OTLP (`http/json`) Trace | ||
exporter but without the B3 Propagator. | ||
|
||
Included Components | ||
|
||
- XMLHttpRequestInstrumentation | ||
- FetchInstrumentation | ||
- ZoneContextManager | ||
- OTLPTraceExporter | ||
- WebTracerProvider | ||
|
||
### FetchXhrB3 | ||
|
||
This example shows how to use both the XMLHttpRequest and Fetch Instrumentations with the OTLP (`http/json`) Trace | ||
exporter and with the B3 Propagator | ||
|
||
Included Components | ||
|
||
- XMLHttpRequestInstrumentation | ||
- FetchInstrumentation | ||
- ZoneContextManager | ||
- OTLPTraceExporter | ||
- WebTracerProvider | ||
- B3Propagator | ||
|
||
### Metrics | ||
|
||
This example shows how to use the OTLP (`http/json`) Metric Exporter with the Metrics SDK. | ||
|
||
Included Components | ||
|
||
- OTLPMetricExporter | ||
- MeterProvider | ||
- Resource | ||
- SemanticResourceAttributes | ||
|
||
### Zipkin | ||
|
||
This example show a simple usage of the ZipKin Exporter with the Web Tracer Provider | ||
|
||
Included Components | ||
|
||
- WebTracerProvider | ||
- ZipkinExporter | ||
|
||
## Useful links | ||
|
||
- For more information on OpenTelemetry, visit: <https://opentelemetry.io/> | ||
- For more information on web tracing, | ||
visit: <https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-web> | ||
|
||
## LICENSE | ||
|
||
Apache License 2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
receivers: | ||
otlp: | ||
protocols: | ||
grpc: | ||
http: | ||
cors: | ||
allowed_origins: | ||
- http://* | ||
- https://* | ||
|
||
exporters: | ||
zipkin: | ||
endpoint: "http://zipkin-all-in-one:9411/api/v2/spans" | ||
prometheus: | ||
endpoint: "0.0.0.0:9464" | ||
|
||
processors: | ||
batch: | ||
|
||
service: | ||
telemetry: | ||
logs: | ||
level: "debug" | ||
pipelines: | ||
traces: | ||
receivers: [otlp] | ||
exporters: [zipkin] | ||
processors: [batch] | ||
metrics: | ||
receivers: [otlp] | ||
exporters: [prometheus] | ||
processors: [batch] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
version: "3" | ||
services: | ||
# Collector | ||
collector: | ||
image: otel/opentelemetry-collector-contrib:0.53.0 | ||
# image: otel/opentelemetry-collector-contrib:latest | ||
command: ["--config=/conf/collector-config.yaml"] | ||
volumes: | ||
- ./collector-config.yaml:/conf/collector-config.yaml | ||
ports: | ||
- "9464:9464" | ||
- "4317:4317" | ||
- "4318:4318" | ||
depends_on: | ||
- zipkin-all-in-one | ||
|
||
# Zipkin | ||
zipkin-all-in-one: | ||
image: openzipkin/zipkin:latest | ||
ports: | ||
- "9411:9411" | ||
|
||
# Prometheus | ||
prometheus: | ||
container_name: prometheus | ||
image: prom/prometheus:latest | ||
volumes: | ||
- ./prometheus.yaml:/etc/prometheus/prometheus.yml | ||
ports: | ||
- "9090:9090" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
global: | ||
scrape_interval: 15s # Default is every 1 minute. | ||
|
||
scrape_configs: | ||
- job_name: 'collector' | ||
# metrics_path defaults to '/metrics' | ||
# scheme defaults to 'http'. | ||
static_configs: | ||
- targets: ['collector:9464'] |
File renamed without changes.
16 changes: 8 additions & 8 deletions
16
examples/tracer-web/examples/fetch/index.js → ...opentelemetry-web/examples/fetch/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.