mirror of
https://github.com/SigNoz/signoz.git
synced 2026-11-23 00:30:40 +00:00
Compare commits
4 Commits
docs/css-m
...
issue_nerv
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
690a2af781 | ||
|
|
82c8c1c43d | ||
|
|
75686f4004 | ||
|
|
2df97d39e2 |
@@ -12680,6 +12680,19 @@ components:
|
||||
minimum: 0
|
||||
type: integer
|
||||
type: object
|
||||
SpantypesEventV2:
|
||||
properties:
|
||||
attributes:
|
||||
additionalProperties: {}
|
||||
type: object
|
||||
isError:
|
||||
type: boolean
|
||||
name:
|
||||
type: string
|
||||
timeUnixNano:
|
||||
minimum: 0
|
||||
type: integer
|
||||
type: object
|
||||
SpantypesFieldContext:
|
||||
enum:
|
||||
- attribute
|
||||
@@ -12872,6 +12885,13 @@ components:
|
||||
nullable: true
|
||||
type: array
|
||||
type: object
|
||||
SpantypesLink:
|
||||
properties:
|
||||
spanId:
|
||||
type: string
|
||||
traceId:
|
||||
type: string
|
||||
type: object
|
||||
SpantypesOtelSpanRef:
|
||||
properties:
|
||||
refType:
|
||||
@@ -13163,6 +13183,100 @@ components:
|
||||
nullable: true
|
||||
type: object
|
||||
type: object
|
||||
SpantypesSpanRecord:
|
||||
properties:
|
||||
attributes:
|
||||
additionalProperties: {}
|
||||
type: object
|
||||
events:
|
||||
items:
|
||||
$ref: '#/components/schemas/SpantypesEventV2'
|
||||
type: array
|
||||
links:
|
||||
items:
|
||||
$ref: '#/components/schemas/SpantypesLink'
|
||||
type: array
|
||||
resource:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
spanId:
|
||||
type: string
|
||||
statusCode:
|
||||
type: string
|
||||
statusMessage:
|
||||
type: string
|
||||
truncated:
|
||||
items:
|
||||
$ref: '#/components/schemas/SpantypesTruncatedField'
|
||||
type: array
|
||||
required:
|
||||
- spanId
|
||||
- statusCode
|
||||
- statusMessage
|
||||
- attributes
|
||||
- resource
|
||||
- events
|
||||
- links
|
||||
- truncated
|
||||
type: object
|
||||
SpantypesSpanSummary:
|
||||
properties:
|
||||
childCount:
|
||||
minimum: 0
|
||||
type: integer
|
||||
durationNano:
|
||||
minimum: 0
|
||||
type: integer
|
||||
hasError:
|
||||
type: boolean
|
||||
kind:
|
||||
type: string
|
||||
level:
|
||||
minimum: 0
|
||||
type: integer
|
||||
name:
|
||||
type: string
|
||||
ownTimeNano:
|
||||
minimum: 0
|
||||
type: integer
|
||||
parentSpanId:
|
||||
type: string
|
||||
responseStatusCode:
|
||||
type: string
|
||||
serviceName:
|
||||
type: string
|
||||
spanId:
|
||||
type: string
|
||||
startOffsetNano:
|
||||
minimum: 0
|
||||
type: integer
|
||||
subtreeSpanCount:
|
||||
minimum: 0
|
||||
type: integer
|
||||
required:
|
||||
- spanId
|
||||
- name
|
||||
- serviceName
|
||||
- kind
|
||||
- startOffsetNano
|
||||
- durationNano
|
||||
- ownTimeNano
|
||||
- hasError
|
||||
- level
|
||||
- childCount
|
||||
- subtreeSpanCount
|
||||
type: object
|
||||
SpantypesSpanTextMatch:
|
||||
properties:
|
||||
field:
|
||||
type: string
|
||||
snippet:
|
||||
type: string
|
||||
required:
|
||||
- field
|
||||
- snippet
|
||||
type: object
|
||||
SpantypesThreadSpan:
|
||||
properties:
|
||||
attributes:
|
||||
@@ -13229,6 +13343,23 @@ components:
|
||||
- formattedOutput
|
||||
- formatterWarnings
|
||||
type: object
|
||||
SpantypesTraceAIIdentity:
|
||||
properties:
|
||||
modelCallCount:
|
||||
minimum: 0
|
||||
type: integer
|
||||
tokens:
|
||||
$ref: '#/components/schemas/SpantypesTraceAITokens'
|
||||
toolCallCount:
|
||||
minimum: 0
|
||||
type: integer
|
||||
totalCost:
|
||||
type: number
|
||||
required:
|
||||
- modelCallCount
|
||||
- toolCallCount
|
||||
- tokens
|
||||
type: object
|
||||
SpantypesTraceAISummary:
|
||||
properties:
|
||||
tokens:
|
||||
@@ -13262,6 +13393,383 @@ components:
|
||||
- cacheWrite
|
||||
- reasoning
|
||||
type: object
|
||||
SpantypesTraceErrorItem:
|
||||
properties:
|
||||
errorAncestorCount:
|
||||
minimum: 0
|
||||
type: integer
|
||||
parent:
|
||||
$ref: '#/components/schemas/SpantypesSpanSummary'
|
||||
span:
|
||||
$ref: '#/components/schemas/SpantypesSpanSummary'
|
||||
statusMessage:
|
||||
type: string
|
||||
required:
|
||||
- span
|
||||
- statusMessage
|
||||
- errorAncestorCount
|
||||
type: object
|
||||
SpantypesTraceErrorList:
|
||||
properties:
|
||||
items:
|
||||
items:
|
||||
$ref: '#/components/schemas/SpantypesTraceErrorItem'
|
||||
type: array
|
||||
nextCursor:
|
||||
type: string
|
||||
total:
|
||||
minimum: 0
|
||||
type: integer
|
||||
required:
|
||||
- total
|
||||
- items
|
||||
type: object
|
||||
SpantypesTraceExpensiveItem:
|
||||
properties:
|
||||
cost:
|
||||
type: number
|
||||
inputTokens:
|
||||
minimum: 0
|
||||
type: integer
|
||||
outputTokens:
|
||||
minimum: 0
|
||||
type: integer
|
||||
parent:
|
||||
$ref: '#/components/schemas/SpantypesSpanSummary'
|
||||
span:
|
||||
$ref: '#/components/schemas/SpantypesSpanSummary'
|
||||
required:
|
||||
- span
|
||||
- inputTokens
|
||||
- outputTokens
|
||||
type: object
|
||||
SpantypesTraceExpensiveList:
|
||||
properties:
|
||||
items:
|
||||
items:
|
||||
$ref: '#/components/schemas/SpantypesTraceExpensiveItem'
|
||||
type: array
|
||||
nextCursor:
|
||||
type: string
|
||||
total:
|
||||
minimum: 0
|
||||
type: integer
|
||||
required:
|
||||
- total
|
||||
- items
|
||||
type: object
|
||||
SpantypesTraceIdentity:
|
||||
properties:
|
||||
ai:
|
||||
$ref: '#/components/schemas/SpantypesTraceAIIdentity'
|
||||
durationNano:
|
||||
minimum: 0
|
||||
type: integer
|
||||
errorSpanCount:
|
||||
minimum: 0
|
||||
type: integer
|
||||
hasMissingSpans:
|
||||
type: boolean
|
||||
root:
|
||||
$ref: '#/components/schemas/SpantypesSpanSummary'
|
||||
rootCount:
|
||||
minimum: 0
|
||||
type: integer
|
||||
serviceCount:
|
||||
minimum: 0
|
||||
type: integer
|
||||
services:
|
||||
items:
|
||||
$ref: '#/components/schemas/SpantypesTraceServiceStats'
|
||||
type: array
|
||||
spanCount:
|
||||
minimum: 0
|
||||
type: integer
|
||||
startTimestampMillis:
|
||||
minimum: 0
|
||||
type: integer
|
||||
traceId:
|
||||
type: string
|
||||
required:
|
||||
- traceId
|
||||
- startTimestampMillis
|
||||
- durationNano
|
||||
- spanCount
|
||||
- errorSpanCount
|
||||
- rootCount
|
||||
- hasMissingSpans
|
||||
- serviceCount
|
||||
- services
|
||||
type: object
|
||||
SpantypesTraceLinkItem:
|
||||
properties:
|
||||
linkCount:
|
||||
minimum: 0
|
||||
type: integer
|
||||
links:
|
||||
items:
|
||||
$ref: '#/components/schemas/SpantypesLink'
|
||||
type: array
|
||||
parent:
|
||||
$ref: '#/components/schemas/SpantypesSpanSummary'
|
||||
span:
|
||||
$ref: '#/components/schemas/SpantypesSpanSummary'
|
||||
required:
|
||||
- span
|
||||
- linkCount
|
||||
- links
|
||||
type: object
|
||||
SpantypesTraceLinkList:
|
||||
properties:
|
||||
items:
|
||||
items:
|
||||
$ref: '#/components/schemas/SpantypesTraceLinkItem'
|
||||
type: array
|
||||
nextCursor:
|
||||
type: string
|
||||
total:
|
||||
minimum: 0
|
||||
type: integer
|
||||
required:
|
||||
- total
|
||||
- items
|
||||
type: object
|
||||
SpantypesTraceOverview:
|
||||
properties:
|
||||
errors:
|
||||
$ref: '#/components/schemas/SpantypesTraceErrorList'
|
||||
expensive:
|
||||
$ref: '#/components/schemas/SpantypesTraceExpensiveList'
|
||||
identity:
|
||||
$ref: '#/components/schemas/SpantypesTraceIdentity'
|
||||
links:
|
||||
$ref: '#/components/schemas/SpantypesTraceLinkList'
|
||||
slowest:
|
||||
$ref: '#/components/schemas/SpantypesTraceSlowestList'
|
||||
tree:
|
||||
$ref: '#/components/schemas/SpantypesTraceTree'
|
||||
unmarkedFailures:
|
||||
$ref: '#/components/schemas/SpantypesTraceUnmarkedFailureList'
|
||||
type: object
|
||||
SpantypesTraceServiceStats:
|
||||
properties:
|
||||
errorSpanCount:
|
||||
minimum: 0
|
||||
type: integer
|
||||
ownTimeNano:
|
||||
minimum: 0
|
||||
type: integer
|
||||
serviceName:
|
||||
type: string
|
||||
spanCount:
|
||||
minimum: 0
|
||||
type: integer
|
||||
required:
|
||||
- serviceName
|
||||
- spanCount
|
||||
- errorSpanCount
|
||||
- ownTimeNano
|
||||
type: object
|
||||
SpantypesTraceSlowestItem:
|
||||
properties:
|
||||
errorSpanCount:
|
||||
minimum: 0
|
||||
type: integer
|
||||
ownTimeNano:
|
||||
minimum: 0
|
||||
type: integer
|
||||
parent:
|
||||
$ref: '#/components/schemas/SpantypesSpanSummary'
|
||||
span:
|
||||
$ref: '#/components/schemas/SpantypesSpanSummary'
|
||||
spanCount:
|
||||
minimum: 0
|
||||
type: integer
|
||||
required:
|
||||
- span
|
||||
- spanCount
|
||||
- ownTimeNano
|
||||
- errorSpanCount
|
||||
type: object
|
||||
SpantypesTraceSlowestList:
|
||||
properties:
|
||||
items:
|
||||
items:
|
||||
$ref: '#/components/schemas/SpantypesTraceSlowestItem'
|
||||
type: array
|
||||
nextCursor:
|
||||
type: string
|
||||
total:
|
||||
minimum: 0
|
||||
type: integer
|
||||
required:
|
||||
- total
|
||||
- items
|
||||
type: object
|
||||
SpantypesTraceSpanDetail:
|
||||
properties:
|
||||
ancestorCount:
|
||||
minimum: 0
|
||||
type: integer
|
||||
ancestors:
|
||||
items:
|
||||
$ref: '#/components/schemas/SpantypesSpanSummary'
|
||||
type: array
|
||||
descendants:
|
||||
items:
|
||||
$ref: '#/components/schemas/SpantypesTraceSpanLevel'
|
||||
type: array
|
||||
percentile:
|
||||
$ref: '#/components/schemas/SpantypesTraceSpanPercentile'
|
||||
record:
|
||||
$ref: '#/components/schemas/SpantypesSpanRecord'
|
||||
summary:
|
||||
$ref: '#/components/schemas/SpantypesSpanSummary'
|
||||
required:
|
||||
- summary
|
||||
- record
|
||||
- ancestors
|
||||
- ancestorCount
|
||||
- descendants
|
||||
type: object
|
||||
SpantypesTraceSpanLevel:
|
||||
properties:
|
||||
level:
|
||||
minimum: 0
|
||||
type: integer
|
||||
spans:
|
||||
items:
|
||||
$ref: '#/components/schemas/SpantypesSpanSummary'
|
||||
type: array
|
||||
total:
|
||||
minimum: 0
|
||||
type: integer
|
||||
required:
|
||||
- level
|
||||
- total
|
||||
- spans
|
||||
type: object
|
||||
SpantypesTraceSpanList:
|
||||
properties:
|
||||
items:
|
||||
items:
|
||||
$ref: '#/components/schemas/SpantypesTraceSpanMatch'
|
||||
type: array
|
||||
nextCursor:
|
||||
type: string
|
||||
total:
|
||||
minimum: 0
|
||||
type: integer
|
||||
warnings:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
required:
|
||||
- total
|
||||
- items
|
||||
type: object
|
||||
SpantypesTraceSpanMatch:
|
||||
properties:
|
||||
matches:
|
||||
items:
|
||||
$ref: '#/components/schemas/SpantypesSpanTextMatch'
|
||||
type: array
|
||||
parent:
|
||||
$ref: '#/components/schemas/SpantypesSpanSummary'
|
||||
span:
|
||||
$ref: '#/components/schemas/SpantypesSpanSummary'
|
||||
required:
|
||||
- span
|
||||
- matches
|
||||
type: object
|
||||
SpantypesTraceSpanPercentile:
|
||||
properties:
|
||||
p50Nano:
|
||||
minimum: 0
|
||||
type: integer
|
||||
p90Nano:
|
||||
minimum: 0
|
||||
type: integer
|
||||
p99Nano:
|
||||
minimum: 0
|
||||
type: integer
|
||||
position:
|
||||
format: double
|
||||
type: number
|
||||
windowMinutes:
|
||||
minimum: 0
|
||||
type: integer
|
||||
required:
|
||||
- p50Nano
|
||||
- p90Nano
|
||||
- p99Nano
|
||||
- position
|
||||
- windowMinutes
|
||||
type: object
|
||||
SpantypesTraceTree:
|
||||
properties:
|
||||
complete:
|
||||
type: boolean
|
||||
records:
|
||||
items:
|
||||
$ref: '#/components/schemas/SpantypesSpanRecord'
|
||||
type: array
|
||||
spans:
|
||||
items:
|
||||
$ref: '#/components/schemas/SpantypesSpanSummary'
|
||||
type: array
|
||||
total:
|
||||
minimum: 0
|
||||
type: integer
|
||||
required:
|
||||
- total
|
||||
- complete
|
||||
- spans
|
||||
type: object
|
||||
SpantypesTraceUnmarkedFailureItem:
|
||||
properties:
|
||||
parent:
|
||||
$ref: '#/components/schemas/SpantypesSpanSummary'
|
||||
reason:
|
||||
$ref: '#/components/schemas/SpantypesUnmarkedFailureReason'
|
||||
span:
|
||||
$ref: '#/components/schemas/SpantypesSpanSummary'
|
||||
required:
|
||||
- span
|
||||
- reason
|
||||
type: object
|
||||
SpantypesTraceUnmarkedFailureList:
|
||||
properties:
|
||||
items:
|
||||
items:
|
||||
$ref: '#/components/schemas/SpantypesTraceUnmarkedFailureItem'
|
||||
type: array
|
||||
nextCursor:
|
||||
type: string
|
||||
total:
|
||||
minimum: 0
|
||||
type: integer
|
||||
required:
|
||||
- total
|
||||
- items
|
||||
type: object
|
||||
SpantypesTruncatedField:
|
||||
properties:
|
||||
field:
|
||||
type: string
|
||||
length:
|
||||
minimum: 0
|
||||
type: integer
|
||||
required:
|
||||
- field
|
||||
- length
|
||||
type: object
|
||||
SpantypesUnmarkedFailureReason:
|
||||
enum:
|
||||
- http_4xx
|
||||
- grpc_status
|
||||
- exception_event
|
||||
type: string
|
||||
SpantypesUpdatableSpanMapper:
|
||||
properties:
|
||||
config:
|
||||
@@ -19284,6 +19792,280 @@ paths:
|
||||
tags:
|
||||
- tracedetail
|
||||
x-signoz-stability: alpha
|
||||
/api/v1/traces/{traceID}/inspect:
|
||||
get:
|
||||
deprecated: false
|
||||
description: 'Returns the overview of a trace of any size: its identity with
|
||||
per-service totals, the spans where each error started, the failures not marked
|
||||
as errors, the slowest spans by own time, the most expensive gen_ai spans,
|
||||
the spans that link to other spans, and the top of the span tree. A small
|
||||
trace also returns each span''s full record. Every list carries its total
|
||||
and a nextCursor when more items follow.'
|
||||
operationId: InspectTrace
|
||||
parameters:
|
||||
- description: The nextCursor of one list of the overview; returns the next
|
||||
page of that list and nothing else.
|
||||
in: query
|
||||
name: cursor
|
||||
schema:
|
||||
description: The nextCursor of one list of the overview; returns the next
|
||||
page of that list and nothing else.
|
||||
type: string
|
||||
- in: path
|
||||
name: traceID
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
data:
|
||||
$ref: '#/components/schemas/SpantypesTraceOverview'
|
||||
status:
|
||||
type: string
|
||||
required:
|
||||
- status
|
||||
- data
|
||||
type: object
|
||||
description: OK
|
||||
"400":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/RenderErrorResponse'
|
||||
description: Bad Request
|
||||
"401":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/RenderErrorResponse'
|
||||
description: Unauthorized
|
||||
"403":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/RenderErrorResponse'
|
||||
description: Forbidden
|
||||
"404":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/RenderErrorResponse'
|
||||
description: Not Found
|
||||
"500":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/RenderErrorResponse'
|
||||
description: Internal Server Error
|
||||
security:
|
||||
- api_key:
|
||||
- VIEWER
|
||||
- tokenizer:
|
||||
- VIEWER
|
||||
summary: Inspect a trace
|
||||
tags:
|
||||
- tracedetail
|
||||
x-signoz-stability: alpha
|
||||
/api/v1/traces/{traceID}/inspect/spans:
|
||||
get:
|
||||
deprecated: false
|
||||
description: Returns the spans of a trace that match a search, each with its
|
||||
direct parent and where the words were found. Without a search it returns
|
||||
every span in tree order, or with under one span and the spans below it.
|
||||
operationId: InspectTraceSpans
|
||||
parameters:
|
||||
- description: 'Returns the spans that match, earliest first: words, a filter
|
||||
expression, or both, such as worldpay AND has_error = true. Words match
|
||||
the span name, status message, attributes, resource attributes and events,
|
||||
ignoring case. Without it every span is returned, in tree order.'
|
||||
in: query
|
||||
name: search
|
||||
schema:
|
||||
description: 'Returns the spans that match, earliest first: words, a filter
|
||||
expression, or both, such as worldpay AND has_error = true. Words match
|
||||
the span name, status message, attributes, resource attributes and events,
|
||||
ignoring case. Without it every span is returned, in tree order.'
|
||||
type: string
|
||||
- description: A span ID; returns that span and every span below it. Cannot
|
||||
be combined with search.
|
||||
in: query
|
||||
name: under
|
||||
schema:
|
||||
description: A span ID; returns that span and every span below it. Cannot
|
||||
be combined with search.
|
||||
type: string
|
||||
- description: Page size, at most 1000; when not given, 20 with search and 400
|
||||
without. A page holds fewer spans when it would pass the response size limit.
|
||||
in: query
|
||||
name: limit
|
||||
schema:
|
||||
description: Page size, at most 1000; when not given, 20 with search and
|
||||
400 without. A page holds fewer spans when it would pass the response
|
||||
size limit.
|
||||
type: integer
|
||||
- description: The nextCursor of an earlier response to the same request; returns
|
||||
the next page.
|
||||
in: query
|
||||
name: cursor
|
||||
schema:
|
||||
description: The nextCursor of an earlier response to the same request;
|
||||
returns the next page.
|
||||
type: string
|
||||
- in: path
|
||||
name: traceID
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
data:
|
||||
$ref: '#/components/schemas/SpantypesTraceSpanList'
|
||||
status:
|
||||
type: string
|
||||
required:
|
||||
- status
|
||||
- data
|
||||
type: object
|
||||
description: OK
|
||||
"400":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/RenderErrorResponse'
|
||||
description: Bad Request
|
||||
"401":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/RenderErrorResponse'
|
||||
description: Unauthorized
|
||||
"403":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/RenderErrorResponse'
|
||||
description: Forbidden
|
||||
"404":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/RenderErrorResponse'
|
||||
description: Not Found
|
||||
"500":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/RenderErrorResponse'
|
||||
description: Internal Server Error
|
||||
security:
|
||||
- api_key:
|
||||
- VIEWER
|
||||
- tokenizer:
|
||||
- VIEWER
|
||||
summary: Search or list the spans of a trace
|
||||
tags:
|
||||
- tracedetail
|
||||
x-signoz-stability: alpha
|
||||
/api/v1/traces/{traceID}/inspect/spans/{spanID}:
|
||||
get:
|
||||
deprecated: false
|
||||
description: 'Returns one span in full: its summary and record, its nearest
|
||||
ancestors with the root, the spans below it level by level, and where its
|
||||
duration sits among recent spans of the same name and service. Long values
|
||||
are cut and listed in truncated; selectFields returns named attributes without
|
||||
the cut.'
|
||||
operationId: InspectTraceSpan
|
||||
parameters:
|
||||
- description: The number of levels of ancestors and of descendants returned,
|
||||
1 to 10; 2 when not given. The root span is always returned.
|
||||
in: query
|
||||
name: depth
|
||||
schema:
|
||||
description: The number of levels of ancestors and of descendants returned,
|
||||
1 to 10; 2 when not given. The root span is always returned.
|
||||
type: integer
|
||||
- description: Attribute names returned without the 500 character cut; the record
|
||||
then holds only these attributes.
|
||||
in: query
|
||||
name: selectFields
|
||||
schema:
|
||||
description: Attribute names returned without the 500 character cut; the
|
||||
record then holds only these attributes.
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
- in: path
|
||||
name: traceID
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
- in: path
|
||||
name: spanID
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
data:
|
||||
$ref: '#/components/schemas/SpantypesTraceSpanDetail'
|
||||
status:
|
||||
type: string
|
||||
required:
|
||||
- status
|
||||
- data
|
||||
type: object
|
||||
description: OK
|
||||
"400":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/RenderErrorResponse'
|
||||
description: Bad Request
|
||||
"401":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/RenderErrorResponse'
|
||||
description: Unauthorized
|
||||
"403":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/RenderErrorResponse'
|
||||
description: Forbidden
|
||||
"404":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/RenderErrorResponse'
|
||||
description: Not Found
|
||||
"500":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/RenderErrorResponse'
|
||||
description: Internal Server Error
|
||||
security:
|
||||
- api_key:
|
||||
- VIEWER
|
||||
- tokenizer:
|
||||
- VIEWER
|
||||
summary: Inspect a span of a trace
|
||||
tags:
|
||||
- tracedetail
|
||||
x-signoz-stability: alpha
|
||||
/api/v1/traces/{traceID}/summary:
|
||||
get:
|
||||
deprecated: false
|
||||
|
||||
@@ -13817,6 +13817,28 @@ export interface SpantypesEventDTO {
|
||||
timeUnixNano?: number;
|
||||
}
|
||||
|
||||
export type SpantypesEventV2DTOAttributes = { [key: string]: unknown };
|
||||
|
||||
export interface SpantypesEventV2DTO {
|
||||
/**
|
||||
* @type object
|
||||
*/
|
||||
attributes?: SpantypesEventV2DTOAttributes;
|
||||
/**
|
||||
* @type boolean
|
||||
*/
|
||||
isError?: boolean;
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
timeUnixNano?: number;
|
||||
}
|
||||
|
||||
export enum SpantypesFieldContextDTO {
|
||||
attribute = 'attribute',
|
||||
resource = 'resource',
|
||||
@@ -14507,6 +14529,17 @@ export interface SpantypesGettableWaterfallTraceDTO {
|
||||
uncollapsedSpans?: string[] | null;
|
||||
}
|
||||
|
||||
export interface SpantypesLinkDTO {
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
spanId?: string;
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
traceId?: string;
|
||||
}
|
||||
|
||||
export interface SpantypesPostableFlamegraphDTO {
|
||||
/**
|
||||
* @type array
|
||||
@@ -14593,6 +14626,497 @@ export interface SpantypesPostableWaterfallDTO {
|
||||
uncollapsedSpans?: string[] | null;
|
||||
}
|
||||
|
||||
export type SpantypesSpanRecordDTOAttributes = { [key: string]: unknown };
|
||||
|
||||
export type SpantypesSpanRecordDTOResource = { [key: string]: string };
|
||||
|
||||
export interface SpantypesTruncatedFieldDTO {
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
field: string;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
length: number;
|
||||
}
|
||||
|
||||
export interface SpantypesSpanRecordDTO {
|
||||
/**
|
||||
* @type object
|
||||
*/
|
||||
attributes: SpantypesSpanRecordDTOAttributes;
|
||||
/**
|
||||
* @type array
|
||||
*/
|
||||
events: SpantypesEventV2DTO[];
|
||||
/**
|
||||
* @type array
|
||||
*/
|
||||
links: SpantypesLinkDTO[];
|
||||
/**
|
||||
* @type object
|
||||
*/
|
||||
resource: SpantypesSpanRecordDTOResource;
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
spanId: string;
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
statusCode: string;
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
statusMessage: string;
|
||||
/**
|
||||
* @type array
|
||||
*/
|
||||
truncated: SpantypesTruncatedFieldDTO[];
|
||||
}
|
||||
|
||||
export interface SpantypesSpanSummaryDTO {
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
childCount: number;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
durationNano: number;
|
||||
/**
|
||||
* @type boolean
|
||||
*/
|
||||
hasError: boolean;
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
kind: string;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
level: number;
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
ownTimeNano: number;
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
parentSpanId?: string;
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
responseStatusCode?: string;
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
serviceName: string;
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
spanId: string;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
startOffsetNano: number;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
subtreeSpanCount: number;
|
||||
}
|
||||
|
||||
export interface SpantypesSpanTextMatchDTO {
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
field: string;
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
snippet: string;
|
||||
}
|
||||
|
||||
export interface SpantypesTraceAIIdentityDTO {
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
modelCallCount: number;
|
||||
tokens: SpantypesTraceAITokensDTO;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
toolCallCount: number;
|
||||
/**
|
||||
* @type number
|
||||
*/
|
||||
totalCost?: number;
|
||||
}
|
||||
|
||||
export interface SpantypesTraceErrorItemDTO {
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
errorAncestorCount: number;
|
||||
parent?: SpantypesSpanSummaryDTO;
|
||||
span: SpantypesSpanSummaryDTO;
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
statusMessage: string;
|
||||
}
|
||||
|
||||
export interface SpantypesTraceErrorListDTO {
|
||||
/**
|
||||
* @type array
|
||||
*/
|
||||
items: SpantypesTraceErrorItemDTO[];
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
nextCursor?: string;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
total: number;
|
||||
}
|
||||
|
||||
export interface SpantypesTraceExpensiveItemDTO {
|
||||
/**
|
||||
* @type number
|
||||
*/
|
||||
cost?: number;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
inputTokens: number;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
outputTokens: number;
|
||||
parent?: SpantypesSpanSummaryDTO;
|
||||
span: SpantypesSpanSummaryDTO;
|
||||
}
|
||||
|
||||
export interface SpantypesTraceExpensiveListDTO {
|
||||
/**
|
||||
* @type array
|
||||
*/
|
||||
items: SpantypesTraceExpensiveItemDTO[];
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
nextCursor?: string;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
total: number;
|
||||
}
|
||||
|
||||
export interface SpantypesTraceServiceStatsDTO {
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
errorSpanCount: number;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
ownTimeNano: number;
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
serviceName: string;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
spanCount: number;
|
||||
}
|
||||
|
||||
export interface SpantypesTraceIdentityDTO {
|
||||
ai?: SpantypesTraceAIIdentityDTO;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
durationNano: number;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
errorSpanCount: number;
|
||||
/**
|
||||
* @type boolean
|
||||
*/
|
||||
hasMissingSpans: boolean;
|
||||
root?: SpantypesSpanSummaryDTO;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
rootCount: number;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
serviceCount: number;
|
||||
/**
|
||||
* @type array
|
||||
*/
|
||||
services: SpantypesTraceServiceStatsDTO[];
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
spanCount: number;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
startTimestampMillis: number;
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
traceId: string;
|
||||
}
|
||||
|
||||
export interface SpantypesTraceLinkItemDTO {
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
linkCount: number;
|
||||
/**
|
||||
* @type array
|
||||
*/
|
||||
links: SpantypesLinkDTO[];
|
||||
parent?: SpantypesSpanSummaryDTO;
|
||||
span: SpantypesSpanSummaryDTO;
|
||||
}
|
||||
|
||||
export interface SpantypesTraceLinkListDTO {
|
||||
/**
|
||||
* @type array
|
||||
*/
|
||||
items: SpantypesTraceLinkItemDTO[];
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
nextCursor?: string;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
total: number;
|
||||
}
|
||||
|
||||
export interface SpantypesTraceSlowestItemDTO {
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
errorSpanCount: number;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
ownTimeNano: number;
|
||||
parent?: SpantypesSpanSummaryDTO;
|
||||
span: SpantypesSpanSummaryDTO;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
spanCount: number;
|
||||
}
|
||||
|
||||
export interface SpantypesTraceSlowestListDTO {
|
||||
/**
|
||||
* @type array
|
||||
*/
|
||||
items: SpantypesTraceSlowestItemDTO[];
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
nextCursor?: string;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
total: number;
|
||||
}
|
||||
|
||||
export interface SpantypesTraceTreeDTO {
|
||||
/**
|
||||
* @type boolean
|
||||
*/
|
||||
complete: boolean;
|
||||
/**
|
||||
* @type array
|
||||
*/
|
||||
records?: SpantypesSpanRecordDTO[];
|
||||
/**
|
||||
* @type array
|
||||
*/
|
||||
spans: SpantypesSpanSummaryDTO[];
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
total: number;
|
||||
}
|
||||
|
||||
export enum SpantypesUnmarkedFailureReasonDTO {
|
||||
http_4xx = 'http_4xx',
|
||||
grpc_status = 'grpc_status',
|
||||
exception_event = 'exception_event',
|
||||
}
|
||||
export interface SpantypesTraceUnmarkedFailureItemDTO {
|
||||
parent?: SpantypesSpanSummaryDTO;
|
||||
reason: SpantypesUnmarkedFailureReasonDTO;
|
||||
span: SpantypesSpanSummaryDTO;
|
||||
}
|
||||
|
||||
export interface SpantypesTraceUnmarkedFailureListDTO {
|
||||
/**
|
||||
* @type array
|
||||
*/
|
||||
items: SpantypesTraceUnmarkedFailureItemDTO[];
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
nextCursor?: string;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
total: number;
|
||||
}
|
||||
|
||||
export interface SpantypesTraceOverviewDTO {
|
||||
errors?: SpantypesTraceErrorListDTO;
|
||||
expensive?: SpantypesTraceExpensiveListDTO;
|
||||
identity?: SpantypesTraceIdentityDTO;
|
||||
links?: SpantypesTraceLinkListDTO;
|
||||
slowest?: SpantypesTraceSlowestListDTO;
|
||||
tree?: SpantypesTraceTreeDTO;
|
||||
unmarkedFailures?: SpantypesTraceUnmarkedFailureListDTO;
|
||||
}
|
||||
|
||||
export interface SpantypesTraceSpanLevelDTO {
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
level: number;
|
||||
/**
|
||||
* @type array
|
||||
*/
|
||||
spans: SpantypesSpanSummaryDTO[];
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
total: number;
|
||||
}
|
||||
|
||||
export interface SpantypesTraceSpanPercentileDTO {
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
p50Nano: number;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
p90Nano: number;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
p99Nano: number;
|
||||
/**
|
||||
* @type number
|
||||
* @format double
|
||||
*/
|
||||
position: number;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
windowMinutes: number;
|
||||
}
|
||||
|
||||
export interface SpantypesTraceSpanDetailDTO {
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
ancestorCount: number;
|
||||
/**
|
||||
* @type array
|
||||
*/
|
||||
ancestors: SpantypesSpanSummaryDTO[];
|
||||
/**
|
||||
* @type array
|
||||
*/
|
||||
descendants: SpantypesTraceSpanLevelDTO[];
|
||||
percentile?: SpantypesTraceSpanPercentileDTO;
|
||||
record: SpantypesSpanRecordDTO;
|
||||
summary: SpantypesSpanSummaryDTO;
|
||||
}
|
||||
|
||||
export interface SpantypesTraceSpanMatchDTO {
|
||||
/**
|
||||
* @type array
|
||||
*/
|
||||
matches: SpantypesSpanTextMatchDTO[];
|
||||
parent?: SpantypesSpanSummaryDTO;
|
||||
span: SpantypesSpanSummaryDTO;
|
||||
}
|
||||
|
||||
export interface SpantypesTraceSpanListDTO {
|
||||
/**
|
||||
* @type array
|
||||
*/
|
||||
items: SpantypesTraceSpanMatchDTO[];
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
nextCursor?: string;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
total: number;
|
||||
/**
|
||||
* @type array
|
||||
*/
|
||||
warnings?: string[];
|
||||
}
|
||||
|
||||
export interface SpantypesUpdatableSpanMapperDTO {
|
||||
config?: SpantypesSpanMapperConfigDTO;
|
||||
/**
|
||||
@@ -16035,6 +16559,84 @@ export type GetTraceAggregations200 = {
|
||||
status: string;
|
||||
};
|
||||
|
||||
export type InspectTracePathParameters = {
|
||||
traceID: string;
|
||||
};
|
||||
export type InspectTraceParams = {
|
||||
/**
|
||||
* @type string
|
||||
* @description The nextCursor of one list of the overview; returns the next page of that list and nothing else.
|
||||
*/
|
||||
cursor?: string;
|
||||
};
|
||||
|
||||
export type InspectTrace200 = {
|
||||
data: SpantypesTraceOverviewDTO;
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
status: string;
|
||||
};
|
||||
|
||||
export type InspectTraceSpansPathParameters = {
|
||||
traceID: string;
|
||||
};
|
||||
export type InspectTraceSpansParams = {
|
||||
/**
|
||||
* @type string
|
||||
* @description Returns the spans that match, earliest first: words, a filter expression, or both, such as worldpay AND has_error = true. Words match the span name, status message, attributes, resource attributes and events, ignoring case. Without it every span is returned, in tree order.
|
||||
*/
|
||||
search?: string;
|
||||
/**
|
||||
* @type string
|
||||
* @description A span ID; returns that span and every span below it. Cannot be combined with search.
|
||||
*/
|
||||
under?: string;
|
||||
/**
|
||||
* @type integer
|
||||
* @description Page size, at most 1000; when not given, 20 with search and 400 without. A page holds fewer spans when it would pass the response size limit.
|
||||
*/
|
||||
limit?: number;
|
||||
/**
|
||||
* @type string
|
||||
* @description The nextCursor of an earlier response to the same request; returns the next page.
|
||||
*/
|
||||
cursor?: string;
|
||||
};
|
||||
|
||||
export type InspectTraceSpans200 = {
|
||||
data: SpantypesTraceSpanListDTO;
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
status: string;
|
||||
};
|
||||
|
||||
export type InspectTraceSpanPathParameters = {
|
||||
traceID: string;
|
||||
spanID: string;
|
||||
};
|
||||
export type InspectTraceSpanParams = {
|
||||
/**
|
||||
* @type integer
|
||||
* @description The number of levels of ancestors and of descendants returned, 1 to 10; 2 when not given. The root span is always returned.
|
||||
*/
|
||||
depth?: number;
|
||||
/**
|
||||
* @type array
|
||||
* @description Attribute names returned without the 500 character cut; the record then holds only these attributes.
|
||||
*/
|
||||
selectFields?: string[];
|
||||
};
|
||||
|
||||
export type InspectTraceSpan200 = {
|
||||
data: SpantypesTraceSpanDetailDTO;
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
status: string;
|
||||
};
|
||||
|
||||
export type GetTraceSummaryPathParameters = {
|
||||
traceID: string;
|
||||
};
|
||||
|
||||
@@ -29,6 +29,15 @@ import type {
|
||||
GetTraceThreadPathParameters,
|
||||
GetWaterfallV4200,
|
||||
GetWaterfallV4PathParameters,
|
||||
InspectTrace200,
|
||||
InspectTraceParams,
|
||||
InspectTracePathParameters,
|
||||
InspectTraceSpan200,
|
||||
InspectTraceSpanParams,
|
||||
InspectTraceSpanPathParameters,
|
||||
InspectTraceSpans200,
|
||||
InspectTraceSpansParams,
|
||||
InspectTraceSpansPathParameters,
|
||||
RenderErrorResponseDTO,
|
||||
SpantypesPostableFlamegraphDTO,
|
||||
SpantypesPostableTraceAggregationsDTO,
|
||||
@@ -158,6 +167,352 @@ export const useGetTraceAggregations = <
|
||||
> => {
|
||||
return useMutation(getGetTraceAggregationsMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* Returns the overview of a trace of any size: its identity with per-service totals, the spans where each error started, the failures not marked as errors, the slowest spans by own time, the most expensive gen_ai spans, the spans that link to other spans, and the top of the span tree. A small trace also returns each span's full record. Every list carries its total and a nextCursor when more items follow.
|
||||
* @summary Inspect a trace
|
||||
*/
|
||||
export const inspectTrace = (
|
||||
{ traceID }: InspectTracePathParameters,
|
||||
params?: InspectTraceParams,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<InspectTrace200>({
|
||||
url: `/api/v1/traces/${traceID}/inspect`,
|
||||
method: 'GET',
|
||||
params,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
export const getInspectTraceQueryKey = (
|
||||
{ traceID }: InspectTracePathParameters,
|
||||
params?: InspectTraceParams,
|
||||
) => {
|
||||
return [
|
||||
`/api/v1/traces/${traceID}/inspect`,
|
||||
...(params ? [params] : []),
|
||||
] as const;
|
||||
};
|
||||
|
||||
export const getInspectTraceQueryOptions = <
|
||||
TData = Awaited<ReturnType<typeof inspectTrace>>,
|
||||
TError = ErrorType<RenderErrorResponseDTO>,
|
||||
>(
|
||||
{ traceID }: InspectTracePathParameters,
|
||||
params?: InspectTraceParams,
|
||||
options?: {
|
||||
query?: UseQueryOptions<
|
||||
Awaited<ReturnType<typeof inspectTrace>>,
|
||||
TError,
|
||||
TData
|
||||
>;
|
||||
},
|
||||
) => {
|
||||
const { query: queryOptions } = options ?? {};
|
||||
|
||||
const queryKey =
|
||||
queryOptions?.queryKey ?? getInspectTraceQueryKey({ traceID }, params);
|
||||
|
||||
const queryFn: QueryFunction<Awaited<ReturnType<typeof inspectTrace>>> = ({
|
||||
signal,
|
||||
}) => inspectTrace({ traceID }, params, signal);
|
||||
|
||||
return {
|
||||
queryKey,
|
||||
queryFn,
|
||||
enabled: traceID !== null && traceID !== undefined,
|
||||
...queryOptions,
|
||||
} as UseQueryOptions<
|
||||
Awaited<ReturnType<typeof inspectTrace>>,
|
||||
TError,
|
||||
TData
|
||||
> & { queryKey: QueryKey };
|
||||
};
|
||||
|
||||
export type InspectTraceQueryResult = NonNullable<
|
||||
Awaited<ReturnType<typeof inspectTrace>>
|
||||
>;
|
||||
export type InspectTraceQueryError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
* @summary Inspect a trace
|
||||
*/
|
||||
|
||||
export function useInspectTrace<
|
||||
TData = Awaited<ReturnType<typeof inspectTrace>>,
|
||||
TError = ErrorType<RenderErrorResponseDTO>,
|
||||
>(
|
||||
{ traceID }: InspectTracePathParameters,
|
||||
params?: InspectTraceParams,
|
||||
options?: {
|
||||
query?: UseQueryOptions<
|
||||
Awaited<ReturnType<typeof inspectTrace>>,
|
||||
TError,
|
||||
TData
|
||||
>;
|
||||
},
|
||||
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
||||
const queryOptions = getInspectTraceQueryOptions({ traceID }, params, options);
|
||||
|
||||
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
return withQueryKey(query, queryOptions.queryKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Inspect a trace
|
||||
*/
|
||||
export const invalidateInspectTrace = async (
|
||||
queryClient: QueryClient,
|
||||
{ traceID }: InspectTracePathParameters,
|
||||
params?: InspectTraceParams,
|
||||
options?: InvalidateOptions,
|
||||
): Promise<QueryClient> => {
|
||||
await queryClient.invalidateQueries(
|
||||
{ queryKey: getInspectTraceQueryKey({ traceID }, params) },
|
||||
options,
|
||||
);
|
||||
|
||||
return queryClient;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the spans of a trace that match a search, each with its direct parent and where the words were found. Without a search it returns every span in tree order, or with under one span and the spans below it.
|
||||
* @summary Search or list the spans of a trace
|
||||
*/
|
||||
export const inspectTraceSpans = (
|
||||
{ traceID }: InspectTraceSpansPathParameters,
|
||||
params?: InspectTraceSpansParams,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<InspectTraceSpans200>({
|
||||
url: `/api/v1/traces/${traceID}/inspect/spans`,
|
||||
method: 'GET',
|
||||
params,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
export const getInspectTraceSpansQueryKey = (
|
||||
{ traceID }: InspectTraceSpansPathParameters,
|
||||
params?: InspectTraceSpansParams,
|
||||
) => {
|
||||
return [
|
||||
`/api/v1/traces/${traceID}/inspect/spans`,
|
||||
...(params ? [params] : []),
|
||||
] as const;
|
||||
};
|
||||
|
||||
export const getInspectTraceSpansQueryOptions = <
|
||||
TData = Awaited<ReturnType<typeof inspectTraceSpans>>,
|
||||
TError = ErrorType<RenderErrorResponseDTO>,
|
||||
>(
|
||||
{ traceID }: InspectTraceSpansPathParameters,
|
||||
params?: InspectTraceSpansParams,
|
||||
options?: {
|
||||
query?: UseQueryOptions<
|
||||
Awaited<ReturnType<typeof inspectTraceSpans>>,
|
||||
TError,
|
||||
TData
|
||||
>;
|
||||
},
|
||||
) => {
|
||||
const { query: queryOptions } = options ?? {};
|
||||
|
||||
const queryKey =
|
||||
queryOptions?.queryKey ?? getInspectTraceSpansQueryKey({ traceID }, params);
|
||||
|
||||
const queryFn: QueryFunction<
|
||||
Awaited<ReturnType<typeof inspectTraceSpans>>
|
||||
> = ({ signal }) => inspectTraceSpans({ traceID }, params, signal);
|
||||
|
||||
return {
|
||||
queryKey,
|
||||
queryFn,
|
||||
enabled: traceID !== null && traceID !== undefined,
|
||||
...queryOptions,
|
||||
} as UseQueryOptions<
|
||||
Awaited<ReturnType<typeof inspectTraceSpans>>,
|
||||
TError,
|
||||
TData
|
||||
> & { queryKey: QueryKey };
|
||||
};
|
||||
|
||||
export type InspectTraceSpansQueryResult = NonNullable<
|
||||
Awaited<ReturnType<typeof inspectTraceSpans>>
|
||||
>;
|
||||
export type InspectTraceSpansQueryError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
* @summary Search or list the spans of a trace
|
||||
*/
|
||||
|
||||
export function useInspectTraceSpans<
|
||||
TData = Awaited<ReturnType<typeof inspectTraceSpans>>,
|
||||
TError = ErrorType<RenderErrorResponseDTO>,
|
||||
>(
|
||||
{ traceID }: InspectTraceSpansPathParameters,
|
||||
params?: InspectTraceSpansParams,
|
||||
options?: {
|
||||
query?: UseQueryOptions<
|
||||
Awaited<ReturnType<typeof inspectTraceSpans>>,
|
||||
TError,
|
||||
TData
|
||||
>;
|
||||
},
|
||||
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
||||
const queryOptions = getInspectTraceSpansQueryOptions(
|
||||
{ traceID },
|
||||
params,
|
||||
options,
|
||||
);
|
||||
|
||||
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
return withQueryKey(query, queryOptions.queryKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Search or list the spans of a trace
|
||||
*/
|
||||
export const invalidateInspectTraceSpans = async (
|
||||
queryClient: QueryClient,
|
||||
{ traceID }: InspectTraceSpansPathParameters,
|
||||
params?: InspectTraceSpansParams,
|
||||
options?: InvalidateOptions,
|
||||
): Promise<QueryClient> => {
|
||||
await queryClient.invalidateQueries(
|
||||
{ queryKey: getInspectTraceSpansQueryKey({ traceID }, params) },
|
||||
options,
|
||||
);
|
||||
|
||||
return queryClient;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns one span in full: its summary and record, its nearest ancestors with the root, the spans below it level by level, and where its duration sits among recent spans of the same name and service. Long values are cut and listed in truncated; selectFields returns named attributes without the cut.
|
||||
* @summary Inspect a span of a trace
|
||||
*/
|
||||
export const inspectTraceSpan = (
|
||||
{ traceID, spanID }: InspectTraceSpanPathParameters,
|
||||
params?: InspectTraceSpanParams,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<InspectTraceSpan200>({
|
||||
url: `/api/v1/traces/${traceID}/inspect/spans/${spanID}`,
|
||||
method: 'GET',
|
||||
params,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
export const getInspectTraceSpanQueryKey = (
|
||||
{ traceID, spanID }: InspectTraceSpanPathParameters,
|
||||
params?: InspectTraceSpanParams,
|
||||
) => {
|
||||
return [
|
||||
`/api/v1/traces/${traceID}/inspect/spans/${spanID}`,
|
||||
...(params ? [params] : []),
|
||||
] as const;
|
||||
};
|
||||
|
||||
export const getInspectTraceSpanQueryOptions = <
|
||||
TData = Awaited<ReturnType<typeof inspectTraceSpan>>,
|
||||
TError = ErrorType<RenderErrorResponseDTO>,
|
||||
>(
|
||||
{ traceID, spanID }: InspectTraceSpanPathParameters,
|
||||
params?: InspectTraceSpanParams,
|
||||
options?: {
|
||||
query?: UseQueryOptions<
|
||||
Awaited<ReturnType<typeof inspectTraceSpan>>,
|
||||
TError,
|
||||
TData
|
||||
>;
|
||||
},
|
||||
) => {
|
||||
const { query: queryOptions } = options ?? {};
|
||||
|
||||
const queryKey =
|
||||
queryOptions?.queryKey ??
|
||||
getInspectTraceSpanQueryKey({ traceID, spanID }, params);
|
||||
|
||||
const queryFn: QueryFunction<Awaited<ReturnType<typeof inspectTraceSpan>>> = ({
|
||||
signal,
|
||||
}) => inspectTraceSpan({ traceID, spanID }, params, signal);
|
||||
|
||||
return {
|
||||
queryKey,
|
||||
queryFn,
|
||||
enabled:
|
||||
traceID !== null &&
|
||||
traceID !== undefined &&
|
||||
spanID !== null &&
|
||||
spanID !== undefined,
|
||||
...queryOptions,
|
||||
} as UseQueryOptions<
|
||||
Awaited<ReturnType<typeof inspectTraceSpan>>,
|
||||
TError,
|
||||
TData
|
||||
> & { queryKey: QueryKey };
|
||||
};
|
||||
|
||||
export type InspectTraceSpanQueryResult = NonNullable<
|
||||
Awaited<ReturnType<typeof inspectTraceSpan>>
|
||||
>;
|
||||
export type InspectTraceSpanQueryError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
* @summary Inspect a span of a trace
|
||||
*/
|
||||
|
||||
export function useInspectTraceSpan<
|
||||
TData = Awaited<ReturnType<typeof inspectTraceSpan>>,
|
||||
TError = ErrorType<RenderErrorResponseDTO>,
|
||||
>(
|
||||
{ traceID, spanID }: InspectTraceSpanPathParameters,
|
||||
params?: InspectTraceSpanParams,
|
||||
options?: {
|
||||
query?: UseQueryOptions<
|
||||
Awaited<ReturnType<typeof inspectTraceSpan>>,
|
||||
TError,
|
||||
TData
|
||||
>;
|
||||
},
|
||||
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
||||
const queryOptions = getInspectTraceSpanQueryOptions(
|
||||
{ traceID, spanID },
|
||||
params,
|
||||
options,
|
||||
);
|
||||
|
||||
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
return withQueryKey(query, queryOptions.queryKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Inspect a span of a trace
|
||||
*/
|
||||
export const invalidateInspectTraceSpan = async (
|
||||
queryClient: QueryClient,
|
||||
{ traceID, spanID }: InspectTraceSpanPathParameters,
|
||||
params?: InspectTraceSpanParams,
|
||||
options?: InvalidateOptions,
|
||||
): Promise<QueryClient> => {
|
||||
await queryClient.invalidateQueries(
|
||||
{ queryKey: getInspectTraceSpanQueryKey({ traceID, spanID }, params) },
|
||||
options,
|
||||
);
|
||||
|
||||
return queryClient;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the trace's time range, root span, span and error counts, and whether any spans are missing. AI traces also include token and cost totals.
|
||||
* @summary Get summary for a trace
|
||||
|
||||
@@ -102,5 +102,59 @@ func (provider *provider) addTraceDetailRoutes(router *mux.Router) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := router.Handle("/api/v1/traces/{traceID}/inspect", handler.New(
|
||||
provider.authzMiddleware.ViewAccess(provider.traceDetailHandler.InspectTrace),
|
||||
handler.OpenAPIDef{
|
||||
ID: "InspectTrace",
|
||||
Tags: []string{"tracedetail"},
|
||||
Summary: "Inspect a trace",
|
||||
Description: "Returns the overview of a trace of any size: its identity with per-service totals, the spans where each error started, the failures not marked as errors, the slowest spans by own time, the most expensive gen_ai spans, the spans that link to other spans, and the top of the span tree. A small trace also returns each span's full record. Every list carries its total and a nextCursor when more items follow.",
|
||||
RequestQuery: new(spantypes.InspectTraceParams),
|
||||
Response: new(spantypes.TraceOverview),
|
||||
ResponseContentType: "application/json",
|
||||
SuccessStatusCode: http.StatusOK,
|
||||
ErrorStatusCodes: []int{http.StatusBadRequest, http.StatusNotFound},
|
||||
SecuritySchemes: newSecuritySchemes(types.RoleViewer),
|
||||
},
|
||||
)).Methods(http.MethodGet).GetError(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := router.Handle("/api/v1/traces/{traceID}/inspect/spans", handler.New(
|
||||
provider.authzMiddleware.ViewAccess(provider.traceDetailHandler.InspectTraceSpans),
|
||||
handler.OpenAPIDef{
|
||||
ID: "InspectTraceSpans",
|
||||
Tags: []string{"tracedetail"},
|
||||
Summary: "Search or list the spans of a trace",
|
||||
Description: "Returns the spans of a trace that match a search, each with its direct parent and where the words were found. Without a search it returns every span in tree order, or with under one span and the spans below it.",
|
||||
RequestQuery: new(spantypes.InspectTraceSpansParams),
|
||||
Response: new(spantypes.TraceSpanList),
|
||||
ResponseContentType: "application/json",
|
||||
SuccessStatusCode: http.StatusOK,
|
||||
ErrorStatusCodes: []int{http.StatusBadRequest, http.StatusNotFound},
|
||||
SecuritySchemes: newSecuritySchemes(types.RoleViewer),
|
||||
},
|
||||
)).Methods(http.MethodGet).GetError(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := router.Handle("/api/v1/traces/{traceID}/inspect/spans/{spanID}", handler.New(
|
||||
provider.authzMiddleware.ViewAccess(provider.traceDetailHandler.InspectTraceSpan),
|
||||
handler.OpenAPIDef{
|
||||
ID: "InspectTraceSpan",
|
||||
Tags: []string{"tracedetail"},
|
||||
Summary: "Inspect a span of a trace",
|
||||
Description: "Returns one span in full: its summary and record, its nearest ancestors with the root, the spans below it level by level, and where its duration sits among recent spans of the same name and service. Long values are cut and listed in truncated; selectFields returns named attributes without the cut.",
|
||||
RequestQuery: new(spantypes.InspectTraceSpanParams),
|
||||
Response: new(spantypes.TraceSpanDetail),
|
||||
ResponseContentType: "application/json",
|
||||
SuccessStatusCode: http.StatusOK,
|
||||
ErrorStatusCodes: []int{http.StatusBadRequest, http.StatusNotFound},
|
||||
SecuritySchemes: newSecuritySchemes(types.RoleViewer),
|
||||
},
|
||||
)).Methods(http.MethodGet).GetError(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package impltracedetail
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/SigNoz/signoz/pkg/errors"
|
||||
"github.com/SigNoz/signoz/pkg/http/binding"
|
||||
"github.com/SigNoz/signoz/pkg/http/render"
|
||||
"github.com/SigNoz/signoz/pkg/modules/tracedetail"
|
||||
@@ -127,3 +128,16 @@ func (h *handler) GetThread(rw http.ResponseWriter, r *http.Request) {
|
||||
|
||||
render.Success(rw, http.StatusOK, result)
|
||||
}
|
||||
|
||||
// The inspect routes are registered for their place in the API spec; the implementation follows.
|
||||
func (h *handler) InspectTrace(rw http.ResponseWriter, _ *http.Request) {
|
||||
render.Error(rw, errors.New(errors.TypeUnsupported, errors.CodeUnsupported, "trace inspect is not implemented yet"))
|
||||
}
|
||||
|
||||
func (h *handler) InspectTraceSpan(rw http.ResponseWriter, _ *http.Request) {
|
||||
render.Error(rw, errors.New(errors.TypeUnsupported, errors.CodeUnsupported, "trace span inspect is not implemented yet"))
|
||||
}
|
||||
|
||||
func (h *handler) InspectTraceSpans(rw http.ResponseWriter, _ *http.Request) {
|
||||
render.Error(rw, errors.New(errors.TypeUnsupported, errors.CodeUnsupported, "trace span search is not implemented yet"))
|
||||
}
|
||||
|
||||
@@ -16,6 +16,9 @@ type Handler interface {
|
||||
GetTraceAggregations(http.ResponseWriter, *http.Request)
|
||||
GetFlamegraph(http.ResponseWriter, *http.Request)
|
||||
GetThread(http.ResponseWriter, *http.Request)
|
||||
InspectTrace(http.ResponseWriter, *http.Request)
|
||||
InspectTraceSpan(http.ResponseWriter, *http.Request)
|
||||
InspectTraceSpans(http.ResponseWriter, *http.Request)
|
||||
}
|
||||
|
||||
// Module defines the business logic for trace detail operations.
|
||||
|
||||
230
pkg/types/spantypes/trace_inspect.go
Normal file
230
pkg/types/spantypes/trace_inspect.go
Normal file
@@ -0,0 +1,230 @@
|
||||
package spantypes
|
||||
|
||||
import (
|
||||
"github.com/SigNoz/signoz/pkg/valuer"
|
||||
)
|
||||
|
||||
var (
|
||||
UnmarkedFailureHTTP4xx = UnmarkedFailureReason{valuer.NewString("http_4xx")}
|
||||
UnmarkedFailureGRPCStatus = UnmarkedFailureReason{valuer.NewString("grpc_status")}
|
||||
UnmarkedFailureExceptionEvent = UnmarkedFailureReason{valuer.NewString("exception_event")}
|
||||
)
|
||||
|
||||
// UnmarkedFailureReason says why a span without the error flag is listed as a failure.
|
||||
type UnmarkedFailureReason struct{ valuer.String }
|
||||
|
||||
func (UnmarkedFailureReason) Enum() []any {
|
||||
return []any{UnmarkedFailureHTTP4xx, UnmarkedFailureGRPCStatus, UnmarkedFailureExceptionEvent}
|
||||
}
|
||||
|
||||
type InspectTraceParams struct {
|
||||
Cursor string `query:"cursor" description:"The nextCursor of one list of the overview; returns the next page of that list and nothing else."`
|
||||
}
|
||||
|
||||
type InspectTraceSpanParams struct {
|
||||
Depth int `query:"depth" description:"The number of levels of ancestors and of descendants returned, 1 to 10; 2 when not given. The root span is always returned."`
|
||||
SelectFields []string `query:"selectFields" description:"Attribute names returned without the 500 character cut; the record then holds only these attributes."`
|
||||
}
|
||||
|
||||
type InspectTraceSpansParams struct {
|
||||
Search string `query:"search" description:"Returns the spans that match, earliest first: words, a filter expression, or both, such as worldpay AND has_error = true. Words match the span name, status message, attributes, resource attributes and events, ignoring case. Without it every span is returned, in tree order."`
|
||||
Under string `query:"under" description:"A span ID; returns that span and every span below it. Cannot be combined with search."`
|
||||
Limit int `query:"limit" description:"Page size, at most 1000; when not given, 20 with search and 400 without. A page holds fewer spans when it would pass the response size limit."`
|
||||
Cursor string `query:"cursor" description:"The nextCursor of an earlier response to the same request; returns the next page."`
|
||||
}
|
||||
|
||||
// SpanSummary is the short form of a span: enough to place it in the trace and decide whether to open it.
|
||||
type SpanSummary struct {
|
||||
SpanID string `json:"spanId" required:"true"`
|
||||
ParentSpanID string `json:"parentSpanId,omitempty"`
|
||||
Name string `json:"name" required:"true"`
|
||||
ServiceName string `json:"serviceName" required:"true"`
|
||||
Kind string `json:"kind" required:"true"`
|
||||
// StartOffsetNano is the time from the start of the trace to the start of the span.
|
||||
StartOffsetNano uint64 `json:"startOffsetNano" required:"true"`
|
||||
DurationNano uint64 `json:"durationNano" required:"true"`
|
||||
// OwnTimeNano is the duration minus the time the span's children cover.
|
||||
OwnTimeNano uint64 `json:"ownTimeNano" required:"true"`
|
||||
ResponseStatusCode string `json:"responseStatusCode,omitempty"`
|
||||
HasError bool `json:"hasError" required:"true"`
|
||||
Level uint32 `json:"level" required:"true"`
|
||||
ChildCount uint32 `json:"childCount" required:"true"`
|
||||
// SubtreeSpanCount is the number of spans below this one.
|
||||
SubtreeSpanCount uint32 `json:"subtreeSpanCount" required:"true"`
|
||||
}
|
||||
|
||||
type TraceServiceStats struct {
|
||||
ServiceName string `json:"serviceName" required:"true"`
|
||||
SpanCount uint64 `json:"spanCount" required:"true"`
|
||||
ErrorSpanCount uint64 `json:"errorSpanCount" required:"true"`
|
||||
OwnTimeNano uint64 `json:"ownTimeNano" required:"true"`
|
||||
}
|
||||
|
||||
type TraceAIIdentity struct {
|
||||
ModelCallCount uint64 `json:"modelCallCount" required:"true"`
|
||||
ToolCallCount uint64 `json:"toolCallCount" required:"true"`
|
||||
Tokens TraceAITokens `json:"tokens" required:"true"`
|
||||
// TotalCost is omitted when no span carries a cost attribute.
|
||||
TotalCost *float64 `json:"totalCost,omitempty" nullable:"false"`
|
||||
}
|
||||
|
||||
type TraceIdentity struct {
|
||||
TraceID string `json:"traceId" required:"true"`
|
||||
StartTimestampMillis uint64 `json:"startTimestampMillis" required:"true"`
|
||||
DurationNano uint64 `json:"durationNano" required:"true"`
|
||||
// Root is the earliest span without a parent; omitted when every span's parent is missing.
|
||||
Root *SpanSummary `json:"root,omitempty"`
|
||||
SpanCount uint64 `json:"spanCount" required:"true"`
|
||||
ErrorSpanCount uint64 `json:"errorSpanCount" required:"true"`
|
||||
RootCount uint64 `json:"rootCount" required:"true"`
|
||||
HasMissingSpans bool `json:"hasMissingSpans" required:"true"`
|
||||
ServiceCount uint64 `json:"serviceCount" required:"true"`
|
||||
Services []TraceServiceStats `json:"services" required:"true" nullable:"false"`
|
||||
AI *TraceAIIdentity `json:"ai,omitempty"`
|
||||
}
|
||||
|
||||
// Every list has a total, items and a nextCursor when more items follow. Every item starts with
|
||||
// its span and that span's direct parent, omitted for a root or when the parent span is missing.
|
||||
type TraceErrorItem struct {
|
||||
Span SpanSummary `json:"span" required:"true"`
|
||||
Parent *SpanSummary `json:"parent,omitempty"`
|
||||
StatusMessage string `json:"statusMessage" required:"true"`
|
||||
// ErrorAncestorCount is the number of consecutive ancestors, from the parent up, that carry the error flag.
|
||||
ErrorAncestorCount uint32 `json:"errorAncestorCount" required:"true"`
|
||||
}
|
||||
|
||||
type TraceErrorList struct {
|
||||
Total uint64 `json:"total" required:"true"`
|
||||
Items []TraceErrorItem `json:"items" required:"true" nullable:"false"`
|
||||
NextCursor string `json:"nextCursor,omitempty"`
|
||||
}
|
||||
|
||||
type TraceUnmarkedFailureItem struct {
|
||||
Span SpanSummary `json:"span" required:"true"`
|
||||
Parent *SpanSummary `json:"parent,omitempty"`
|
||||
Reason UnmarkedFailureReason `json:"reason" required:"true"`
|
||||
}
|
||||
|
||||
type TraceUnmarkedFailureList struct {
|
||||
Total uint64 `json:"total" required:"true"`
|
||||
Items []TraceUnmarkedFailureItem `json:"items" required:"true" nullable:"false"`
|
||||
NextCursor string `json:"nextCursor,omitempty"`
|
||||
}
|
||||
|
||||
// TraceSlowestItem is one span, or the same-name spans under one parent taken together.
|
||||
type TraceSlowestItem struct {
|
||||
// Span is the longest span of the group.
|
||||
Span SpanSummary `json:"span" required:"true"`
|
||||
Parent *SpanSummary `json:"parent,omitempty"`
|
||||
SpanCount uint64 `json:"spanCount" required:"true"`
|
||||
OwnTimeNano uint64 `json:"ownTimeNano" required:"true"`
|
||||
ErrorSpanCount uint64 `json:"errorSpanCount" required:"true"`
|
||||
}
|
||||
|
||||
type TraceSlowestList struct {
|
||||
Total uint64 `json:"total" required:"true"`
|
||||
Items []TraceSlowestItem `json:"items" required:"true" nullable:"false"`
|
||||
NextCursor string `json:"nextCursor,omitempty"`
|
||||
}
|
||||
|
||||
type TraceExpensiveItem struct {
|
||||
Span SpanSummary `json:"span" required:"true"`
|
||||
Parent *SpanSummary `json:"parent,omitempty"`
|
||||
Cost *float64 `json:"cost,omitempty" nullable:"false"`
|
||||
InputTokens uint64 `json:"inputTokens" required:"true"`
|
||||
OutputTokens uint64 `json:"outputTokens" required:"true"`
|
||||
}
|
||||
|
||||
type TraceExpensiveList struct {
|
||||
Total uint64 `json:"total" required:"true"`
|
||||
Items []TraceExpensiveItem `json:"items" required:"true" nullable:"false"`
|
||||
NextCursor string `json:"nextCursor,omitempty"`
|
||||
}
|
||||
|
||||
type TraceLinkItem struct {
|
||||
Span SpanSummary `json:"span" required:"true"`
|
||||
Parent *SpanSummary `json:"parent,omitempty"`
|
||||
// LinkCount is the number of spans this span links to; Links holds the first of them.
|
||||
LinkCount uint64 `json:"linkCount" required:"true"`
|
||||
Links []Link `json:"links" required:"true" nullable:"false"`
|
||||
}
|
||||
|
||||
// TraceLinkList lists the spans of this trace that link to other spans, in this or another trace.
|
||||
type TraceLinkList struct {
|
||||
Total uint64 `json:"total" required:"true"`
|
||||
Items []TraceLinkItem `json:"items" required:"true" nullable:"false"`
|
||||
NextCursor string `json:"nextCursor,omitempty"`
|
||||
}
|
||||
|
||||
type TraceTree struct {
|
||||
// Total is the number of spans in the trace; Spans holds every one of them when Complete is set.
|
||||
Total uint64 `json:"total" required:"true"`
|
||||
Complete bool `json:"complete" required:"true"`
|
||||
// Spans is in tree order: a span is followed by the spans below it. A span's childCount and
|
||||
// subtreeSpanCount say how much of the trace sits under it.
|
||||
Spans []SpanSummary `json:"spans" required:"true" nullable:"false"`
|
||||
// Records holds the full record of every span of a small trace.
|
||||
Records []SpanRecord `json:"records,omitempty" nullable:"false"`
|
||||
}
|
||||
|
||||
// TraceOverview holds every part on a first call and one list on a call with a cursor.
|
||||
type TraceOverview struct {
|
||||
Identity *TraceIdentity `json:"identity,omitempty"`
|
||||
Errors *TraceErrorList `json:"errors,omitempty"`
|
||||
UnmarkedFailures *TraceUnmarkedFailureList `json:"unmarkedFailures,omitempty"`
|
||||
Slowest *TraceSlowestList `json:"slowest,omitempty"`
|
||||
// Expensive is present when the trace has gen_ai spans.
|
||||
Expensive *TraceExpensiveList `json:"expensive,omitempty"`
|
||||
Links *TraceLinkList `json:"links,omitempty"`
|
||||
Tree *TraceTree `json:"tree,omitempty"`
|
||||
}
|
||||
|
||||
type TraceSpanLevel struct {
|
||||
// Level counts down from the span: 1 holds its children.
|
||||
Level uint32 `json:"level" required:"true"`
|
||||
Total uint64 `json:"total" required:"true"`
|
||||
Spans []SpanSummary `json:"spans" required:"true" nullable:"false"`
|
||||
}
|
||||
|
||||
// TraceSpanPercentile places a span's duration among the spans of the same name and service that
|
||||
// started in the window before it.
|
||||
type TraceSpanPercentile struct {
|
||||
P50Nano uint64 `json:"p50Nano" required:"true"`
|
||||
P90Nano uint64 `json:"p90Nano" required:"true"`
|
||||
P99Nano uint64 `json:"p99Nano" required:"true"`
|
||||
// Position is the share of those spans, 0 to 100, that were no slower than this one.
|
||||
Position float64 `json:"position" required:"true"`
|
||||
WindowMinutes uint64 `json:"windowMinutes" required:"true"`
|
||||
}
|
||||
|
||||
type TraceSpanDetail struct {
|
||||
Summary SpanSummary `json:"summary" required:"true"`
|
||||
Record SpanRecord `json:"record" required:"true"`
|
||||
// Percentile is omitted when it could not be computed in time.
|
||||
Percentile *TraceSpanPercentile `json:"percentile,omitempty"`
|
||||
// Ancestors holds the nearest ancestors, the parent first, then the root when it is further up.
|
||||
Ancestors []SpanSummary `json:"ancestors" required:"true" nullable:"false"`
|
||||
AncestorCount uint64 `json:"ancestorCount" required:"true"`
|
||||
Descendants []TraceSpanLevel `json:"descendants" required:"true" nullable:"false"`
|
||||
}
|
||||
|
||||
type SpanTextMatch struct {
|
||||
Field string `json:"field" required:"true"`
|
||||
Snippet string `json:"snippet" required:"true"`
|
||||
}
|
||||
|
||||
type TraceSpanMatch struct {
|
||||
Span SpanSummary `json:"span" required:"true"`
|
||||
Parent *SpanSummary `json:"parent,omitempty"`
|
||||
// Matches says where the searched words were found; empty for a filter without words.
|
||||
Matches []SpanTextMatch `json:"matches" required:"true" nullable:"false"`
|
||||
}
|
||||
|
||||
// TraceSpanList holds the spans matching a search, or every span when there is none.
|
||||
type TraceSpanList struct {
|
||||
Total uint64 `json:"total" required:"true"`
|
||||
Items []TraceSpanMatch `json:"items" required:"true" nullable:"false"`
|
||||
NextCursor string `json:"nextCursor,omitempty"`
|
||||
// Warnings says why a search may have matched less than expected, such as a key that is not known.
|
||||
Warnings []string `json:"warnings,omitempty" nullable:"false"`
|
||||
}
|
||||
20
pkg/types/spantypes/trace_span_record.go
Normal file
20
pkg/types/spantypes/trace_span_record.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package spantypes
|
||||
|
||||
// TruncatedField names a value of a span record that was cut, with its full length in characters.
|
||||
type TruncatedField struct {
|
||||
Field string `json:"field" required:"true"`
|
||||
Length uint64 `json:"length" required:"true"`
|
||||
}
|
||||
|
||||
// SpanRecord is everything stored on a span. Long values are cut and listed in Truncated.
|
||||
type SpanRecord struct {
|
||||
SpanID string `json:"spanId" required:"true"`
|
||||
StatusCode string `json:"statusCode" required:"true"`
|
||||
StatusMessage string `json:"statusMessage" required:"true"`
|
||||
Attributes map[string]any `json:"attributes" required:"true" nullable:"false"`
|
||||
Resource map[string]string `json:"resource" required:"true" nullable:"false"`
|
||||
Events []EventV2 `json:"events" required:"true" nullable:"false"`
|
||||
// Links holds the spans this span links to, in this or another trace.
|
||||
Links []Link `json:"links" required:"true" nullable:"false"`
|
||||
Truncated []TruncatedField `json:"truncated" required:"true" nullable:"false"`
|
||||
}
|
||||
Reference in New Issue
Block a user