Skip to content

Commit

Permalink
feat: ✨ Pull in base OTel WebSDK (#3)
Browse files Browse the repository at this point in the history
* pull in webSDK code and connect it to example

* make example app emit traces

* remove mention of the session id span processor

* ok nvm i figured out how to browserify the session id stuff
  • Loading branch information
pkanal authored Dec 4, 2023
1 parent 751f1da commit 4ee4160
Show file tree
Hide file tree
Showing 6 changed files with 896 additions and 21 deletions.
15 changes: 13 additions & 2 deletions examples/hello-world-web/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
import { WebSDK } from '@honeycombio/opentelemetry-web';
import { DiagConsoleLogger, DiagLogLevel, diag } from '@opentelemetry/api';
import { getWebAutoInstrumentations } from '@opentelemetry/auto-instrumentations-web';
import { ConsoleSpanExporter } from '@opentelemetry/sdk-trace-base';

const main = () => {
console.log('Hello from the example app');
new WebSDK();
// Set OTel to log in Debug mode
diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.DEBUG);

// Initialize base OTel WebSDK
const sdk = new WebSDK({
instrumentations: [getWebAutoInstrumentations()], // add auto-instrumentation
traceExporter: new ConsoleSpanExporter(), // log spans to the console
});
sdk.start();
};

main();
Loading

0 comments on commit 4ee4160

Please sign in to comment.