Skip to content

Commit da03c0f

Browse files
authored
Merge pull request #320 from detsys-pr-bot/detsys-ts-update-v2.1.3
Update `detsys-ts` to `v2.1.3`
2 parents 948b60f + 0352705 commit da03c0f

2 files changed

Lines changed: 54 additions & 11 deletions

File tree

‎dist/index.js‎

Lines changed: 51 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27426,7 +27426,7 @@ var __webpack_unused_export__;
2742627426
* SPDX-License-Identifier: Apache-2.0
2742727427
*/
2742827428
__webpack_unused_export__ = ({ value: true });
27429-
__webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = exports.J = exports.l = void 0;
27429+
exports.ix = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = exports.J = exports.l = void 0;
2743027430
var BasicTracerProvider_shim_1 = __nccwpck_require__(77254);
2743127431
Object.defineProperty(exports, "l", ({ enumerable: true, get: function () { return BasicTracerProvider_shim_1.BasicTracerProvider; } }));
2743227432
var BatchSpanProcessor_shim_1 = __nccwpck_require__(98462);
@@ -27442,7 +27442,7 @@ __webpack_unused_export__ = ({ enumerable: true, get: function () { return sdk_t
2744227442
__webpack_unused_export__ = ({ enumerable: true, get: function () { return sdk_trace_1.AlwaysOnSampler; } });
2744327443
__webpack_unused_export__ = ({ enumerable: true, get: function () { return sdk_trace_1.ParentBasedSampler; } });
2744427444
__webpack_unused_export__ = ({ enumerable: true, get: function () { return sdk_trace_1.TraceIdRatioBasedSampler; } });
27445-
__webpack_unused_export__ = ({ enumerable: true, get: function () { return sdk_trace_1.SamplingDecision; } });
27445+
Object.defineProperty(exports, "ix", ({ enumerable: true, get: function () { return sdk_trace_1.SamplingDecision; } }));
2744627446
//# sourceMappingURL=index-shim.js.map
2744727447

2744827448
/***/ }),
@@ -170090,7 +170090,7 @@ const SCOPE_NAME = "detsys-ts";
170090170090
* `$lib_version` that the PostHog instrumentation reported, and which told
170091170091
* nobody anything.
170092170092
*/
170093-
const LIBRARY_VERSION = "2.1.2";
170093+
const LIBRARY_VERSION = "2.1.3";
170094170094
/**
170095170095
* The OTLP/HTTP collector for all Actions.
170096170096
* The exporters add `/v1/traces` and `/v1/logs` to this URL.
@@ -170157,6 +170157,41 @@ const OTLP_EXPORT_VARIABLES = [
170157170157
* contextFromTraceparent} correct no matter when they're called.
170158170158
*/
170159170159
const PROPAGATOR = new core_build_src.W3CTraceContextPropagator();
170160+
/** OpenTelemetry's vendor key in `tracestate`. */
170161+
const TRACE_STATE_KEY = "ot";
170162+
const RANDOMNESS_HEX_DIGITS = 14;
170163+
/**
170164+
* The sampling randomness for `source`, as lowercase hexadecimal. Hashed,
170165+
* because a sampler compares this against a threshold and that is only fair
170166+
* if the value is uniformly distributed.
170167+
*/
170168+
function samplingRandomnessOf(source) {
170169+
return (0,external_node_crypto_.createHash)("sha256").update(source).digest("hex").slice(0, RANDOMNESS_HEX_DIGITS);
170170+
}
170171+
/**
170172+
* Records every span, and gives every trace it starts the same randomness.
170173+
*
170174+
* Each execution phase is a trace of its own, so a sampler keying on trace
170175+
* randomness would keep a job's `main` phase and drop its `post`. One shared
170176+
* value gets one decision for both. This discards nothing itself; the
170177+
* collector decides what to keep.
170178+
*/
170179+
var SharedRandomnessSampler = class {
170180+
constructor(randomness) {
170181+
this.traceState = new core_build_src.TraceState().set(TRACE_STATE_KEY, `rv:${randomness}`);
170182+
}
170183+
shouldSample(context) {
170184+
const parent = src.trace.getSpanContext(context);
170185+
const isRoot = parent === void 0 || !src.isSpanContextValid(parent);
170186+
return {
170187+
decision: index_shim/* SamplingDecision */.ix.RECORD_AND_SAMPLED,
170188+
traceState: isRoot ? this.traceState : parent.traceState
170189+
};
170190+
}
170191+
toString() {
170192+
return "SharedRandomnessSampler";
170193+
}
170194+
};
170160170195
const SEVERITY = {
170161170196
debug: build_src.SeverityNumber.DEBUG,
170162170197
info: build_src.SeverityNumber.INFO,
@@ -170280,6 +170315,7 @@ var Telemetry = class {
170280170315
})).merge(resources_build_src.detectResources({ detectors: [resources_build_src.envDetector] }));
170281170316
this.tracerProvider = new index_shim/* BasicTracerProvider */.l({
170282170317
resource,
170318+
...options.samplingRandomnessSource === void 0 ? {} : { sampler: new SharedRandomnessSampler(samplingRandomnessOf(options.samplingRandomnessSource)) },
170283170319
spanProcessors: [new index_shim/* BatchSpanProcessor */.J(new exporter_trace_otlp_http_build_src/* OTLPTraceExporter */.Q())]
170284170320
});
170285170321
this.loggerProvider = new sdk_logs_build_src/* LoggerProvider */.IB({
@@ -170890,6 +170926,8 @@ const ATTR_NIX_STORE_TRUST = "detsys.nix.store_trust";
170890170926
const ATTR_NIX_STORE_VERSION = "detsys.nix.store_version";
170891170927
const ATTR_NIX_STORE_CHECK_METHOD = "detsys.nix.store_check_method";
170892170928
const ATTR_NIX_STORE_CHECK_ERROR = "detsys.nix.store_check_error";
170929+
const ATTR_IDENTITY_STORED = "detsys.identity.stored";
170930+
const ATTR_IDENTITY_STORE_ERROR = "detsys.identity.store_error";
170893170931
const ATTR_ATTACHMENT_NAME = "detsys.attachment.name";
170894170932
const ATTR_ATTACHMENT_PATH = "detsys.attachment.path";
170895170933
const STATE_KEY_EXECUTION_PHASE = "detsys_action_execution_phase";
@@ -171115,11 +171153,15 @@ var DetSysAction = class {
171115171153
});
171116171154
const correlationHashes = JSON.stringify(this.getCorrelationHashes());
171117171155
process.env.DETSYS_CORRELATION = correlationHashes;
171118-
try {
171119-
await withSpan("store_identity", async () => {
171156+
await withSpan("store_identity", async (span) => {
171157+
try {
171120171158
await writeCorrelationHashes(correlationHashes);
171121-
});
171122-
} catch {}
171159+
span.setAttribute(ATTR_IDENTITY_STORED, true);
171160+
} catch (e) {
171161+
span.setAttribute(ATTR_IDENTITY_STORED, false);
171162+
span.setAttribute(ATTR_IDENTITY_STORE_ERROR, stringifyError$1(e));
171163+
}
171164+
});
171123171165
if (!await this.preflightRequireNix()) {
171124171166
this.addEvent(EVENT_PREFLIGHT_REQUIRE_NIX_DENIED);
171125171167
return;
@@ -171169,7 +171211,8 @@ var DetSysAction = class {
171169171211
this.telemetry.start({
171170171212
serviceName: `${this.actionOptions.name}-action`,
171171171213
serviceVersion: dist_text(process.env["GITHUB_ACTION_REF"]),
171172-
resourceAttributes: await this.telemetryResourceAttributes()
171214+
resourceAttributes: await this.telemetryResourceAttributes(),
171215+
samplingRandomnessSource: this.getInvocationId()
171173171216
});
171174171217
}
171175171218
/**

‎package-lock.json‎

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)