Skip to content

Commit 9070c89

Browse files
authored
Merge pull request #197 from detsys-pr-bot/detsys-ts-update-0095c476e55f64d04f1aa1e1bcc2524c329d073a
Update `detsys-ts`: Skip complicated rewrites, record groups. (#104)
2 parents 3ce5967 + 32851b9 commit 9070c89

File tree

3 files changed

+337
-330
lines changed

3 files changed

+337
-330
lines changed

dist/index.js

Lines changed: 62 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -89478,7 +89478,7 @@ var cache = __nccwpck_require__(7389);
8947889478
var external_child_process_ = __nccwpck_require__(5317);
8947989479
// EXTERNAL MODULE: external "path"
8948089480
var external_path_ = __nccwpck_require__(6928);
89481-
;// CONCATENATED MODULE: ./node_modules/.pnpm/detsys-ts@https+++codeload.github.com+DeterminateSystems+detsys-ts+tar.gz+5084fa8e3263a_a2ac939c447d828e4767290fb0939d82/node_modules/detsys-ts/dist/index.js
89481+
;// CONCATENATED MODULE: ./node_modules/.pnpm/detsys-ts@https+++codeload.github.com+DeterminateSystems+detsys-ts+tar.gz+0095c476e55f6_afe2535b95cf72dc75f2dc7dcdd6a059/node_modules/detsys-ts/dist/index.js
8948289482
var __defProp = Object.defineProperty;
8948389483
var __export = (target, all) => {
8948489484
for (var name in all)
@@ -89864,25 +89864,40 @@ async function collectBacktracesSystemd(prefixes, programNameDenyList, startTime
8986489864

8986589865

8986689866
var OPTIONAL_VARIABLES = ["INVOCATION_ID"];
89867-
function identify(projectName) {
89867+
function identify() {
89868+
const repository = hashEnvironmentVariables("GHR", [
89869+
"GITHUB_SERVER_URL",
89870+
"GITHUB_REPOSITORY_OWNER",
89871+
"GITHUB_REPOSITORY_OWNER_ID",
89872+
"GITHUB_REPOSITORY",
89873+
"GITHUB_REPOSITORY_ID"
89874+
]);
89875+
const run_differentiator = hashEnvironmentVariables("GHWJA", [
89876+
"GITHUB_SERVER_URL",
89877+
"GITHUB_REPOSITORY_OWNER",
89878+
"GITHUB_REPOSITORY_OWNER_ID",
89879+
"GITHUB_REPOSITORY",
89880+
"GITHUB_REPOSITORY_ID",
89881+
"GITHUB_WORKFLOW",
89882+
"GITHUB_JOB",
89883+
"GITHUB_RUN_ID",
89884+
"GITHUB_RUN_NUMBER",
89885+
"GITHUB_RUN_ATTEMPT",
89886+
"INVOCATION_ID"
89887+
]);
8986889888
const ident = {
89889+
$anon_distinct_id: process.env["RUNNER_TRACKING_ID"] || (0,external_crypto_.randomUUID)(),
8986989890
correlation_source: "github-actions",
89870-
repository: hashEnvironmentVariables("GHR", [
89871-
"GITHUB_SERVER_URL",
89872-
"GITHUB_REPOSITORY_OWNER",
89873-
"GITHUB_REPOSITORY_OWNER_ID",
89874-
"GITHUB_REPOSITORY",
89875-
"GITHUB_REPOSITORY_ID"
89876-
]),
89877-
workflow: hashEnvironmentVariables("GHW", [
89891+
github_repository_hash: repository,
89892+
github_workflow_hash: hashEnvironmentVariables("GHW", [
8987889893
"GITHUB_SERVER_URL",
8987989894
"GITHUB_REPOSITORY_OWNER",
8988089895
"GITHUB_REPOSITORY_OWNER_ID",
8988189896
"GITHUB_REPOSITORY",
8988289897
"GITHUB_REPOSITORY_ID",
8988389898
"GITHUB_WORKFLOW"
8988489899
]),
89885-
job: hashEnvironmentVariables("GHWJ", [
89900+
github_workflow_job_hash: hashEnvironmentVariables("GHWJ", [
8988689901
"GITHUB_SERVER_URL",
8988789902
"GITHUB_REPOSITORY_OWNER",
8988889903
"GITHUB_REPOSITORY_OWNER_ID",
@@ -89891,7 +89906,7 @@ function identify(projectName) {
8989189906
"GITHUB_WORKFLOW",
8989289907
"GITHUB_JOB"
8989389908
]),
89894-
run: hashEnvironmentVariables("GHWJR", [
89909+
github_workflow_run_hash: hashEnvironmentVariables("GHWJR", [
8989589910
"GITHUB_SERVER_URL",
8989689911
"GITHUB_REPOSITORY_OWNER",
8989789912
"GITHUB_REPOSITORY_OWNER_ID",
@@ -89901,22 +89916,10 @@ function identify(projectName) {
8990189916
"GITHUB_JOB",
8990289917
"GITHUB_RUN_ID"
8990389918
]),
89904-
run_differentiator: hashEnvironmentVariables("GHWJA", [
89905-
"GITHUB_SERVER_URL",
89906-
"GITHUB_REPOSITORY_OWNER",
89907-
"GITHUB_REPOSITORY_OWNER_ID",
89908-
"GITHUB_REPOSITORY",
89909-
"GITHUB_REPOSITORY_ID",
89910-
"GITHUB_WORKFLOW",
89911-
"GITHUB_JOB",
89912-
"GITHUB_RUN_ID",
89913-
"GITHUB_RUN_NUMBER",
89914-
"GITHUB_RUN_ATTEMPT",
89915-
"INVOCATION_ID"
89916-
]),
89917-
groups: {
89918-
ci: "github-actions",
89919-
project: projectName,
89919+
github_workflow_run_differentiator_hash: run_differentiator,
89920+
$session_id: run_differentiator,
89921+
$groups: {
89922+
github_repository: repository,
8992089923
github_organization: hashEnvironmentVariables("GHO", [
8992189924
"GITHUB_SERVER_URL",
8992289925
"GITHUB_REPOSITORY_OWNER",
@@ -90079,9 +90082,7 @@ var IdsHost = class {
9007990082
}
9008090083
try {
9008190084
const diagnosticUrl = await this.getRootUrl();
90082-
diagnosticUrl.pathname += this.idsProjectName;
90083-
diagnosticUrl.pathname += "/";
90084-
diagnosticUrl.pathname += this.diagnosticsSuffix || "diagnostics";
90085+
diagnosticUrl.pathname += "events/batch";
9008590086
return diagnosticUrl;
9008690087
} catch (err) {
9008790088
core.info(
@@ -90485,9 +90486,10 @@ var DetSysAction = class {
9048590486
this.facts[target] = value;
9048690487
}
9048790488
}
90488-
this.identity = identify(this.actionOptions.name);
90489+
this.identity = identify();
9048990490
this.archOs = getArchOs();
9049090491
this.nixSystem = getNixPlatform(this.archOs);
90492+
this.facts.$app_name = `${this.actionOptions.name}/action`;
9049190493
this.facts.arch_os = this.archOs;
9049290494
this.facts.nix_system = this.nixSystem;
9049390495
{
@@ -90553,7 +90555,7 @@ var DetSysAction = class {
9055390555
return await this.idsHost.getDiagnosticsUrl();
9055490556
}
9055590557
getUniqueId() {
90556-
return this.identity.run_differentiator || process.env.RUNNER_TRACKING_ID || (0,external_crypto_.randomUUID)();
90558+
return this.identity.github_workflow_run_differentiator_hash || process.env.RUNNER_TRACKING_ID || (0,external_crypto_.randomUUID)();
9055790559
}
9055890560
// This ID will be saved in the action's state, to be persisted across phase steps
9055990561
getCrossPhaseId() {
@@ -90570,13 +90572,20 @@ var DetSysAction = class {
9057090572
recordEvent(eventName, context = {}) {
9057190573
const prefixedName = eventName === "$feature_flag_called" ? eventName : `${this.actionOptions.eventPrefix}${eventName}`;
9057290574
this.events.push({
90573-
event_name: prefixedName,
90574-
context,
90575-
correlation: this.identity,
90576-
facts: this.facts,
90577-
features: this.featureEventMetadata,
90575+
name: prefixedName,
90576+
// Use the anon distinct ID as the distinct ID until we actually have a distinct ID in the future
90577+
distinct_id: this.identity.$anon_distinct_id,
90578+
// distinct_id
90579+
uuid: (0,external_crypto_.randomUUID)(),
9057890580
timestamp: /* @__PURE__ */ new Date(),
90579-
uuid: (0,external_crypto_.randomUUID)()
90581+
properties: {
90582+
...context,
90583+
...this.identity,
90584+
...this.facts,
90585+
...Object.fromEntries(
90586+
Object.entries(this.featureEventMetadata).map(([name, variant]) => [`$feature/${name}`, variant])
90587+
)
90588+
}
9058090589
});
9058190590
}
9058290591
/**
@@ -90747,12 +90756,19 @@ var DetSysAction = class {
9074790756
}
9074890757
try {
9074990758
core.debug(`Preflighting via ${checkInUrl}`);
90750-
checkInUrl.searchParams.set("ci", "github");
90751-
checkInUrl.searchParams.set(
90752-
"correlation",
90753-
JSON.stringify(this.identity)
90754-
);
90755-
return (await this.getClient()).get(checkInUrl, {
90759+
const props = {
90760+
// Use a distinct_id when we actually have one
90761+
distinct_id: this.identity.$anon_distinct_id,
90762+
anon_distinct_id: this.identity.$anon_distinct_id,
90763+
groups: this.identity.$groups,
90764+
person_properties: {
90765+
ci: "github",
90766+
...this.identity,
90767+
...this.facts
90768+
}
90769+
};
90770+
return (await this.getClient()).post(checkInUrl, {
90771+
json: props,
9075690772
timeout: {
9075790773
request: CHECK_IN_ENDPOINT_TIMEOUT_MS
9075890774
}
@@ -91093,9 +91109,8 @@ var DetSysAction = class {
9109391109
return;
9109491110
}
9109591111
const batch = {
91096-
type: "eventlog",
9109791112
sent_at: /* @__PURE__ */ new Date(),
91098-
events: this.events
91113+
batch: this.events
9109991114
};
9110091115
try {
9110191116
await (await this.getClient()).post(diagnosticsUrl, {

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
"eslint-import-resolver-typescript": "^3.10.1",
3939
"eslint-plugin-github": "^4.10.2",
4040
"eslint-plugin-import": "^2.32.0",
41-
"eslint-plugin-prettier": "^5.5.0",
42-
"prettier": "^3.6.0",
41+
"eslint-plugin-prettier": "^5.5.1",
42+
"prettier": "^3.6.2",
4343
"tsup": "^8.5.0",
4444
"typescript": "^5.8.3",
4545
"vitest": "^3.2.4"

0 commit comments

Comments
 (0)