mirror of
https://github.com/denoland/deno.git
synced 2025-01-21 13:00:36 -05:00
feat(unstable): replace SpanExporter with TracerProvider (#27473)
This commit is contained in:
parent
9ad0d4c3db
commit
4b35ba6b13
12 changed files with 1142 additions and 1053 deletions
|
@ -447,8 +447,9 @@ fn resolve_flags_and_init(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
deno_telemetry::init(crate::args::otel_runtime_config())?;
|
let otel_config = flags.otel_config();
|
||||||
util::logger::init(flags.log_level, Some(flags.otel_config()));
|
deno_telemetry::init(crate::args::otel_runtime_config(), &otel_config)?;
|
||||||
|
util::logger::init(flags.log_level, Some(otel_config));
|
||||||
|
|
||||||
// TODO(bartlomieju): remove in Deno v2.5 and hard error then.
|
// TODO(bartlomieju): remove in Deno v2.5 and hard error then.
|
||||||
if flags.unstable_config.legacy_flag_enabled {
|
if flags.unstable_config.legacy_flag_enabled {
|
||||||
|
|
|
@ -89,7 +89,10 @@ fn main() {
|
||||||
let future = async move {
|
let future = async move {
|
||||||
match standalone {
|
match standalone {
|
||||||
Ok(Some(data)) => {
|
Ok(Some(data)) => {
|
||||||
deno_telemetry::init(crate::args::otel_runtime_config())?;
|
deno_telemetry::init(
|
||||||
|
crate::args::otel_runtime_config(),
|
||||||
|
&data.metadata.otel_config,
|
||||||
|
)?;
|
||||||
util::logger::init(
|
util::logger::init(
|
||||||
data.metadata.log_level,
|
data.metadata.log_level,
|
||||||
Some(data.metadata.otel_config.clone()),
|
Some(data.metadata.otel_config.clone()),
|
||||||
|
|
31
cli/tsc/dts/lib.deno.unstable.d.ts
vendored
31
cli/tsc/dts/lib.deno.unstable.d.ts
vendored
|
@ -1301,20 +1301,43 @@ declare namespace Deno {
|
||||||
*/
|
*/
|
||||||
export namespace telemetry {
|
export namespace telemetry {
|
||||||
/**
|
/**
|
||||||
* A SpanExporter compatible with OpenTelemetry.js
|
* A TracerProvider compatible with OpenTelemetry.js
|
||||||
* https://open-telemetry.github.io/opentelemetry-js/interfaces/_opentelemetry_sdk_trace_base.SpanExporter.html
|
* https://open-telemetry.github.io/opentelemetry-js/interfaces/_opentelemetry_api.TracerProvider.html
|
||||||
|
*
|
||||||
|
* This is a singleton object that implements the OpenTelemetry
|
||||||
|
* TracerProvider interface.
|
||||||
|
*
|
||||||
* @category Telemetry
|
* @category Telemetry
|
||||||
* @experimental
|
* @experimental
|
||||||
*/
|
*/
|
||||||
export class SpanExporter {}
|
// deno-lint-ignore no-explicit-any
|
||||||
|
export const tracerProvider: any;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A ContextManager compatible with OpenTelemetry.js
|
* A ContextManager compatible with OpenTelemetry.js
|
||||||
* https://open-telemetry.github.io/opentelemetry-js/interfaces/_opentelemetry_api.ContextManager.html
|
* https://open-telemetry.github.io/opentelemetry-js/interfaces/_opentelemetry_api.ContextManager.html
|
||||||
|
*
|
||||||
|
* This is a singleton object that implements the OpenTelemetry
|
||||||
|
* ContextManager interface.
|
||||||
|
*
|
||||||
* @category Telemetry
|
* @category Telemetry
|
||||||
* @experimental
|
* @experimental
|
||||||
*/
|
*/
|
||||||
export class ContextManager {}
|
// deno-lint-ignore no-explicit-any
|
||||||
|
export const contextManager: any;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A MeterProvider compatible with OpenTelemetry.js
|
||||||
|
* https://open-telemetry.github.io/opentelemetry-js/interfaces/_opentelemetry_api.MeterProvider.html
|
||||||
|
*
|
||||||
|
* This is a singleton object that implements the OpenTelemetry
|
||||||
|
* MeterProvider interface.
|
||||||
|
*
|
||||||
|
* @category Telemetry
|
||||||
|
* @experimental
|
||||||
|
*/
|
||||||
|
// deno-lint-ignore no-explicit-any
|
||||||
|
export const meterProvider: any;
|
||||||
|
|
||||||
export {}; // only export exports
|
export {}; // only export exports
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,10 +59,9 @@ import {
|
||||||
} from "ext:deno_fetch/23_response.js";
|
} from "ext:deno_fetch/23_response.js";
|
||||||
import * as abortSignal from "ext:deno_web/03_abort_signal.js";
|
import * as abortSignal from "ext:deno_web/03_abort_signal.js";
|
||||||
import {
|
import {
|
||||||
endSpan,
|
builtinTracer,
|
||||||
enterSpan,
|
enterSpan,
|
||||||
exitSpan,
|
restoreContext,
|
||||||
Span,
|
|
||||||
TRACING_ENABLED,
|
TRACING_ENABLED,
|
||||||
} from "ext:deno_telemetry/telemetry.ts";
|
} from "ext:deno_telemetry/telemetry.ts";
|
||||||
import {
|
import {
|
||||||
|
@ -320,10 +319,10 @@ function httpRedirectFetch(request, response, terminator) {
|
||||||
// Drop confidential headers when redirecting to a less secure protocol
|
// Drop confidential headers when redirecting to a less secure protocol
|
||||||
// or to a different domain that is not a superdomain
|
// or to a different domain that is not a superdomain
|
||||||
if (
|
if (
|
||||||
locationURL.protocol !== currentURL.protocol &&
|
(locationURL.protocol !== currentURL.protocol &&
|
||||||
locationURL.protocol !== "https:" ||
|
locationURL.protocol !== "https:") ||
|
||||||
locationURL.host !== currentURL.host &&
|
(locationURL.host !== currentURL.host &&
|
||||||
!isSubdomain(locationURL.host, currentURL.host)
|
!isSubdomain(locationURL.host, currentURL.host))
|
||||||
) {
|
) {
|
||||||
for (let i = 0; i < request.headerList.length; i++) {
|
for (let i = 0; i < request.headerList.length; i++) {
|
||||||
if (
|
if (
|
||||||
|
@ -352,10 +351,11 @@ function httpRedirectFetch(request, response, terminator) {
|
||||||
*/
|
*/
|
||||||
function fetch(input, init = { __proto__: null }) {
|
function fetch(input, init = { __proto__: null }) {
|
||||||
let span;
|
let span;
|
||||||
|
let context;
|
||||||
try {
|
try {
|
||||||
if (TRACING_ENABLED) {
|
if (TRACING_ENABLED) {
|
||||||
span = new Span("fetch", { kind: 2 });
|
span = builtinTracer().startSpan("fetch", { kind: 2 });
|
||||||
enterSpan(span);
|
context = enterSpan(span);
|
||||||
}
|
}
|
||||||
|
|
||||||
// There is an async dispatch later that causes a stack trace disconnect.
|
// There is an async dispatch later that causes a stack trace disconnect.
|
||||||
|
@ -454,9 +454,7 @@ function fetch(input, init = { __proto__: null }) {
|
||||||
await opPromise;
|
await opPromise;
|
||||||
return result;
|
return result;
|
||||||
} finally {
|
} finally {
|
||||||
if (span) {
|
span?.end();
|
||||||
endSpan(span);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
|
@ -469,19 +467,17 @@ function fetch(input, init = { __proto__: null }) {
|
||||||
// XXX: This should always be true, otherwise `opPromise` would be present.
|
// XXX: This should always be true, otherwise `opPromise` would be present.
|
||||||
if (op_fetch_promise_is_settled(result)) {
|
if (op_fetch_promise_is_settled(result)) {
|
||||||
// It's already settled.
|
// It's already settled.
|
||||||
endSpan(span);
|
span?.end();
|
||||||
} else {
|
} else {
|
||||||
// Not settled yet, we can return a new wrapper promise.
|
// Not settled yet, we can return a new wrapper promise.
|
||||||
return SafePromisePrototypeFinally(result, () => {
|
return SafePromisePrototypeFinally(result, () => {
|
||||||
endSpan(span);
|
span?.end();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
} finally {
|
} finally {
|
||||||
if (span) {
|
if (context) restoreContext(context);
|
||||||
exitSpan(span);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -508,8 +504,11 @@ function abortFetch(request, responseObject, error) {
|
||||||
*/
|
*/
|
||||||
function isSubdomain(subdomain, domain) {
|
function isSubdomain(subdomain, domain) {
|
||||||
const dot = subdomain.length - domain.length - 1;
|
const dot = subdomain.length - domain.length - 1;
|
||||||
return dot > 0 && subdomain[dot] === "." &&
|
return (
|
||||||
StringPrototypeEndsWith(subdomain, domain);
|
dot > 0 &&
|
||||||
|
subdomain[dot] === "." &&
|
||||||
|
StringPrototypeEndsWith(subdomain, domain)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -43,10 +43,7 @@ const {
|
||||||
Uint8Array,
|
Uint8Array,
|
||||||
Promise,
|
Promise,
|
||||||
} = primordials;
|
} = primordials;
|
||||||
const {
|
const { getAsyncContext, setAsyncContext } = core;
|
||||||
getAsyncContext,
|
|
||||||
setAsyncContext,
|
|
||||||
} = core;
|
|
||||||
|
|
||||||
import { InnerBody } from "ext:deno_fetch/22_body.js";
|
import { InnerBody } from "ext:deno_fetch/22_body.js";
|
||||||
import { Event } from "ext:deno_web/02_event.js";
|
import { Event } from "ext:deno_web/02_event.js";
|
||||||
|
@ -90,9 +87,8 @@ import {
|
||||||
import { hasTlsKeyPairOptions, listenTls } from "ext:deno_net/02_tls.js";
|
import { hasTlsKeyPairOptions, listenTls } from "ext:deno_net/02_tls.js";
|
||||||
import { SymbolAsyncDispose } from "ext:deno_web/00_infra.js";
|
import { SymbolAsyncDispose } from "ext:deno_web/00_infra.js";
|
||||||
import {
|
import {
|
||||||
endSpan,
|
builtinTracer,
|
||||||
enterSpan,
|
enterSpan,
|
||||||
Span,
|
|
||||||
TRACING_ENABLED,
|
TRACING_ENABLED,
|
||||||
} from "ext:deno_telemetry/telemetry.ts";
|
} from "ext:deno_telemetry/telemetry.ts";
|
||||||
import {
|
import {
|
||||||
|
@ -288,28 +284,28 @@ class InnerRequest {
|
||||||
|
|
||||||
// * is valid for OPTIONS
|
// * is valid for OPTIONS
|
||||||
if (path === "*") {
|
if (path === "*") {
|
||||||
return this.#urlValue = "*";
|
return (this.#urlValue = "*");
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the path is empty, return the authority (valid for CONNECT)
|
// If the path is empty, return the authority (valid for CONNECT)
|
||||||
if (path == "") {
|
if (path == "") {
|
||||||
return this.#urlValue = this.#methodAndUri[1];
|
return (this.#urlValue = this.#methodAndUri[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// CONNECT requires an authority
|
// CONNECT requires an authority
|
||||||
if (this.#methodAndUri[0] == "CONNECT") {
|
if (this.#methodAndUri[0] == "CONNECT") {
|
||||||
return this.#urlValue = this.#methodAndUri[1];
|
return (this.#urlValue = this.#methodAndUri[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const hostname = this.#methodAndUri[1];
|
const hostname = this.#methodAndUri[1];
|
||||||
if (hostname) {
|
if (hostname) {
|
||||||
// Construct a URL from the scheme, the hostname, and the path
|
// Construct a URL from the scheme, the hostname, and the path
|
||||||
return this.#urlValue = this.#context.scheme + hostname + path;
|
return (this.#urlValue = this.#context.scheme + hostname + path);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Construct a URL from the scheme, the fallback hostname, and the path
|
// Construct a URL from the scheme, the fallback hostname, and the path
|
||||||
return this.#urlValue = this.#context.scheme + this.#context.fallbackHost +
|
return (this.#urlValue = this.#context.scheme + this.#context.fallbackHost +
|
||||||
path;
|
path);
|
||||||
}
|
}
|
||||||
|
|
||||||
get completed() {
|
get completed() {
|
||||||
|
@ -414,10 +410,7 @@ class InnerRequest {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PromisePrototypeThen(
|
PromisePrototypeThen(op_http_request_on_cancel(this.#external), callback);
|
||||||
op_http_request_on_cancel(this.#external),
|
|
||||||
callback,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -521,12 +514,7 @@ function fastSyncResponseOrStream(
|
||||||
autoClose = true;
|
autoClose = true;
|
||||||
}
|
}
|
||||||
PromisePrototypeThen(
|
PromisePrototypeThen(
|
||||||
op_http_set_response_body_resource(
|
op_http_set_response_body_resource(req, rid, autoClose, status),
|
||||||
req,
|
|
||||||
rid,
|
|
||||||
autoClose,
|
|
||||||
status,
|
|
||||||
),
|
|
||||||
(success) => {
|
(success) => {
|
||||||
innerRequest?.close(success);
|
innerRequest?.close(success);
|
||||||
op_http_close_after_finish(req);
|
op_http_close_after_finish(req);
|
||||||
|
@ -556,10 +544,7 @@ function mapToCallback(context, callback, onError) {
|
||||||
updateSpanFromRequest(span, request);
|
updateSpanFromRequest(span, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
response = await callback(
|
response = await callback(request, new ServeHandlerInfo(innerRequest));
|
||||||
request,
|
|
||||||
new ServeHandlerInfo(innerRequest),
|
|
||||||
);
|
|
||||||
|
|
||||||
// Throwing Error if the handler return value is not a Response class
|
// Throwing Error if the handler return value is not a Response class
|
||||||
if (!ObjectPrototypeIsPrototypeOf(ResponsePrototype, response)) {
|
if (!ObjectPrototypeIsPrototypeOf(ResponsePrototype, response)) {
|
||||||
|
@ -636,12 +621,12 @@ function mapToCallback(context, callback, onError) {
|
||||||
mapped = function (req, _span) {
|
mapped = function (req, _span) {
|
||||||
const oldCtx = getAsyncContext();
|
const oldCtx = getAsyncContext();
|
||||||
setAsyncContext(context.asyncContext);
|
setAsyncContext(context.asyncContext);
|
||||||
const span = new Span("deno.serve", { kind: 1 });
|
const span = builtinTracer().startSpan("deno.serve", { kind: 1 });
|
||||||
try {
|
try {
|
||||||
enterSpan(span);
|
enterSpan(span);
|
||||||
return SafePromisePrototypeFinally(
|
return SafePromisePrototypeFinally(
|
||||||
origMapped(req, span),
|
origMapped(req, span),
|
||||||
() => endSpan(span),
|
() => span.end(),
|
||||||
);
|
);
|
||||||
} finally {
|
} finally {
|
||||||
// equiv to exitSpan.
|
// equiv to exitSpan.
|
||||||
|
@ -688,7 +673,7 @@ function formatHostName(hostname: string): string {
|
||||||
// because browsers in Windows don't resolve "0.0.0.0".
|
// because browsers in Windows don't resolve "0.0.0.0".
|
||||||
// See the discussion in https://github.com/denoland/deno_std/issues/1165
|
// See the discussion in https://github.com/denoland/deno_std/issues/1165
|
||||||
if (
|
if (
|
||||||
(Deno.build.os === "windows") &&
|
Deno.build.os === "windows" &&
|
||||||
(hostname == "0.0.0.0" || hostname == "::")
|
(hostname == "0.0.0.0" || hostname == "::")
|
||||||
) {
|
) {
|
||||||
return "localhost";
|
return "localhost";
|
||||||
|
@ -730,11 +715,12 @@ function serve(arg1, arg2) {
|
||||||
const wantsHttps = hasTlsKeyPairOptions(options);
|
const wantsHttps = hasTlsKeyPairOptions(options);
|
||||||
const wantsUnix = ObjectHasOwn(options, "path");
|
const wantsUnix = ObjectHasOwn(options, "path");
|
||||||
const signal = options.signal;
|
const signal = options.signal;
|
||||||
const onError = options.onError ?? function (error) {
|
const onError = options.onError ??
|
||||||
// deno-lint-ignore no-console
|
function (error) {
|
||||||
console.error(error);
|
// deno-lint-ignore no-console
|
||||||
return internalServerError();
|
console.error(error);
|
||||||
};
|
return internalServerError();
|
||||||
|
};
|
||||||
|
|
||||||
if (wantsUnix) {
|
if (wantsUnix) {
|
||||||
const listener = listen({
|
const listener = listen({
|
||||||
|
@ -843,10 +829,7 @@ function serveHttpOn(context, addr, callback) {
|
||||||
const promiseErrorHandler = (error) => {
|
const promiseErrorHandler = (error) => {
|
||||||
// Abnormal exit
|
// Abnormal exit
|
||||||
// deno-lint-ignore no-console
|
// deno-lint-ignore no-console
|
||||||
console.error(
|
console.error("Terminating Deno.serve loop due to unexpected error", error);
|
||||||
"Terminating Deno.serve loop due to unexpected error",
|
|
||||||
error,
|
|
||||||
);
|
|
||||||
context.close();
|
context.close();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -964,7 +947,7 @@ function registerDeclarativeServer(exports) {
|
||||||
port: servePort,
|
port: servePort,
|
||||||
hostname: serveHost,
|
hostname: serveHost,
|
||||||
[kLoadBalanced]: (serveIsMain && serveWorkerCount > 1) ||
|
[kLoadBalanced]: (serveIsMain && serveWorkerCount > 1) ||
|
||||||
(serveWorkerCount !== null),
|
serveWorkerCount !== null,
|
||||||
onListen: ({ port, hostname }) => {
|
onListen: ({ port, hostname }) => {
|
||||||
if (serveIsMain) {
|
if (serveIsMain) {
|
||||||
const nThreads = serveWorkerCount > 1
|
const nThreads = serveWorkerCount > 1
|
||||||
|
|
1063
ext/telemetry/lib.rs
1063
ext/telemetry/lib.rs
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,38 +1,15 @@
|
||||||
// Copyright 2024-2024 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2024-2024 the Deno authors. All rights reserved. MIT license.
|
||||||
|
|
||||||
import { context } from "npm:@opentelemetry/api@1";
|
import { context, trace, metrics } from "npm:@opentelemetry/api@1";
|
||||||
import {
|
|
||||||
BasicTracerProvider,
|
|
||||||
SimpleSpanProcessor,
|
|
||||||
} from "npm:@opentelemetry/sdk-trace-base@1";
|
|
||||||
|
|
||||||
// @ts-ignore Deno.telemetry is not typed yet
|
// @ts-ignore Deno.telemetry is not typed yet
|
||||||
const telemetry = Deno.telemetry ?? Deno.tracing;
|
const telemetry = Deno.telemetry ?? Deno.tracing;
|
||||||
|
|
||||||
let COUNTER = 1;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register `Deno.telemetry` with the OpenTelemetry library.
|
* Register `Deno.telemetry` with the OpenTelemetry library.
|
||||||
*/
|
*/
|
||||||
export function register() {
|
export function register() {
|
||||||
context.setGlobalContextManager(
|
context.setGlobalContextManager(telemetry.contextManager);
|
||||||
new telemetry.ContextManager() ?? telemetry.ContextManager(),
|
trace.setGlobalTracerProvider(telemetry.tracerProvider);
|
||||||
);
|
metrics.setGlobalMeterProvider(telemetry.meterProvider);
|
||||||
|
|
||||||
const provider = new BasicTracerProvider({
|
|
||||||
idGenerator: Deno.env.get("DENO_UNSTABLE_OTEL_DETERMINISTIC") === "1" ? {
|
|
||||||
generateSpanId() {
|
|
||||||
return "1" + String(COUNTER++).padStart(15, "0");
|
|
||||||
},
|
|
||||||
generateTraceId() {
|
|
||||||
return "1" + String(COUNTER++).padStart(31, "0");
|
|
||||||
}
|
|
||||||
} : undefined
|
|
||||||
});
|
|
||||||
|
|
||||||
// @ts-ignore Deno.tracing is not typed yet
|
|
||||||
const exporter = new telemetry.SpanExporter();
|
|
||||||
provider.addSpanProcessor(new SimpleSpanProcessor(exporter));
|
|
||||||
|
|
||||||
provider.register();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"spans": [
|
"spans": [
|
||||||
{
|
{
|
||||||
"traceId": "00000000000000000000000000000001",
|
"traceId": "00000000000000000000000000000001",
|
||||||
"spanId": "0000000000000002",
|
"spanId": "0000000000000001",
|
||||||
"traceState": "",
|
"traceState": "",
|
||||||
"parentSpanId": "",
|
"parentSpanId": "",
|
||||||
"flags": 1,
|
"flags": 1,
|
||||||
|
@ -59,8 +59,8 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"traceId": "00000000000000000000000000000003",
|
"traceId": "00000000000000000000000000000002",
|
||||||
"spanId": "0000000000000004",
|
"spanId": "0000000000000002",
|
||||||
"traceState": "",
|
"traceState": "",
|
||||||
"parentSpanId": "",
|
"parentSpanId": "",
|
||||||
"flags": 1,
|
"flags": 1,
|
||||||
|
@ -117,10 +117,10 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"traceId": "00000000000000000000000000000003",
|
"traceId": "00000000000000000000000000000002",
|
||||||
"spanId": "1000000000000001",
|
"spanId": "0000000000000003",
|
||||||
"traceState": "",
|
"traceState": "",
|
||||||
"parentSpanId": "0000000000000004",
|
"parentSpanId": "0000000000000002",
|
||||||
"flags": 1,
|
"flags": 1,
|
||||||
"name": "outer span",
|
"name": "outer span",
|
||||||
"kind": 1,
|
"kind": 1,
|
||||||
|
@ -138,10 +138,10 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"traceId": "00000000000000000000000000000003",
|
"traceId": "00000000000000000000000000000002",
|
||||||
"spanId": "1000000000000002",
|
"spanId": "0000000000000004",
|
||||||
"traceState": "",
|
"traceState": "",
|
||||||
"parentSpanId": "1000000000000001",
|
"parentSpanId": "0000000000000003",
|
||||||
"flags": 1,
|
"flags": 1,
|
||||||
"name": "inner span",
|
"name": "inner span",
|
||||||
"kind": 1,
|
"kind": 1,
|
||||||
|
@ -171,8 +171,8 @@
|
||||||
"attributes": [],
|
"attributes": [],
|
||||||
"droppedAttributesCount": 0,
|
"droppedAttributesCount": 0,
|
||||||
"flags": 1,
|
"flags": 1,
|
||||||
"traceId": "00000000000000000000000000000003",
|
"traceId": "00000000000000000000000000000002",
|
||||||
"spanId": "1000000000000002"
|
"spanId": "0000000000000004"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"timeUnixNano": "0",
|
"timeUnixNano": "0",
|
||||||
|
@ -185,8 +185,8 @@
|
||||||
"attributes": [],
|
"attributes": [],
|
||||||
"droppedAttributesCount": 0,
|
"droppedAttributesCount": 0,
|
||||||
"flags": 1,
|
"flags": 1,
|
||||||
"traceId": "00000000000000000000000000000003",
|
"traceId": "00000000000000000000000000000002",
|
||||||
"spanId": "1000000000000002"
|
"spanId": "0000000000000004"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"metrics": []
|
"metrics": []
|
||||||
|
|
|
@ -2,9 +2,7 @@ import { assertEquals } from "@std/assert";
|
||||||
|
|
||||||
const { ContextManager } = Deno.telemetry;
|
const { ContextManager } = Deno.telemetry;
|
||||||
|
|
||||||
const cm = new ContextManager();
|
const a = ContextManager.active();
|
||||||
|
|
||||||
const a = cm.active();
|
|
||||||
const b = a.setValue("b", 1);
|
const b = a.setValue("b", 1);
|
||||||
const c = b.setValue("c", 2);
|
const c = b.setValue("c", 2);
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,13 @@ const server = Deno.serve(
|
||||||
stdout: "null",
|
stdout: "null",
|
||||||
});
|
});
|
||||||
const child = command.spawn();
|
const child = command.spawn();
|
||||||
child.output()
|
child.status
|
||||||
.then(() => server.shutdown())
|
.then((status) => {
|
||||||
|
if (status.signal) {
|
||||||
|
throw new Error("child process failed: " + JSON.stringify(status));
|
||||||
|
}
|
||||||
|
return server.shutdown();
|
||||||
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
data.logs.sort((a, b) =>
|
data.logs.sort((a, b) =>
|
||||||
Number(
|
Number(
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { metrics } from "npm:@opentelemetry/api@1";
|
import { metrics } from "npm:@opentelemetry/api@1";
|
||||||
|
|
||||||
metrics.setGlobalMeterProvider(new Deno.telemetry.MeterProvider());
|
metrics.setGlobalMeterProvider(Deno.telemetry.meterProvider);
|
||||||
|
|
||||||
const meter = metrics.getMeter("m");
|
const meter = metrics.getMeter("m");
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue