Skip to content

feat(node): Add includeServerName option #16442

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

Merged
merged 3 commits into from
Jun 3, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 4 additions & 1 deletion packages/node/src/sdk/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ export class NodeClient extends ServerRuntimeClient<NodeClientOptions> {
private _logOnExitFlushListener: (() => void) | undefined;

public constructor(options: NodeClientOptions) {
const serverName = options.serverName || global.process.env.SENTRY_NAME || os.hostname();
const serverName = options.skipIncludingServerName
? undefined
: options.serverName || global.process.env.SENTRY_NAME || os.hostname();

const clientOptions: ServerRuntimeClientOptions = {
...options,
platform: 'node',
Expand Down
8 changes: 8 additions & 0 deletions packages/node/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ export interface BaseNodeOptions {
*/
profileLifecycle?: 'manual' | 'trace';

/**
* If set to true, the SDK will not automatically detect the `serverName`.
*
* This is useful if you are using the SDK in a CLI app or Electron where the
* hostname might be considered PII.
*/
skipIncludingServerName?: boolean;

/** Sets an optional server name (device name) */
serverName?: string;

Expand Down
Loading