Skip to content

Commit dc5f6de

Browse files
committed
add todos for event processors and integration hooks
1 parent d739931 commit dc5f6de

File tree

18 files changed

+23
-1
lines changed

18 files changed

+23
-1
lines changed

packages/astro/src/server/sdk.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export function init(options: NodeOptions): NodeClient | undefined {
1515

1616
const client = initNodeSdk(opts);
1717

18+
// TODO (span-streaming): remove this event processor. In this case, can probably just disable http integration server spans
1819
client?.addEventProcessor(
1920
Object.assign(
2021
(event: Event) => {

packages/browser/src/integrations/httpcontext.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import { getHttpRequestData, WINDOW } from '../helpers';
88
export const httpContextIntegration = defineIntegration(() => {
99
return {
1010
name: 'HttpContext',
11+
// TODO (span-streaming): probably fine to omit this in favour of us globally
12+
// already adding request context data but should double-check this
1113
preprocessEvent(event) {
1214
// if none of the information we want exists, don't bother
1315
if (!WINDOW.navigator && !WINDOW.location && !WINDOW.document) {

packages/browser/src/tracing/request.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ export function instrumentOutgoingRequests(client: Client, _options?: Partial<Re
142142
if (traceFetch) {
143143
// Keeping track of http requests, whose body payloads resolved later than the initial resolved request
144144
// e.g. streaming using server sent events (SSE)
145+
// TODO (span-streaming): replace with client hook - do we need client.on('processSpan')?
145146
client.addEventProcessor(event => {
146147
if (event.type === 'transaction' && event.spans) {
147148
event.spans.forEach(span => {

packages/core/src/integrations/eventFilters.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ function _shouldDropEvent(event: Event, options: Partial<EventFiltersOptions>):
145145
}
146146
} else if (event.type === 'transaction') {
147147
// Filter transactions
148-
148+
// TODO (span-streaming): replace with ignoreSpans defaults (if we have any)
149149
if (_isIgnoredTransaction(event, options.ignoreTransactions)) {
150150
DEBUG_BUILD &&
151151
debug.warn(

packages/core/src/integrations/requestdata.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ const _requestDataIntegration = ((options: RequestDataIntegrationOptions = {}) =
4040

4141
return {
4242
name: INTEGRATION_NAME,
43+
// TODO (span-streaming): probably fine to leave as-is for errors.
44+
// For spans, we go through global context -> attribute conversion or omit this completely (TBD)
4345
processEvent(event, _hint, client) {
4446
const { sdkProcessingMetadata = {} } = event;
4547
const { normalizedRequest, ipAddress } = sdkProcessingMetadata;

packages/core/src/utils/featureFlags.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const SPAN_FLAG_ATTRIBUTE_PREFIX = 'flag.evaluation.';
2727
/**
2828
* Copies feature flags that are in current scope context to the event context
2929
*/
30+
// TODO (span-streaming): should flags be added to (segment) spans? If so, probably do this via globally applying context data to spans
3031
export function _INTERNAL_copyFlagsFromScopeToEvent(event: Event): Event {
3132
const scope = getCurrentScope();
3233
const flagContext = scope.getScopeData().contexts.flags;

packages/core/src/utils/vercel-ai/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ function onVercelAiSpanStart(span: Span): void {
6464
processGenerateSpan(span, name, attributes);
6565
}
6666

67+
// TODO (span-streaming): move to client hook. What to do about parent modifications?
6768
function vercelAiEventProcessor(event: Event): Event {
6869
if (event.type === 'transaction' && event.spans) {
6970
// Map to accumulate token data by parent span ID

packages/deno/src/integrations/context.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ const _denoContextIntegration = (() => {
5656
return {
5757
name: INTEGRATION_NAME,
5858
processEvent(event) {
59+
// TODO (span-streaming): we probably need to apply this to spans via a hook IF we decide to apply contexts to (segment) spans
5960
return addDenoRuntimeContext(event);
6061
},
6162
};

packages/nextjs/src/client/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,13 @@ export function init(options: BrowserOptions): Client | undefined {
5353

5454
const client = reactInit(opts);
5555

56+
// TODO (span-streaming): replace with ignoreSpans default?
5657
const filterTransactions: EventProcessor = event =>
5758
event.type === 'transaction' && event.transaction === '/404' ? null : event;
5859
filterTransactions.id = 'NextClient404Filter';
5960
addEventProcessor(filterTransactions);
6061

62+
// TODO (span-streaming): replace with ignoreSpans default?
6163
const filterIncompleteNavigationTransactions: EventProcessor = event =>
6264
event.type === 'transaction' && event.transaction === INCOMPLETE_APP_ROUTER_INSTRUMENTATION_TRANSACTION_NAME
6365
? null

packages/nextjs/src/server/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,9 @@ export function init(options: NodeOptions): NodeClient | undefined {
212212
}
213213
});
214214

215+
// TODO (span-streaming):
216+
// - replace with ignoreSpans default
217+
// - allow ignoreSpans to filter on arbitrary span attributes (not just op)
215218
getGlobalScope().addEventProcessor(
216219
Object.assign(
217220
(event => {

0 commit comments

Comments
 (0)