Skip to content

chore(profiling-node): Remove duplicate types #15427

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 2 commits into from
Feb 20, 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
5 changes: 1 addition & 4 deletions packages/profiling-node/src/integration.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* eslint-disable max-lines */

import { CpuProfilerBindings } from '@sentry-internal/node-cpu-profiler';
import { CpuProfilerBindings, ProfileFormat, type RawThreadCpuProfile } from '@sentry-internal/node-cpu-profiler';
import type { Event, IntegrationFn, Profile, ProfileChunk, ProfilingIntegration, Span } from '@sentry/core';
import {
LRUMap,
Expand All @@ -18,8 +17,6 @@ import type { NodeClient } from '@sentry/node';
import { DEBUG_BUILD } from './debug-build';
import { NODE_MAJOR, NODE_VERSION } from './nodeVersion';
import { MAX_PROFILE_DURATION_MS, maybeProfileSpan, stopSpanProfile } from './spanProfileUtils';
import type { RawThreadCpuProfile } from './types';
import { ProfileFormat } from './types';
import {
PROFILER_THREAD_ID_STRING,
PROFILER_THREAD_NAME,
Expand Down
3 changes: 1 addition & 2 deletions packages/profiling-node/src/spanProfileUtils.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { CpuProfilerBindings } from '@sentry-internal/node-cpu-profiler';
import { CpuProfilerBindings, type RawThreadCpuProfile } from '@sentry-internal/node-cpu-profiler';
import type { CustomSamplingContext, Span } from '@sentry/core';
import { logger, spanIsSampled, spanToJSON, uuid4 } from '@sentry/core';
import type { NodeClient } from '@sentry/node';
import { DEBUG_BUILD } from './debug-build';
import type { RawThreadCpuProfile } from './types';
import { isValidSampleRate } from './utils';

export const MAX_PROFILE_DURATION_MS = 30 * 1000;
Expand Down
84 changes: 0 additions & 84 deletions packages/profiling-node/src/types.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/profiling-node/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import {
import { env, versions } from 'process';
import { isMainThread, threadId } from 'worker_threads';

import type { RawChunkCpuProfile, RawThreadCpuProfile } from '@sentry-internal/node-cpu-profiler';
import { DEBUG_BUILD } from './debug-build';
import type { RawChunkCpuProfile, RawThreadCpuProfile } from './types';

// We require the file because if we import it, it will be included in the bundle.
// I guess tsc does not check file contents when it's imported.
Expand Down
7 changes: 6 additions & 1 deletion packages/profiling-node/test/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import { addItemToEnvelope, createEnvelope, uuid4 } from '@sentry/core';
import type { Event } from '@sentry/core';

import type { RawThreadCpuProfile } from '@sentry-internal/node-cpu-profiler';
import {
addProfilesToEnvelope,
findProfiledTransactionsFromEnvelope,
isValidProfile,
isValidSampleRate,
} from '../src/utils';

import type { ProfiledEvent } from '../src/types';
interface ProfiledEvent extends Event {
sdkProcessingMetadata: {
profile?: RawThreadCpuProfile;
};
}

function makeProfile(
props: Partial<ProfiledEvent['sdkProcessingMetadata']['profile']>,
Expand Down
Loading