Tristan Sloughter bcf5f600d5
add roll dice example in Erlang with Elli (#177)
* add roll dice example in Erlang with Elli

* cleanup index page template formatting

* fix index/1 type spec

* remove index.js which gets compiled by npm

* roll dice: use 127.0.0.1 for node name to work for everyone
2023-10-02 08:00:45 -06:00

41 lines
1.5 KiB
JavaScript

import 'htmx.org';
import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/sdk-trace-base';
import { WebTracerProvider } from '@opentelemetry/sdk-trace-web';
import { XMLHttpRequestInstrumentation } from '@opentelemetry/instrumentation-xml-http-request';
import { DocumentLoadInstrumentation } from '@opentelemetry/instrumentation-document-load';
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
import { registerInstrumentations } from '@opentelemetry/instrumentation';
import { ZoneContextManager } from '@opentelemetry/context-zone';
import { Resource } from '@opentelemetry/resources';
import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions';
import * as api from '@opentelemetry/api';
const providerWithZone = new WebTracerProvider({
resource: new Resource({
[SemanticResourceAttributes.SERVICE_NAME]: 'roll-dice-ui',
}),
});
providerWithZone.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));
providerWithZone.addSpanProcessor(new SimpleSpanProcessor(new OTLPTraceExporter({
url: "http://localhost:4318/v1/traces"
})));
providerWithZone.register({
contextManager: new ZoneContextManager()
});
registerInstrumentations({
instrumentations: [
new DocumentLoadInstrumentation(),
new XMLHttpRequestInstrumentation({
ignoreUrls: [/localhost/],
propagateTraceHeaderCorsUrls: [
'http://localhost:3000',
],
}),
],
tracerProvider: providerWithZone,
});