Documentation
¶
Overview ¶
Package runtime correlates observed traces with the indexed graph.
It answers the question static analysis cannot: not "what could run", but "what did". An endpoint the index knows about and no trace ever reached is either dead or untested, and those are different conversations — but you cannot start either from the static graph alone.
Why correlation is heuristic, and labelled as such ¶
A span says `http.route = "/payment/callback"`; the index says an endpoint symbol is named `POST /payment/callback`. Matching them is string work, not proof. OpenTelemetry's `code.function` attribute is better evidence and is preferred when present, but most services do not set it. So every correlation carries HOW it was made, and a report that cannot say why it matched says so rather than presenting a guess as a measurement.
What this deliberately does not do ¶
It does not sample, collect or receive telemetry. It reads an exported file. A service that must be running for GraphLume to work is a service GraphLume has no business requiring, and the export is the artefact CI already produces.
It does not persist spans. Runtime data ages out in hours while an index describes a commit, and storing them together would produce a graph whose edges are true at different times — the single most confusing thing a knowledge graph can do.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MatchKind ¶
type MatchKind string
MatchKind records how a span was tied to code, so a reader can weigh it.
const ( // MatchCodeAttribute is an explicit code.function/code.namespace attribute. // The strongest evidence available: the instrumentation named the symbol. MatchCodeAttribute MatchKind = "code-attribute" // MatchRoute is an http.route matching an endpoint the index extracted. MatchRoute MatchKind = "route" // MatchTable is a db.sql.table matching a table the index extracted. MatchTable MatchKind = "table" // MatchName is the span name matching a symbol name. Weakest, and reported // as such: span names are free text and collide freely. MatchName MatchKind = "name" )
type Observed ¶
type Observed struct {
SymbolID int64 `json:"symbol_id"`
Name string `json:"name"`
Kind string `json:"kind"`
Path string `json:"path"`
Match MatchKind `json:"match"`
Calls int `json:"calls"`
Errors int `json:"errors"`
P95Nanos int64 `json:"p95_nanos"`
}
Observed is one indexed entity that a trace reached.
type Registry ¶
type Registry interface {
Files(ctx context.Context, runID int64) ([]model.File, error)
Symbols(ctx context.Context, runID int64) ([]model.Symbol, error)
}
Registry is the read surface this capability needs.
type Report ¶
type Report struct {
Spans int `json:"spans"`
Traces int `json:"traces"`
Services []string `json:"services"`
// Exercised are indexed entities a trace reached.
Exercised []Observed `json:"exercised"`
// ColdEndpoints are endpoints the index knows and no span reached. The most
// actionable output here: an endpoint nothing calls is either dead code or
// an untested path, and both are worth knowing before a refactor.
ColdEndpoints []Observed `json:"cold_endpoints"`
// Unmatched are span operation names that matched nothing indexed. A large
// number means the correlation is weak, not that the code is absent, so it
// is reported rather than quietly dropped.
Unmatched []string `json:"unmatched"`
}
Report is one correlation pass.