12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- import {
- ParentAutogroupNode,
- SiblingAutogroupNode,
- type TraceTree,
- type TraceTreeNode,
- } from './traceTree';
- export function isMissingInstrumentationNode(
- node: TraceTreeNode<TraceTree.NodeValue>
- ): node is TraceTreeNode<TraceTree.MissingInstrumentationSpan> {
- return !!(
- node.value &&
- 'type' in node.value &&
- node.value.type === 'missing_instrumentation'
- );
- }
- export function isSpanNode(
- node: TraceTreeNode<TraceTree.NodeValue>
- ): node is TraceTreeNode<TraceTree.Span> {
- return (
- !!(node.value && !('transaction' in node.value) && 'span_id' in node.value) &&
- !('autogrouped_by' in node.value)
- );
- }
- export function isTransactionNode(
- node: TraceTreeNode<TraceTree.NodeValue>
- ): node is TraceTreeNode<TraceTree.Transaction> {
- return !!(node.value && 'transaction' in node.value);
- }
- export function isParentAutogroupedNode(
- node: TraceTreeNode<TraceTree.NodeValue>
- ): node is ParentAutogroupNode {
- return node instanceof ParentAutogroupNode;
- }
- export function isSiblingAutogroupedNode(
- node: TraceTreeNode<TraceTree.NodeValue>
- ): node is SiblingAutogroupNode {
- return node instanceof SiblingAutogroupNode;
- }
- export function isAutogroupedNode(
- node: TraceTreeNode<TraceTree.NodeValue>
- ): node is ParentAutogroupNode | SiblingAutogroupNode {
- return !!(node.value && 'autogrouped_by' in node.value);
- }
- export function isTraceErrorNode(
- node: TraceTreeNode<TraceTree.NodeValue>
- ): node is TraceTreeNode<TraceTree.TraceError> {
- return !!(node.value && 'level' in node.value);
- }
- export function isRootNode(
- node: TraceTreeNode<TraceTree.NodeValue>
- ): node is TraceTreeNode<null> {
- return !!(node.value && node.value === null);
- }
- export function isTraceNode(
- node: TraceTreeNode<TraceTree.NodeValue>
- ): node is TraceTreeNode<TraceTree.Trace> {
- return !!(node.value && 'orphan_errors' in node.value);
- }
|