mirror of
https://github.com/denoland/deno.git
synced 2025-01-21 21:50:00 -05:00
remove drop_link
This commit is contained in:
parent
efc1c92f1f
commit
d15b772a47
4 changed files with 29 additions and 31 deletions
|
@ -1326,17 +1326,6 @@ impl OtelSpan {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[fast]
|
|
||||||
fn drop_link(&self) {
|
|
||||||
let mut state = self.0.borrow_mut();
|
|
||||||
match &mut **state {
|
|
||||||
OtelSpanState::Recording(span) => {
|
|
||||||
span.links.dropped_count += 1;
|
|
||||||
}
|
|
||||||
OtelSpanState::Done(_) => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[fast]
|
#[fast]
|
||||||
fn end(&self, end_time: f64) {
|
fn end(&self, end_time: f64) {
|
||||||
let end_time = if end_time.is_nan() {
|
let end_time = if end_time.is_nan() {
|
||||||
|
@ -1458,6 +1447,7 @@ fn op_otel_span_add_link<'s>(
|
||||||
span_id: v8::Local<'s, v8::Value>,
|
span_id: v8::Local<'s, v8::Value>,
|
||||||
#[smi] trace_flags: u8,
|
#[smi] trace_flags: u8,
|
||||||
is_remote: bool,
|
is_remote: bool,
|
||||||
|
#[smi] dropped_attributes_count: u32,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
let trace_id = parse_trace_id(scope, trace_id);
|
let trace_id = parse_trace_id(scope, trace_id);
|
||||||
if trace_id == TraceId::INVALID {
|
if trace_id == TraceId::INVALID {
|
||||||
|
@ -1482,7 +1472,11 @@ fn op_otel_span_add_link<'s>(
|
||||||
};
|
};
|
||||||
let mut state = span.0.borrow_mut();
|
let mut state = span.0.borrow_mut();
|
||||||
if let OtelSpanState::Recording(span) = &mut **state {
|
if let OtelSpanState::Recording(span) = &mut **state {
|
||||||
span.links.links.push(Link::with_context(span_context));
|
span.links.links.push(Link::new(
|
||||||
|
span_context,
|
||||||
|
vec![],
|
||||||
|
dropped_attributes_count,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,7 +187,6 @@ interface OtelSpan {
|
||||||
spanContext(): SpanContext;
|
spanContext(): SpanContext;
|
||||||
setStatus(status: SpanStatusCode, errorDescription: string): void;
|
setStatus(status: SpanStatusCode, errorDescription: string): void;
|
||||||
dropEvent(): void;
|
dropEvent(): void;
|
||||||
dropLink(): void;
|
|
||||||
end(endTime: number): void;
|
end(endTime: number): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,22 +360,17 @@ class Span {
|
||||||
}
|
}
|
||||||
|
|
||||||
addLink(link: Link): Span {
|
addLink(link: Link): Span {
|
||||||
if (
|
const droppedAttributeCount = (link.droppedAttributesCount ?? 0) +
|
||||||
link.attributes === undefined ||
|
(link.attributes ? ObjectKeys(link.attributes).length : 0);
|
||||||
ObjectKeys(link.attributes).length === 0
|
const valid = op_otel_span_add_link(
|
||||||
) {
|
this.#otelSpan,
|
||||||
const valid = op_otel_span_add_link(
|
link.context.traceId,
|
||||||
this.#otelSpan,
|
link.context.spanId,
|
||||||
link.context.traceId,
|
link.context.traceFlags,
|
||||||
link.context.spanId,
|
link.context.isRemote ?? false,
|
||||||
link.context.traceFlags,
|
droppedAttributeCount,
|
||||||
link.context.isRemote ?? false,
|
);
|
||||||
);
|
if (!valid) return this;
|
||||||
if (!valid) return this;
|
|
||||||
} else {
|
|
||||||
// We don't support link attributes yet.
|
|
||||||
this.#otelSpan?.dropLink();
|
|
||||||
}
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,8 +74,17 @@
|
||||||
"droppedAttributesCount": 0,
|
"droppedAttributesCount": 0,
|
||||||
"events": [],
|
"events": [],
|
||||||
"droppedEventsCount": 0,
|
"droppedEventsCount": 0,
|
||||||
"links": [],
|
"links": [
|
||||||
"droppedLinksCount": 1,
|
{
|
||||||
|
"traceId": "1234567890abcdef1234567890abcdef",
|
||||||
|
"spanId": "1234567890abcdef",
|
||||||
|
"traceState": "",
|
||||||
|
"attributes": [],
|
||||||
|
"droppedAttributesCount": 2,
|
||||||
|
"flags": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"droppedLinksCount": 0,
|
||||||
"status": {
|
"status": {
|
||||||
"message": "",
|
"message": "",
|
||||||
"code": 0
|
"code": 0
|
||||||
|
|
|
@ -35,5 +35,6 @@ span3.addLink({
|
||||||
attributes: {
|
attributes: {
|
||||||
key: "value",
|
key: "value",
|
||||||
},
|
},
|
||||||
|
droppedAttributesCount: 1,
|
||||||
});
|
});
|
||||||
span3.end();
|
span3.end();
|
||||||
|
|
Loading…
Add table
Reference in a new issue