@@ -169974,21 +169974,21 @@ function githubSemconvAttributes(context = github_context) {
169974169974 const pullRequest = context.payload.pull_request;
169975169975 const head = pullRequest?.head;
169976169976 const attributes = {
169977- [index_incubating.ATTR_CICD_PIPELINE_NAME]: dist_text (context.workflow),
169977+ [index_incubating.ATTR_CICD_PIPELINE_NAME]: text$1 (context.workflow),
169978169978 [index_incubating.ATTR_CICD_PIPELINE_RUN_ID]: numericString(context.runId),
169979169979 [index_incubating.ATTR_CICD_PIPELINE_RUN_URL_FULL]: pipelineRunUrl(context, repository),
169980- [index_incubating.ATTR_CICD_PIPELINE_TASK_NAME]: dist_text (context.job),
169981- [index_incubating.ATTR_CICD_WORKER_NAME]: dist_text (process.env["RUNNER_NAME"]),
169980+ [index_incubating.ATTR_CICD_PIPELINE_TASK_NAME]: text$1 (context.job),
169981+ [index_incubating.ATTR_CICD_WORKER_NAME]: text$1 (process.env["RUNNER_NAME"]),
169982169982 [index_incubating.ATTR_VCS_PROVIDER_NAME]: index_incubating.VCS_PROVIDER_NAME_VALUE_GITHUB,
169983169983 [index_incubating.ATTR_VCS_OWNER_NAME]: repository?.owner,
169984169984 [index_incubating.ATTR_VCS_REPOSITORY_NAME]: repository?.repo,
169985169985 [index_incubating.ATTR_VCS_REPOSITORY_URL_FULL]: repositoryUrl(context, repository),
169986- [index_incubating.ATTR_VCS_REF_HEAD_NAME]: dist_text (head?.ref) ?? refName(context.ref),
169987- [index_incubating.ATTR_VCS_REF_HEAD_TYPE]: head === void 0 ? refType(dist_text (context.ref)) : index_incubating.VCS_REF_HEAD_TYPE_VALUE_BRANCH,
169988- [index_incubating.ATTR_VCS_REF_HEAD_REVISION]: dist_text (head?.sha) ?? dist_text (context.sha),
169989- [index_incubating.ATTR_VCS_REF_BASE_NAME]: dist_text (pullRequest?.base?.ref),
169986+ [index_incubating.ATTR_VCS_REF_HEAD_NAME]: text$1 (head?.ref) ?? refName(context.ref),
169987+ [index_incubating.ATTR_VCS_REF_HEAD_TYPE]: head === void 0 ? refType(text$1 (context.ref)) : index_incubating.VCS_REF_HEAD_TYPE_VALUE_BRANCH,
169988+ [index_incubating.ATTR_VCS_REF_HEAD_REVISION]: text$1 (head?.sha) ?? text$1 (context.sha),
169989+ [index_incubating.ATTR_VCS_REF_BASE_NAME]: text$1 (pullRequest?.base?.ref),
169990169990 [index_incubating.ATTR_VCS_REF_BASE_TYPE]: pullRequest?.base?.ref === void 0 ? void 0 : index_incubating.VCS_REF_BASE_TYPE_VALUE_BRANCH,
169991- [index_incubating.ATTR_VCS_REF_BASE_REVISION]: dist_text (pullRequest?.base?.sha),
169991+ [index_incubating.ATTR_VCS_REF_BASE_REVISION]: text$1 (pullRequest?.base?.sha),
169992169992 [index_incubating.ATTR_VCS_CHANGE_ID]: numericString(pullRequest?.number)
169993169993 };
169994169994 return Object.fromEntries(Object.entries(attributes).filter(([, value]) => value !== void 0));
@@ -169997,7 +169997,7 @@ function githubSemconvAttributes(context = github_context) {
169997169997function repositoryOf(context) {
169998169998 try {
169999169999 const { owner, repo } = context.repo;
170000- return dist_text (owner) === void 0 || dist_text (repo) === void 0 ? void 0 : {
170000+ return text$1 (owner) === void 0 || text$1 (repo) === void 0 ? void 0 : {
170001170001 owner,
170002170002 repo
170003170003 };
@@ -170008,7 +170008,7 @@ function repositoryOf(context) {
170008170008/** The address of the repository in a browser. */
170009170009function repositoryUrl(context, repository) {
170010170010 if (repository === void 0) return;
170011- const server = dist_text (context.serverUrl)?.replace(/\/+$/, "");
170011+ const server = text$1 (context.serverUrl)?.replace(/\/+$/, "");
170012170012 return server === void 0 ? void 0 : `${server}/${repository.owner}/${repository.repo}`;
170013170013}
170014170014/**
@@ -170031,7 +170031,7 @@ function pipelineRunUrl(context, repository) {
170031170031* A reference that is not a branch and not a tag keeps its full name.
170032170032*/
170033170033function refName(ref) {
170034- return dist_text (ref)?.replace(/^refs\/(heads|tags)\//, "");
170034+ return text$1 (ref)?.replace(/^refs\/(heads|tags)\//, "");
170035170035}
170036170036/** Whether a reference is a branch or a tag. */
170037170037function refType(ref) {
@@ -170044,7 +170044,7 @@ function refType(ref) {
170044170044* The toolkit says each of these is a string.
170045170045* A run that does not set the variable makes it undefined all the same.
170046170046*/
170047- function dist_text (value) {
170047+ function text$1 (value) {
170048170048 return value === void 0 || value === "" ? void 0 : value;
170049170049}
170050170050/**
@@ -170083,6 +170083,15 @@ function stringifyError(e) {
170083170083/** The instrumentation scope name for everything this library emits. */
170084170084const SCOPE_NAME = "detsys-ts";
170085170085/**
170086+ * The version reported as the instrumentation scope's version.
170087+ *
170088+ * Honeycomb shows it as `library.version`, thus a query can say which release
170089+ * of this library made a span. It read `1.0` until 2026-09, which is the
170090+ * `$lib_version` that the PostHog instrumentation reported, and which told
170091+ * nobody anything.
170092+ */
170093+ const LIBRARY_VERSION = "2.1.2";
170094+ /**
170086170095* The OTLP/HTTP collector for all Actions.
170087170096* The exporters add `/v1/traces` and `/v1/logs` to this URL.
170088170097*
@@ -170313,14 +170322,14 @@ var Telemetry = class {
170313170322* Telemetry.start} has run, so this is always safe to call.
170314170323*/
170315170324function getTracer() {
170316- return src.trace.getTracer(SCOPE_NAME, "1.0" );
170325+ return src.trace.getTracer(SCOPE_NAME, LIBRARY_VERSION );
170317170326}
170318170327/**
170319170328* The logger for this library. Returns a no-op logger until {@link
170320170329* Telemetry.start} has run, so this is always safe to call.
170321170330*/
170322170331function getLogger() {
170323- return build_src.logs.getLogger(SCOPE_NAME, "1.0" );
170332+ return build_src.logs.getLogger(SCOPE_NAME, LIBRARY_VERSION );
170324170333}
170325170334/**
170326170335* Emit a log record at `level`, correlated to whatever span is currently
@@ -170752,18 +170761,25 @@ function dist_setFailed(message, attributes) {
170752170761 setFailed(message);
170753170762}
170754170763/**
170755- * Run `fn` inside both a collapsible group in the workflow log and an active
170756- * OpenTelemetry span of the same name .
170764+ * Run a callback inside both a collapsible group in the workflow log and an active
170765+ * OpenTelemetry span.
170757170766*
170758- * This is the replacement for a `startGroup`/`endGroup` pair : the group closes
170767+ * This replaces `startGroup`/`endGroup`: the group closes
170759170768* and the span ends even if `fn` throws, and a throwing `fn` marks the span
170760170769* failed before re-throwing.
170770+ *
170771+ * `name` is the span name and `label` is the console heading
170772+ *
170773+ * @param name - The span name, such as `install_nix`.
170774+ * @param label - The heading of the group in the workflow log.
170775+ * @param fn - The work of the group. It receives the group's span.
170776+ * @param attributes - Attributes for the span.
170761170777*/
170762- async function dist_group(name, fn, attributes) {
170763- return await withSpan(name, async () => {
170764- startGroup(name );
170778+ async function dist_group(name, label, fn, attributes) {
170779+ return await withSpan(name, async (span ) => {
170780+ startGroup(label );
170765170781 try {
170766- return await fn();
170782+ return await fn({ span } );
170767170783 } finally {
170768170784 endGroup();
170769170785 }
@@ -170850,7 +170866,6 @@ function noisilyGetInput(suffix, legacyPrefix) {
170850170866const EVENT_IDS_FAILOVER = "detsys.ids_failover";
170851170867const EVENT_PREFLIGHT_REQUIRE_NIX_DENIED = "detsys.preflight_require_nix_denied";
170852170868const EVENT_REQUEST_TIMEOUT = "detsys.request_timeout";
170853- const EVENT_STORE_IDENTITY_FAILED = "detsys.store_identity_failed";
170854170869const ATTR_PROJECT = "detsys.project";
170855170870const ATTR_IDS_PROJECT = "detsys.ids_project";
170856170871const ATTR_EXECUTION_PHASE = "detsys.execution_phase";
@@ -171101,10 +171116,10 @@ var DetSysAction = class {
171101171116 const correlationHashes = JSON.stringify(this.getCorrelationHashes());
171102171117 process.env.DETSYS_CORRELATION = correlationHashes;
171103171118 try {
171104- await writeCorrelationHashes(correlationHashes);
171105- } catch (error) {
171106- this.addEvent(EVENT_STORE_IDENTITY_FAILED, { [semantic_conventions_build_src.ATTR_EXCEPTION_MESSAGE]: stringifyError$1(error) });
171107- }
171119+ await withSpan("store_identity", async () => {
171120+ await writeCorrelationHashes(correlationHashes);
171121+ });
171122+ } catch {}
171108171123 if (!await this.preflightRequireNix()) {
171109171124 this.addEvent(EVENT_PREFLIGHT_REQUIRE_NIX_DENIED);
171110171125 return;
@@ -171153,7 +171168,7 @@ var DetSysAction = class {
171153171168 async startTelemetry() {
171154171169 this.telemetry.start({
171155171170 serviceName: `${this.actionOptions.name}-action`,
171156- serviceVersion: process.env["GITHUB_ACTION_REF"],
171171+ serviceVersion: dist_text( process.env["GITHUB_ACTION_REF"]) ,
171157171172 resourceAttributes: await this.telemetryResourceAttributes()
171158171173 });
171159171174 }
@@ -171186,10 +171201,13 @@ var DetSysAction = class {
171186171201 *
171187171202 * The run and the repository are in the standard `cicd.*` and `vcs.*`
171188171203 * attributes, with the values themselves and not a hash of them.
171204+ *
171205+ * An attribute the run does not supply is absent. See {@link
171206+ * withoutEmptyValues}.
171189171207 */
171190171208 async telemetryResourceAttributes() {
171191171209 const details = await this.systemDetails;
171192- return {
171210+ return withoutEmptyValues( {
171193171211 [index_incubating.ATTR_OS_TYPE]: osType(),
171194171212 [index_incubating.ATTR_HOST_ARCH]: hostArch(),
171195171213 ...details?.name === void 0 || details.name === "unknown" ? {} : { [index_incubating.ATTR_OS_NAME]: details.name },
@@ -171206,7 +171224,7 @@ var DetSysAction = class {
171206171224 [ATTR_GITHUB_EVENT_NAME]: process.env["GITHUB_EVENT_NAME"],
171207171225 [ATTR_GITHUB_ACTION_REPOSITORY]: process.env["GITHUB_ACTION_REPOSITORY"],
171208171226 ...githubSemconvAttributes()
171209- };
171227+ }) ;
171210171228 }
171211171229 /**
171212171230 * The W3C `traceparent` identifying the span currently in progress.
@@ -171302,8 +171320,8 @@ var DetSysAction = class {
171302171320 async checkInPersonProperties() {
171303171321 const properties = {
171304171322 ci: "github",
171305- $lib: "idslib ",
171306- $lib_version: "1.0" ,
171323+ $lib: "detsys-ts ",
171324+ $lib_version: LIBRARY_VERSION ,
171307171325 $app_name: `${this.actionOptions.name}/action`,
171308171326 project: this.actionOptions.name,
171309171327 ids_project: this.actionOptions.idsProjectName,
@@ -171614,7 +171632,7 @@ var DetSysAction = class {
171614171632 core_debug(`Nix not at ${candidateNix}`);
171615171633 }
171616171634 }
171617- this.setAttribute(ATTR_NIX_LOCATION, nixLocation || "" );
171635+ if (nixLocation !== void 0) this.setAttribute(ATTR_NIX_LOCATION, nixLocation);
171618171636 if (this.actionOptions.requireNix === "ignore") return true;
171619171637 if (getState(STATE_KEY_NIX_NOT_FOUND) === STATE_NOT_FOUND) return false;
171620171638 if (nixLocation !== void 0) return true;
@@ -171663,7 +171681,7 @@ var DetSysAction = class {
171663171681 if (parsed.trusted === true || parsed.trusted === 1) this.nixStoreTrust = "trusted";
171664171682 else if (parsed.trusted === false || parsed.trusted === 0) this.nixStoreTrust = "untrusted";
171665171683 else if (parsed.trusted !== void 0) this.setAttribute(ATTR_NIX_STORE_CHECK_ERROR, `Mysterious trusted value: ${JSON.stringify(parsed.trusted)}`);
171666- this.setAttribute(ATTR_NIX_STORE_VERSION, JSON.stringify( parsed.version) );
171684+ if (typeof parsed.version === "string") this.setAttribute(ATTR_NIX_STORE_VERSION, parsed.version);
171667171685 } catch (e) {
171668171686 this.setAttribute(ATTR_NIX_STORE_CHECK_ERROR, stringifyError$1(e));
171669171687 }
@@ -171686,6 +171704,26 @@ function stringifyError$1(error) {
171686171704 return error instanceof Error || typeof error == "string" ? error.toString() : JSON.stringify(error);
171687171705}
171688171706/**
171707+ * A value the run supplies, or undefined.
171708+ *
171709+ * A variable the run does not set is undefined.
171710+ * A variable the run sets to nothing is empty.
171711+ * Neither one is a value, thus both become undefined here.
171712+ */
171713+ function dist_text(value) {
171714+ return value === void 0 || value === "" ? void 0 : value;
171715+ }
171716+ /**
171717+ * The attributes that have a value.
171718+ *
171719+ * An attribute with no value is not an attribute.
171720+ * It makes a column that says nothing, and it hides the difference between a
171721+ * value the run did not supply and a value that is empty.
171722+ */
171723+ function withoutEmptyValues(attributes) {
171724+ return Object.fromEntries(Object.entries(attributes).filter(([, value]) => value !== void 0 && value !== ""));
171725+ }
171726+ /**
171689171727* The runner's operating system, as `os.type` spells it.
171690171728*/
171691171729function osType() {
0 commit comments