Skip to content

Commit e670c33

Browse files
Merge pull request #6394 from Shopify/sd.write_target_in_app_logs
Adding function target to app logs
2 parents acdc4ca + dce869c commit e670c33

File tree

5 files changed

+10
-0
lines changed

5 files changed

+10
-0
lines changed

packages/app/src/cli/services/app-logs/dev/poll-app-logs.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ const FUNCTION_PAYLOAD = {
6161
function_id: 'e57b4d31-2038-49ff-a0a1-1eea532414f7',
6262
logs: LOGS,
6363
fuel_consumed: 512436,
64+
target: 'test.run',
6465
export: 'run',
6566
}
6667
const FAILURE_PAYLOAD = {
@@ -71,6 +72,7 @@ const FAILURE_PAYLOAD = {
7172
function_id: 'e57b4d31-2038-49ff-a0a1-1eea532414f7',
7273
logs: LOGS,
7374
error_type: FUNCTION_ERROR,
75+
target: 'test.run',
7476
export: 'run',
7577
}
7678

packages/app/src/cli/services/app-logs/logs-command/ui/components/Logs.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ const appLogFunctionRunOutputs = ({
8686
logs: LOGS,
8787
functionId: FUNCTION_ID,
8888
fuelConsumed: FUEL_CONSUMED,
89+
target: 'test.run',
8990
errorMessage: 'errorMessage',
9091
errorType: 'errorType',
9192
inputQueryVariablesMetafieldValue: '{"key":"value"}',

packages/app/src/cli/services/app-logs/logs-command/ui/components/hooks/usePollAppLogs.test.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const OUTPUT = {test: 'output'}
3737
const INPUT = {test: 'input'}
3838
const INPUT_BYTES = 10
3939
const OUTPUT_BYTES = 10
40+
const TARGET = 'test.run'
4041

4142
const NETWORK_ACCESS_HTTP_REQUEST = {
4243
url: 'https://api.example.com/hello',
@@ -100,6 +101,7 @@ const POLL_APP_LOGS_FOR_LOGS_RESPONSE = {
100101
function_id: FUNCTION_ID,
101102
logs: LOGS,
102103
fuel_consumed: FUEL_CONSUMED,
104+
target: TARGET,
103105
}),
104106
log_type: LOG_TYPE,
105107
cursor: RETURNED_CURSOR,

packages/app/src/cli/services/app-logs/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export class FunctionRunLog {
3636
logs: string
3737
functionId: string
3838
fuelConsumed: number
39+
target: string
3940
errorMessage: string | null
4041
errorType: string | null
4142
inputQueryVariablesMetafieldValue: unknown
@@ -51,6 +52,7 @@ export class FunctionRunLog {
5152
logs,
5253
functionId,
5354
fuelConsumed,
55+
target,
5456
errorMessage,
5557
errorType,
5658
inputQueryVariablesMetafieldValue,
@@ -65,6 +67,7 @@ export class FunctionRunLog {
6567
logs: string
6668
functionId: string
6769
fuelConsumed: number
70+
target: string
6871
errorMessage: string | null
6972
errorType: string | null
7073
inputQueryVariablesMetafieldValue: unknown
@@ -79,6 +82,7 @@ export class FunctionRunLog {
7982
this.logs = logs
8083
this.functionId = functionId
8184
this.fuelConsumed = fuelConsumed
85+
this.target = target
8286
this.errorMessage = errorMessage
8387
this.errorType = errorType
8488
this.inputQueryVariablesMetafieldValue = inputQueryVariablesMetafieldValue

packages/app/src/cli/services/app-logs/utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export function parseFunctionRunPayload(payload: string): FunctionRunLog {
4545
logs: parsedPayload.logs,
4646
functionId: parsedPayload.function_id,
4747
fuelConsumed: parsedPayload.fuel_consumed,
48+
target: parsedPayload.target,
4849
errorMessage: parsedPayload.error_message,
4950
errorType: parsedPayload.error_type,
5051
inputQueryVariablesMetafieldValue: parsedIqvValue,

0 commit comments

Comments
 (0)