Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

Commit

Permalink
fix(otel): test string value
Browse files Browse the repository at this point in the history
Signed-off-by: reslene <reslene@numary.com>
  • Loading branch information
reslene committed Nov 21, 2022
1 parent aa5d772 commit 2da3229
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions app/entry.server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@ import { CacheProvider } from '@emotion/react';
import createEmotionServer from '@emotion/server/create-instance';
import * as grpc from '@grpc/grpc-js';
import { ThemeProvider } from '@mui/material/styles';
import {
diag,
DiagConsoleLogger,
DiagLogLevel,
SpanKind,
trace,
} from '@opentelemetry/api';
import { diag, DiagConsoleLogger, DiagLogLevel } from '@opentelemetry/api';
import { AsyncHooksContextManager } from '@opentelemetry/context-async-hooks';
import {
CompositePropagator,
Expand All @@ -23,7 +17,6 @@ import { HttpInstrumentation } from '@opentelemetry/instrumentation-http';
import { B3InjectEncoding, B3Propagator } from '@opentelemetry/propagator-b3';
import { Resource } from '@opentelemetry/resources';
import {
BatchSpanProcessor,
ConsoleSpanExporter,
SimpleSpanProcessor,
SpanExporter,
Expand All @@ -40,16 +33,19 @@ import createEmotionCache from './src/utils/createEmotionCache';
import { theme } from '@numaryhq/storybook';

function configureTelemetry() {
if (typeof process !== 'undefined' && process.env.OTEL_TRACES) {
if (
typeof process !== 'undefined' &&
process.env.OTEL_TRACES &&
process.env.OTEL_TRACES == '1'
) {
let exporter: SpanExporter;
if (process.env.DEBUG) {
diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.DEBUG);
}
switch (process.env.OTEL_TRACES_EXPORTER) {
case 'otlp':
console.info(
'Configure OTLP exporter with endpoint: ' +
process.env.OTEL_TRACES_EXPORTER_OTLP_ENDPOINT
`Configure OTLP exporter with endpoint: ${process.env.OTEL_TRACES_EXPORTER_OTLP_ENDPOINT}`
);
exporter = new OTLPTraceExporter({
url: process.env.OTEL_TRACES_EXPORTER_OTLP_ENDPOINT,
Expand All @@ -59,8 +55,7 @@ function configureTelemetry() {
break;
case 'zipkin':
console.info(
'Configure ZipKin exporter with endpoint: ' +
process.env.OTEL_TRACES_EXPORTER_ZIPKIN_ENDPOINT
`Configure ZipKin exporter with endpoint: ${process.env.OTEL_TRACES_EXPORTER_ZIPKIN_ENDPOINT}`
);
exporter = new ZipkinExporter({
url: process.env.OTEL_TRACES_EXPORTER_ZIPKIN_ENDPOINT,
Expand Down Expand Up @@ -93,9 +88,7 @@ function configureTelemetry() {
const provider = new NodeTracerProvider({
resource,
});
provider.addSpanProcessor(
new SimpleSpanProcessor(exporter)
);
provider.addSpanProcessor(new SimpleSpanProcessor(exporter));
provider.register({
propagator: new CompositePropagator({
propagators: [
Expand Down

0 comments on commit 2da3229

Please sign in to comment.