mirror of
https://github.com/oven-sh/setup-bun.git
synced 2025-07-20 05:28:25 +02:00
feat: add @actions/cache
This commit is contained in:
parent
b15fb7d098
commit
16e8c96a41
1932 changed files with 261172 additions and 10 deletions
63
node_modules/@azure/core-tracing/dist-esm/src/createSpan.js
generated
vendored
Normal file
63
node_modules/@azure/core-tracing/dist-esm/src/createSpan.js
generated
vendored
Normal file
|
@ -0,0 +1,63 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
import { SpanKind, setSpan, context as otContext, getTracer } from "./interfaces";
|
||||
import { trace, INVALID_SPAN_CONTEXT } from "@opentelemetry/api";
|
||||
export function isTracingDisabled() {
|
||||
var _a;
|
||||
if (typeof process === "undefined") {
|
||||
// not supported in browser for now without polyfills
|
||||
return false;
|
||||
}
|
||||
const azureTracingDisabledValue = (_a = process.env.AZURE_TRACING_DISABLED) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
||||
if (azureTracingDisabledValue === "false" || azureTracingDisabledValue === "0") {
|
||||
return false;
|
||||
}
|
||||
return Boolean(azureTracingDisabledValue);
|
||||
}
|
||||
/**
|
||||
* Creates a function that can be used to create spans using the global tracer.
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
* ```typescript
|
||||
* // once
|
||||
* const createSpan = createSpanFunction({ packagePrefix: "Azure.Data.AppConfiguration", namespace: "Microsoft.AppConfiguration" });
|
||||
*
|
||||
* // in each operation
|
||||
* const span = createSpan("deleteConfigurationSetting", operationOptions);
|
||||
* // code...
|
||||
* span.end();
|
||||
* ```
|
||||
*
|
||||
* @hidden
|
||||
* @param args - allows configuration of the prefix for each span as well as the az.namespace field.
|
||||
*/
|
||||
export function createSpanFunction(args) {
|
||||
return function (operationName, operationOptions) {
|
||||
const tracer = getTracer();
|
||||
const tracingOptions = (operationOptions === null || operationOptions === void 0 ? void 0 : operationOptions.tracingOptions) || {};
|
||||
const spanOptions = Object.assign({ kind: SpanKind.INTERNAL }, tracingOptions.spanOptions);
|
||||
const spanName = args.packagePrefix ? `${args.packagePrefix}.${operationName}` : operationName;
|
||||
let span;
|
||||
if (isTracingDisabled()) {
|
||||
span = trace.wrapSpanContext(INVALID_SPAN_CONTEXT);
|
||||
}
|
||||
else {
|
||||
span = tracer.startSpan(spanName, spanOptions, tracingOptions.tracingContext);
|
||||
}
|
||||
if (args.namespace) {
|
||||
span.setAttribute("az.namespace", args.namespace);
|
||||
}
|
||||
let newSpanOptions = tracingOptions.spanOptions || {};
|
||||
if (span.isRecording() && args.namespace) {
|
||||
newSpanOptions = Object.assign(Object.assign({}, tracingOptions.spanOptions), { attributes: Object.assign(Object.assign({}, spanOptions.attributes), { "az.namespace": args.namespace }) });
|
||||
}
|
||||
const newTracingOptions = Object.assign(Object.assign({}, tracingOptions), { spanOptions: newSpanOptions, tracingContext: setSpan(tracingOptions.tracingContext || otContext.active(), span) });
|
||||
const newOperationOptions = Object.assign(Object.assign({}, operationOptions), { tracingOptions: newTracingOptions });
|
||||
return {
|
||||
span,
|
||||
updatedOptions: newOperationOptions
|
||||
};
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=createSpan.js.map
|
1
node_modules/@azure/core-tracing/dist-esm/src/createSpan.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-tracing/dist-esm/src/createSpan.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
9
node_modules/@azure/core-tracing/dist-esm/src/index.js
generated
vendored
Normal file
9
node_modules/@azure/core-tracing/dist-esm/src/index.js
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
// Tracers and wrappers
|
||||
export { createSpanFunction } from "./createSpan";
|
||||
// Shared interfaces
|
||||
export { context, getSpan, getSpanContext, getTracer, isSpanContextValid, setSpan, setSpanContext, SpanKind, SpanStatusCode } from "./interfaces";
|
||||
// Utilities
|
||||
export { extractSpanContextFromTraceParentHeader, getTraceParentHeader } from "./utils/traceParentHeader";
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/@azure/core-tracing/dist-esm/src/index.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-tracing/dist-esm/src/index.js.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,uBAAuB;AACvB,OAAO,EAAE,kBAAkB,EAA0B,MAAM,cAAc,CAAC;AAE1E,oBAAoB;AACpB,OAAO,EACL,OAAO,EAOP,OAAO,EACP,cAAc,EACd,SAAS,EAET,kBAAkB,EAGlB,OAAO,EACP,cAAc,EAKd,QAAQ,EAGR,cAAc,EAKf,MAAM,cAAc,CAAC;AAEtB,YAAY;AACZ,OAAO,EACL,uCAAuC,EACvC,oBAAoB,EACrB,MAAM,2BAA2B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n// Tracers and wrappers\nexport { createSpanFunction, CreateSpanFunctionArgs } from \"./createSpan\";\n\n// Shared interfaces\nexport {\n context,\n Context,\n ContextAPI,\n Exception,\n ExceptionWithCode,\n ExceptionWithMessage,\n ExceptionWithName,\n getSpan,\n getSpanContext,\n getTracer,\n HrTime,\n isSpanContextValid,\n Link,\n OperationTracingOptions,\n setSpan,\n setSpanContext,\n Span,\n SpanAttributes,\n SpanAttributeValue,\n SpanContext,\n SpanKind,\n SpanOptions,\n SpanStatus,\n SpanStatusCode,\n TimeInput,\n TraceFlags,\n Tracer,\n TraceState\n} from \"./interfaces\";\n\n// Utilities\nexport {\n extractSpanContextFromTraceParentHeader,\n getTraceParentHeader\n} from \"./utils/traceParentHeader\";\n"]}
|
102
node_modules/@azure/core-tracing/dist-esm/src/interfaces.js
generated
vendored
Normal file
102
node_modules/@azure/core-tracing/dist-esm/src/interfaces.js
generated
vendored
Normal file
|
@ -0,0 +1,102 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
import { context as otContext, trace as otTrace } from "@opentelemetry/api";
|
||||
/**
|
||||
* The kind of span.
|
||||
*/
|
||||
export var SpanKind;
|
||||
(function (SpanKind) {
|
||||
/** Default value. Indicates that the span is used internally. */
|
||||
SpanKind[SpanKind["INTERNAL"] = 0] = "INTERNAL";
|
||||
/**
|
||||
* Indicates that the span covers server-side handling of an RPC or other
|
||||
* remote request.
|
||||
*/
|
||||
SpanKind[SpanKind["SERVER"] = 1] = "SERVER";
|
||||
/**
|
||||
* Indicates that the span covers the client-side wrapper around an RPC or
|
||||
* other remote request.
|
||||
*/
|
||||
SpanKind[SpanKind["CLIENT"] = 2] = "CLIENT";
|
||||
/**
|
||||
* Indicates that the span describes producer sending a message to a
|
||||
* broker. Unlike client and server, there is no direct critical path latency
|
||||
* relationship between producer and consumer spans.
|
||||
*/
|
||||
SpanKind[SpanKind["PRODUCER"] = 3] = "PRODUCER";
|
||||
/**
|
||||
* Indicates that the span describes consumer receiving a message from a
|
||||
* broker. Unlike client and server, there is no direct critical path latency
|
||||
* relationship between producer and consumer spans.
|
||||
*/
|
||||
SpanKind[SpanKind["CONSUMER"] = 4] = "CONSUMER";
|
||||
})(SpanKind || (SpanKind = {}));
|
||||
/**
|
||||
* Return the span if one exists
|
||||
*
|
||||
* @param context - context to get span from
|
||||
*/
|
||||
export function getSpan(context) {
|
||||
return otTrace.getSpan(context);
|
||||
}
|
||||
/**
|
||||
* Set the span on a context
|
||||
*
|
||||
* @param context - context to use as parent
|
||||
* @param span - span to set active
|
||||
*/
|
||||
export function setSpan(context, span) {
|
||||
return otTrace.setSpan(context, span);
|
||||
}
|
||||
/**
|
||||
* Wrap span context in a NoopSpan and set as span in a new
|
||||
* context
|
||||
*
|
||||
* @param context - context to set active span on
|
||||
* @param spanContext - span context to be wrapped
|
||||
*/
|
||||
export function setSpanContext(context, spanContext) {
|
||||
return otTrace.setSpanContext(context, spanContext);
|
||||
}
|
||||
/**
|
||||
* Get the span context of the span if it exists.
|
||||
*
|
||||
* @param context - context to get values from
|
||||
*/
|
||||
export function getSpanContext(context) {
|
||||
return otTrace.getSpanContext(context);
|
||||
}
|
||||
/**
|
||||
* Returns true of the given {@link SpanContext} is valid.
|
||||
* A valid {@link SpanContext} is one which has a valid trace ID and span ID as per the spec.
|
||||
*
|
||||
* @param context - the {@link SpanContext} to validate.
|
||||
*
|
||||
* @returns true if the {@link SpanContext} is valid, false otherwise.
|
||||
*/
|
||||
export function isSpanContextValid(context) {
|
||||
return otTrace.isSpanContextValid(context);
|
||||
}
|
||||
export function getTracer(name, version) {
|
||||
return otTrace.getTracer(name || "azure/core-tracing", version);
|
||||
}
|
||||
/** Entrypoint for context API */
|
||||
export const context = otContext;
|
||||
/** SpanStatusCode */
|
||||
export var SpanStatusCode;
|
||||
(function (SpanStatusCode) {
|
||||
/**
|
||||
* The default status.
|
||||
*/
|
||||
SpanStatusCode[SpanStatusCode["UNSET"] = 0] = "UNSET";
|
||||
/**
|
||||
* The operation has been validated by an Application developer or
|
||||
* Operator to have completed successfully.
|
||||
*/
|
||||
SpanStatusCode[SpanStatusCode["OK"] = 1] = "OK";
|
||||
/**
|
||||
* The operation contains an error.
|
||||
*/
|
||||
SpanStatusCode[SpanStatusCode["ERROR"] = 2] = "ERROR";
|
||||
})(SpanStatusCode || (SpanStatusCode = {}));
|
||||
//# sourceMappingURL=interfaces.js.map
|
1
node_modules/@azure/core-tracing/dist-esm/src/interfaces.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-tracing/dist-esm/src/interfaces.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
48
node_modules/@azure/core-tracing/dist-esm/src/utils/traceParentHeader.js
generated
vendored
Normal file
48
node_modules/@azure/core-tracing/dist-esm/src/utils/traceParentHeader.js
generated
vendored
Normal file
|
@ -0,0 +1,48 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
const VERSION = "00";
|
||||
/**
|
||||
* Generates a `SpanContext` given a `traceparent` header value.
|
||||
* @param traceParent - Serialized span context data as a `traceparent` header value.
|
||||
* @returns The `SpanContext` generated from the `traceparent` value.
|
||||
*/
|
||||
export function extractSpanContextFromTraceParentHeader(traceParentHeader) {
|
||||
const parts = traceParentHeader.split("-");
|
||||
if (parts.length !== 4) {
|
||||
return;
|
||||
}
|
||||
const [version, traceId, spanId, traceOptions] = parts;
|
||||
if (version !== VERSION) {
|
||||
return;
|
||||
}
|
||||
const traceFlags = parseInt(traceOptions, 16);
|
||||
const spanContext = {
|
||||
spanId,
|
||||
traceId,
|
||||
traceFlags
|
||||
};
|
||||
return spanContext;
|
||||
}
|
||||
/**
|
||||
* Generates a `traceparent` value given a span context.
|
||||
* @param spanContext - Contains context for a specific span.
|
||||
* @returns The `spanContext` represented as a `traceparent` value.
|
||||
*/
|
||||
export function getTraceParentHeader(spanContext) {
|
||||
const missingFields = [];
|
||||
if (!spanContext.traceId) {
|
||||
missingFields.push("traceId");
|
||||
}
|
||||
if (!spanContext.spanId) {
|
||||
missingFields.push("spanId");
|
||||
}
|
||||
if (missingFields.length) {
|
||||
return;
|
||||
}
|
||||
const flags = spanContext.traceFlags || 0 /* NONE */;
|
||||
const hexFlags = flags.toString(16);
|
||||
const traceFlags = hexFlags.length === 1 ? `0${hexFlags}` : hexFlags;
|
||||
// https://www.w3.org/TR/trace-context/#traceparent-header-field-values
|
||||
return `${VERSION}-${spanContext.traceId}-${spanContext.spanId}-${traceFlags}`;
|
||||
}
|
||||
//# sourceMappingURL=traceParentHeader.js.map
|
1
node_modules/@azure/core-tracing/dist-esm/src/utils/traceParentHeader.js.map
generated
vendored
Normal file
1
node_modules/@azure/core-tracing/dist-esm/src/utils/traceParentHeader.js.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"traceParentHeader.js","sourceRoot":"","sources":["../../../src/utils/traceParentHeader.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,MAAM,OAAO,GAAG,IAAI,CAAC;AA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ft Corporation.\n// Licensed under the MIT license.\n\nimport { SpanContext, TraceFlags } from \"../interfaces\";\n\nconst VERSION = \"00\";\n\n/**\n * Generates a `SpanContext` given a `traceparent` header value.\n * @param traceParent - Serialized span context data as a `traceparent` header value.\n * @returns The `SpanContext` generated from the `traceparent` value.\n */\nexport function extractSpanContextFromTraceParentHeader(\n traceParentHeader: string\n): SpanContext | undefined {\n const parts = traceParentHeader.split(\"-\");\n\n if (parts.length !== 4) {\n return;\n }\n\n const [version, traceId, spanId, traceOptions] = parts;\n\n if (version !== VERSION) {\n return;\n }\n\n const traceFlags = parseInt(traceOptions, 16);\n\n const spanContext: SpanContext = {\n spanId,\n traceId,\n traceFlags\n };\n\n return spanContext;\n}\n\n/**\n * Generates a `traceparent` value given a span context.\n * @param spanContext - Contains context for a specific span.\n * @returns The `spanContext` represented as a `traceparent` value.\n */\nexport function getTraceParentHeader(spanContext: SpanContext): string | undefined {\n const missingFields: string[] = [];\n if (!spanContext.traceId) {\n missingFields.push(\"traceId\");\n }\n if (!spanContext.spanId) {\n missingFields.push(\"spanId\");\n }\n\n if (missingFields.length) {\n return;\n }\n\n const flags = spanContext.traceFlags || TraceFlags.NONE;\n const hexFlags = flags.toString(16);\n const traceFlags = hexFlags.length === 1 ? `0${hexFlags}` : hexFlags;\n\n // https://www.w3.org/TR/trace-context/#traceparent-header-field-values\n return `${VERSION}-${spanContext.traceId}-${spanContext.spanId}-${traceFlags}`;\n}\n"]}
|
Loading…
Add table
Add a link
Reference in a new issue