-
Notifications
You must be signed in to change notification settings - Fork 473
[eslint-monster] Replace console.log with core.info in setup/js OTLP and outcome scripts
#47416
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
Changes from all commits
eb678dc
ee05c3c
0a9d033
14e0979
d12440f
71698f3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| // @ts-check | ||
| "use strict"; | ||
| require("./shim.cjs"); | ||
|
|
||
| /** | ||
| * action_setup_otlp.cjs | ||
|
|
@@ -42,7 +43,7 @@ function writeEnvLine(filePath, key, value, logLabel, fileLabel) { | |
| if (!filePath || !value) return; | ||
| try { | ||
| appendFileSync(filePath, `${key}=${value}\n`); | ||
| console.log(`[otlp] ${logLabel} written to ${fileLabel}`); | ||
| core.info(`[otlp] ${logLabel} written to ${fileLabel}`); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in commit |
||
| } catch { | ||
| /* ignore */ | ||
| } | ||
|
|
@@ -112,13 +113,13 @@ async function run() { | |
| // through GitHub Actions expression evaluation is unreliable. | ||
| const inputTraceId = getActionInput("TRACE_ID").toLowerCase(); | ||
| if (inputTraceId) { | ||
| console.log(`[otlp] INPUT_TRACE_ID=${inputTraceId} (will reuse activation trace)`); | ||
| core.info(`[otlp] INPUT_TRACE_ID=${inputTraceId} (will reuse activation trace)`); | ||
| } else { | ||
| console.log("[otlp] INPUT_TRACE_ID not set, a new trace ID will be generated"); | ||
| core.info("[otlp] INPUT_TRACE_ID not set, a new trace ID will be generated"); | ||
| } | ||
| const inputParentSpanId = getActionInput("PARENT_SPAN_ID").toLowerCase(); | ||
| if (inputParentSpanId) { | ||
| console.log(`[otlp] INPUT_PARENT_SPAN_ID=${inputParentSpanId} (will parent setup span)`); | ||
| core.info(`[otlp] INPUT_PARENT_SPAN_ID=${inputParentSpanId} (will parent setup span)`); | ||
| } | ||
|
|
||
| // Normalize to the canonical underscore form so sendJobSetupSpan (which | ||
|
|
@@ -148,9 +149,9 @@ async function run() { | |
| } | ||
|
|
||
| if (!endpoints) { | ||
| console.log("[otlp] GH_AW_OTLP_ENDPOINTS not set, skipping setup span"); | ||
| core.info("[otlp] GH_AW_OTLP_ENDPOINTS not set, skipping setup span"); | ||
| } else { | ||
| console.log(`[otlp] sending setup span to configured endpoints`); | ||
| core.info(`[otlp] sending setup span to configured endpoints`); | ||
| } | ||
|
|
||
| const { traceId, spanId, parentSpanId } = await sendJobSetupSpan({ | ||
|
|
@@ -159,10 +160,10 @@ async function run() { | |
| parentSpanId: inputParentSpanId || undefined, | ||
| }); | ||
|
|
||
| console.log(`[otlp] resolved trace-id=${traceId}`); | ||
| core.info(`[otlp] resolved trace-id=${traceId}`); | ||
|
|
||
| if (endpoints) { | ||
| console.log(`[otlp] setup span sent (traceId=${traceId}, spanId=${spanId})`); | ||
| core.info(`[otlp] setup span sent (traceId=${traceId}, spanId=${spanId})`); | ||
| } | ||
|
|
||
| const githubOutput = process.env.GITHUB_OUTPUT; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| // @ts-check | ||
| /// <reference types="@actions/github-script" /> | ||
| require("./shim.cjs"); | ||
|
|
||
| /** | ||
| * emit_outcome_spans.cjs | ||
|
|
@@ -76,15 +77,15 @@ async function main() { | |
| const awInfo = readJSONIfExists(AW_INFO_PATH) || {}; | ||
|
|
||
| if (evaluations.length === 0 && (!summary || summary.total_outcomes === 0)) { | ||
| console.log("[outcome-otel] No outcome evaluations to export"); | ||
| core.info("[outcome-otel] No outcome evaluations to export"); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in commit |
||
| return; | ||
| } | ||
|
|
||
| const endpoints = parseOTLPEndpoints(); | ||
| const hasEndpoints = endpoints.length > 0; | ||
|
|
||
| if (!hasEndpoints) { | ||
| console.log("[outcome-otel] No OTLP endpoints configured, writing JSONL mirror only"); | ||
| core.info("[outcome-otel] No OTLP endpoints configured, writing JSONL mirror only"); | ||
| } | ||
|
|
||
| // Read aw_info.json first: GH_AW_INFO_* env vars are only present during setup, | ||
|
|
@@ -304,11 +305,11 @@ async function main() { | |
| // Always write to local JSONL mirror | ||
| appendToOTLPJSONL(payload); | ||
|
|
||
| console.log(`[outcome-otel] Emitting ${evaluations.length} outcome span(s) + 1 summary span`); | ||
| core.info(`[outcome-otel] Emitting ${evaluations.length} outcome span(s) + 1 summary span`); | ||
|
|
||
| if (hasEndpoints) { | ||
| await sendOTLPToAllEndpoints(endpoints, payload, { skipJSONL: true }); | ||
| console.log(`[outcome-otel] Exported to ${endpoints.length} endpoint(s)`); | ||
| core.info(`[outcome-otel] Exported to ${endpoints.length} endpoint(s)`); | ||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in commit
14e0979. Theaction_conclusion_otlp.test.cjssuite now sets up amockCoreobject before module load and allconsole.logassertions at lines 56, 81, 87, and 119 have been updated to assertmockCore.info. All 33 tests in this file pass.