Skip to content

show.actions was appearing in the properties #964

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 1 commit into from
Mar 22, 2024
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
2 changes: 1 addition & 1 deletion apps/webapp/app/presenters/v3/SpanPresenter.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class SpanPresenter {
output: span.output ? JSON.stringify(span.output, null, 2) : undefined,
payload: span.payload ? JSON.stringify(span.payload, null, 2) : undefined,
properties: span.properties ? JSON.stringify(span.properties, null, 2) : undefined,
showActionBar: (span.properties?.show as any)?.actions === true,
showActionBar: span.show?.actions === true,
},
};
}
Expand Down
35 changes: 22 additions & 13 deletions apps/webapp/app/v3/eventRepository.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,14 @@ export class EventRepository {
? null
: unflattenAttributes(fullEvent.output as Attributes);

const show = unflattenAttributes(
filteredAttributes(fullEvent.properties as Attributes, SemanticInternalAttributes.SHOW)
)[SemanticInternalAttributes.SHOW] as
| {
actions?: boolean;
}
| undefined;

const properties = sanitizedAttributes(fullEvent.properties);

const events = transformEvents(span.data.events, fullEvent.metadata as Attributes);
Expand All @@ -365,6 +373,7 @@ export class EventRepository {
output,
properties,
events,
show,
};
}

Expand Down Expand Up @@ -480,14 +489,14 @@ export class EventRepository {
const links: Link[] =
options.spanParentAsLink && propagatedContext?.traceparent
? [
{
context: {
traceId: propagatedContext.traceparent.traceId,
spanId: propagatedContext.traceparent.spanId,
traceFlags: TraceFlags.SAMPLED,
{
context: {
traceId: propagatedContext.traceparent.traceId,
spanId: propagatedContext.traceparent.spanId,
traceFlags: TraceFlags.SAMPLED,
},
},
},
]
]
: [];

const eventBuilder = {
Expand Down Expand Up @@ -742,9 +751,9 @@ function prepareEvent(event: QueriedEvent): PreparedEvent {
function parseEventsField(events: Prisma.JsonValue): SpanEvents {
const eventsUnflattened = events
? (events as any[]).map((e) => ({
...e,
properties: unflattenAttributes(e.properties as Attributes),
}))
...e,
properties: unflattenAttributes(e.properties as Attributes),
}))
: undefined;

const spanEvents = SpanEvents.safeParse(eventsUnflattened);
Expand Down Expand Up @@ -938,8 +947,8 @@ function transformException(
...exception,
stacktrace: exception.stacktrace
? correctErrorStackTrace(exception.stacktrace, projectDirAttributeValue, {
removeFirstLine: true,
})
removeFirstLine: true,
})
: undefined,
};
}
Expand All @@ -966,4 +975,4 @@ function getNowInNanoseconds(): bigint {

function getDateFromNanoseconds(nanoseconds: bigint) {
return new Date(Number(nanoseconds) / 1_000_000);
}
}
3 changes: 2 additions & 1 deletion packages/core/src/v3/semanticInternalAttributes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export const SemanticInternalAttributes = {
METADATA: "$metadata",
TRIGGER: "$trigger",
PAYLOAD: "$payload",
SHOW_ACTIONS: "show.actions",
SHOW: "$show",
SHOW_ACTIONS: "$show.actions",
WORKER_ID: "worker.id",
WORKER_VERSION: "worker.version",
CLI_VERSION: "cli.version",
Expand Down