Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fallback to default trace endpoint for link exporter. #444

Merged
merged 3 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const main = () => {
dataAttributes: ['hello', 'barBiz'],
},
},
localVisualizations: true,
});
sdk.start();
const tracer = trace.getTracer('click-tracer');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { HoneycombOptions } from './types';
import {
createHoneycombSDKLogMessage,
getTracesApiKey,
getTracesEndpoint,
isClassic,
} from './util';
import {
Expand All @@ -24,7 +25,9 @@ export function configureConsoleTraceLinkExporter(
options?: HoneycombOptions,
): SpanExporter {
const apiKey = getTracesApiKey(options);
const { authRoot, uiRoot } = getUrlRoots(options?.endpoint);
const { authRoot, uiRoot } = getUrlRoots(
options?.tracesEndpoint || getTracesEndpoint(options),
);
return new ConsoleTraceLinkExporter(
options?.serviceName,
apiKey,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,34 @@ describe('when debug is set to true', () => {
`@honeycombio/opentelemetry-web: Sample Rate configured for traces: '${testConfig.sampleRate}'`,
);
});
it('should log the configured options to the console when endpoint is omitted', () => {
const testConfig = {
debug: true,
apiKey: 'my-key',
serviceName: 'my-service',
sampleRate: 2,
};
new HoneycombWebSDK(testConfig);
expect(consoleSpy).toHaveBeenNthCalledWith(
3,
'@honeycombio/opentelemetry-web: 🐝 Honeycomb Web SDK Debug Mode Enabled 🐝',
);
expect(consoleSpy).toHaveBeenNthCalledWith(
4,
`@honeycombio/opentelemetry-web: API Key configured for traces: '${testConfig.apiKey}'`,
);
expect(consoleSpy).toHaveBeenNthCalledWith(
5,
`@honeycombio/opentelemetry-web: Service Name configured for traces: '${testConfig.serviceName}'`,
);
expect(consoleSpy).toHaveBeenNthCalledWith(
6,
`@honeycombio/opentelemetry-web: Endpoint configured for traces: 'https://api.honeycomb.io/v1/traces'`,
);
expect(consoleSpy).toHaveBeenNthCalledWith(
7,
`@honeycombio/opentelemetry-web: Sample Rate configured for traces: '${testConfig.sampleRate}'`,
);
});
});
});
Loading