-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(getting started): trace ingestion dotnet, browser (#4052)
* docs(getstarted): add dotnet * docs(getstarted): add browser * updating the browser example to use the tracetest sdk * updating dependency * Update examples/getting-started/browser/README.md Co-authored-by: Julianne Fermi <[email protected]> --------- Co-authored-by: Oscar Reyes <[email protected]> Co-authored-by: Julianne Fermi <[email protected]>
- Loading branch information
1 parent
2072feb
commit 3df9fae
Showing
59 changed files
with
23,788 additions
and
9 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
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,28 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
node_modules/ | ||
/test-results/ | ||
/playwright-report/ | ||
/blob-report/ | ||
/playwright/.cache/ |
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,74 @@ | ||
# Step-by-step | ||
|
||
1. Install Dependencies | ||
|
||
```bash | ||
npm i @opentelemetry/core \ | ||
@opentelemetry/sdk-trace-web \ | ||
@opentelemetry/sdk-trace-base \ | ||
@opentelemetry/instrumentation \ | ||
@opentelemetry/exporter-trace-otlp-http \ | ||
@opentelemetry/context-zone \ | ||
@tracetest/instrumentation-user-interaction \ | ||
@opentelemetry/auto-instrumentations-web \ | ||
@opentelemetry/resources | ||
``` | ||
|
||
2. Initialize Tracing | ||
|
||
`instrumentation.js` | ||
|
||
```js | ||
import { CompositePropagator, W3CBaggagePropagator, W3CTraceContextPropagator } from "@opentelemetry/core"; | ||
import { WebTracerProvider } from "@opentelemetry/sdk-trace-web"; | ||
import { BatchSpanProcessor } from "@opentelemetry/sdk-trace-base"; | ||
import { registerInstrumentations } from "@opentelemetry/instrumentation"; | ||
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http"; | ||
import { ZoneContextManager } from "@opentelemetry/context-zone"; | ||
import { UserInteractionInstrumentation } from "@tracetest/instrumentation-user-interaction"; | ||
import { getWebAutoInstrumentations } from "@opentelemetry/auto-instrumentations-web"; | ||
import { Resource } from "@opentelemetry/resources"; | ||
const provider = new WebTracerProvider({ | ||
resource: new Resource({ | ||
"service.name": "browser-app", | ||
}), | ||
}); | ||
provider.addSpanProcessor( | ||
new BatchSpanProcessor(new OTLPTraceExporter({ url: "http://localhost:4318/v1/traces" }), { | ||
maxQueueSize: 10000, | ||
scheduledDelayMillis: 200, | ||
}) | ||
); | ||
provider.register({ | ||
contextManager: new ZoneContextManager(), | ||
propagator: new CompositePropagator({ | ||
propagators: [new W3CBaggagePropagator(), new W3CTraceContextPropagator()], | ||
}), | ||
}); | ||
registerInstrumentations({ | ||
tracerProvider: provider, | ||
instrumentations: [ | ||
new UserInteractionInstrumentation(), | ||
getWebAutoInstrumentations({ | ||
"@opentelemetry/instrumentation-fetch": { | ||
propagateTraceHeaderCorsUrls: /.*/, | ||
clearTimingResources: true, | ||
}, | ||
"@opentelemetry/instrumentation-user-interaction": { | ||
enabled: false, | ||
}, | ||
}), | ||
], | ||
}); | ||
``` | ||
`index.js` or entrypoint file | ||
```js | ||
import "./instrumentation"; | ||
// rest of the app's entrypoint code | ||
``` |
Oops, something went wrong.