insightobs

package
v1.125.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 24, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package insightobs observes the warehouse state behind a pending insight's entities so the review path can put a claim beside what the platform can see for itself.

A captured insight carries the URNs it is about. When a query provider resolves one of those URNs to an available table, the reviewer deciding whether to certify the claim should not have to take the claim's word for the world it describes: the table it names, the connection it lives on, and the row count the engine currently reports belong beside the claim text.

Every observation is advisory. A URN that does not resolve, a table that is not available, a provider that is absent or noop, and a provider that is slow all degrade to no observation at all — never to an error and never to a refused promotion.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conflict

type Conflict struct {
	ClaimedRows  int64  `json:"claimed_rows" example:"1140"`
	ObservedRows int64  `json:"observed_rows" example:"1200"`
	Message      string `json:"message" example:"claim states 1140; the table currently estimates 1200"`
}

Conflict is the advisory marker raised when a claim states a number and the table currently estimates a different one. It never blocks a promotion: estimates are estimates, the claim may be about something else entirely, and the reviewer decides.

type Observation

type Observation struct {
	URN           string    `json:"urn" example:"urn:li:dataset:(urn:li:dataPlatform:trino,iceberg.retail.daily_sales,PROD)"`
	QueryTable    string    `json:"query_table,omitempty" example:"iceberg.retail.daily_sales"`
	Connection    string    `json:"connection,omitempty" example:"primary"`
	EstimatedRows *int64    `json:"estimated_rows,omitempty" example:"1200"`
	Conflict      *Conflict `json:"conflict,omitempty"`
}

Observation is the warehouse state observed for one entity URN carried by an insight. It is only ever produced for a URN the provider resolved to an available table, so an Observation means "the platform can see this entity", not "the platform looked".

type Observer

type Observer struct {
	// contains filtered or unexported fields
}

Observer resolves insight entity URNs through a query provider, remembering each answer briefly so a polling review queue does not re-ask the warehouse the same question every refresh. The lookup and its memory are the shared tableavail.Cache; this type owns only what the review path adds on top of it, the pending-only scope and the claim-versus-estimate conflict marker.

func New

func New(p query.Provider) *Observer

New returns an Observer over p, or nil when no query provider is configured. A nil *Observer observes nothing, so a caller never needs a branch of its own for the no-provider deployment.

func (*Observer) Annotate

func (o *Observer) Annotate(ctx context.Context, insights []knowledge.Insight) [][]Observation

Annotate returns the observed entity state for each insight, index-aligned with insights. Entry i is nil unless insight i is pending and at least one of its entity URNs resolved to an available table: a decided insight is history, not a call to check the world again.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL