generated

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func NewExecutableSchema

func NewExecutableSchema(cfg Config) graphql.ExecutableSchema

NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.

Types

type Annotation added in v0.7.0

type Annotation struct {
	// The annotation entries, sorted by key.
	Values []AnnotationEntry `json:"values"`
	// Who set them, if recorded (may be empty).
	Author *string `json:"author,omitempty"`
	// When they were last updated (RFC 3339), or empty if never set.
	UpdatedAt *string `json:"updatedAt,omitempty"`
}

The operator annotations on an entity: out-of-band notes an operator attached, kept in a per-tenant sidecar and never mixed into producer truth or the log.

type AnnotationEntry added in v0.7.0

type AnnotationEntry struct {
	// The annotation key, e.g. `owner` or `runbook`.
	Key string `json:"key"`
	// The free-text value.
	Value string `json:"value"`
}

A single operator annotation: a key paired with a free-text value. Unlike an `Attribute`, an annotation value is always a string and carries no `ValueType`.

type AnnotationInput added in v0.7.0

type AnnotationInput struct {
	// The annotation key.
	Key string `json:"key"`
	// The free-text value; empty removes the key.
	Value string `json:"value"`
}

A single annotation to merge: an empty `value` removes that key.

type Attribute

type Attribute struct {
	// The attribute key, e.g. `host.name` or `status`.
	Key string `json:"key"`
	// The value rendered as a string. Interpret it according to `type`.
	Value string `json:"value"`
	// How to interpret `value`.
	Type ValueType `json:"type"`
}

A single attribute: a key paired with a typed value. The value is rendered as a string for transport; `type` tells you how to interpret it (e.g. the string `"8"` with type INT is the integer 8). Example: { key: "status", value: "up", type: STRING }.

type AttributeMatch added in v0.8.0

type AttributeMatch struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

One attribute key/value equality, used by EntityFilter.match.

type ChangeConnection

type ChangeConnection struct {
	Edges      []ChangeEdge `json:"edges"`
	PageInfo   *PageInfo    `json:"pageInfo"`
	TotalCount int          `json:"totalCount"`
}

A paginated list of change events.

type ChangeEdge

type ChangeEdge struct {
	Cursor string       `json:"cursor"`
	Node   *ChangeEvent `json:"node"`
}

type ChangeEvent

type ChangeEvent struct {
	// Event identifier (a ULID, time-sortable).
	ID string `json:"id"`
	// The classification of this change.
	ChangeType ChangeType `json:"changeType"`
	// When the fact became true in the real world (RFC 3339).
	EventTime string `json:"eventTime"`
	// When Toise recorded the event (RFC 3339).
	RecordedAt string `json:"recordedAt"`
	// Toise schema version of the event, e.g. `1.0`.
	SchemaVersion string `json:"schemaVersion"`
	// For attribute/state changes, the keys that changed.
	ChangedKeys []string `json:"changedKeys"`
	// For an entity.deleted event, the producer's motive (entity.delete.reason):
	// an OPEN enum (e.g. `terminated`, `expired`, `evicted`, `user_requested`,
	// `scaled_down`) kept verbatim. Null when none was given or for non-delete
	// events.
	DeleteReason *string `json:"deleteReason,omitempty"`
	// Events dropped just before this one because this subscriber could not keep
	// up. Positive means you have a gap: re-query the current state and resume.
	Dropped int `json:"dropped"`
	// The entity this event is about, if it is an entity event.
	Entity *Entity `json:"entity,omitempty"`
	// The relation this event is about, if it is a relation event.
	Relation *Relation `json:"relation,omitempty"`
}

A qualified, bi-temporal change event from the log. Exactly one of `entity` or `relation` is set. `eventTime` is when the fact became true in the real world (from the producer); `recordedAt` is when Toise recorded it. They differ for late or retroactive events — query history in eventTime space, audit with recordedAt.

type ChangeFilter

type ChangeFilter struct {
	// Only events about entities of this type (entityChanged).
	EntityType *string `json:"entityType,omitempty"`
	// Only events about relations of this type (relationChanged).
	RelationType *string `json:"relationType,omitempty"`
	// Only this change classification.
	ChangeType *ChangeType `json:"changeType,omitempty"`
	// Only structural relation changes — alert-worthy topology (relationChanged).
	StructuralOnly *bool `json:"structuralOnly,omitempty"`
}

Server-side filter for a change subscription: only matching events are delivered, so a consumer watching one type does not receive everything.

type ChangeType

type ChangeType string

The classification of a change, per the Toise change taxonomy. Use this to ask 'what kind of change happened', e.g. filter recent changes to state flips or to structural relation changes.

const (
	// The entity did not exist before this event.
	ChangeTypeEntityCreated ChangeType = "ENTITY_CREATED"
	// The entity existed and is now soft-deleted; the log retains its history.
	ChangeTypeEntityDeleted ChangeType = "ENTITY_DELETED"
	// An identifying attribute mutated (anomalous; the logical id is preserved).
	ChangeTypeEntityIdentityChanged ChangeType = "ENTITY_IDENTITY_CHANGED"
	// A descriptive (non-identifying) attribute changed.
	ChangeTypeEntityAttributeUpdated ChangeType = "ENTITY_ATTRIBUTE_UPDATED"
	// A state-flagged attribute (oper_state, admin_state, status) flipped value.
	ChangeTypeEntityStateChanged ChangeType = "ENTITY_STATE_CHANGED"
	// A heartbeat: the entity is alive but nothing changed.
	ChangeTypeEntityUnchanged ChangeType = "ENTITY_UNCHANGED"
	// A new relation (edge) appeared.
	ChangeTypeRelationAdded ChangeType = "RELATION_ADDED"
	// A relation (edge) disappeared.
	ChangeTypeRelationRemoved ChangeType = "RELATION_REMOVED"
	// Relation metadata mutated.
	ChangeTypeRelationAttributeChanged ChangeType = "RELATION_ATTRIBUTE_CHANGED"
)

func (ChangeType) IsValid

func (e ChangeType) IsValid() bool

func (ChangeType) MarshalGQL

func (e ChangeType) MarshalGQL(w io.Writer)

func (ChangeType) MarshalJSON

func (e ChangeType) MarshalJSON() ([]byte, error)

func (ChangeType) String

func (e ChangeType) String() string

func (*ChangeType) UnmarshalGQL

func (e *ChangeType) UnmarshalGQL(v any) error

func (*ChangeType) UnmarshalJSON

func (e *ChangeType) UnmarshalJSON(b []byte) error

type ComplexityRoot

type ComplexityRoot struct {
	Annotation struct {
		Author    func(childComplexity int) int
		UpdatedAt func(childComplexity int) int
		Values    func(childComplexity int) int
	}

	AnnotationEntry struct {
		Key   func(childComplexity int) int
		Value func(childComplexity int) int
	}

	Attribute struct {
		Key   func(childComplexity int) int
		Type  func(childComplexity int) int
		Value func(childComplexity int) int
	}

	ChangeConnection struct {
		Edges      func(childComplexity int) int
		PageInfo   func(childComplexity int) int
		TotalCount func(childComplexity int) int
	}

	ChangeEdge struct {
		Cursor func(childComplexity int) int
		Node   func(childComplexity int) int
	}

	ChangeEvent struct {
		ChangeType    func(childComplexity int) int
		ChangedKeys   func(childComplexity int) int
		DeleteReason  func(childComplexity int) int
		Dropped       func(childComplexity int) int
		Entity        func(childComplexity int) int
		EventTime     func(childComplexity int) int
		ID            func(childComplexity int) int
		RecordedAt    func(childComplexity int) int
		Relation      func(childComplexity int) int
		SchemaVersion func(childComplexity int) int
	}

	Entity struct {
		Annotations func(childComplexity int) int
		Attributes  func(childComplexity int) int
		Deleted     func(childComplexity int) int
		ID          func(childComplexity int) int
		Identity    func(childComplexity int) int
		SchemaURL   func(childComplexity int) int
		Type        func(childComplexity int) int
	}

	EntityConnection struct {
		Edges      func(childComplexity int) int
		PageInfo   func(childComplexity int) int
		TotalCount func(childComplexity int) int
	}

	EntityEdge struct {
		Cursor func(childComplexity int) int
		Node   func(childComplexity int) int
	}

	Mutation struct {
		AnnotateEntity func(childComplexity int, id string, annotations []AnnotationInput) int
	}

	PageInfo struct {
		EndCursor   func(childComplexity int) int
		HasNextPage func(childComplexity int) int
	}

	Query struct {
		Entities      func(childComplexity int, filter *EntityFilter, first *int, after *string, asOf *string) int
		Entity        func(childComplexity int, id string, asOf *string) int
		EntityHistory func(childComplexity int, id string, since *string, until *string, asKnownAt *string, first *int, after *string) int
		RecentChanges func(childComplexity int, window string, first *int, after *string) int
		Relations     func(childComplexity int, filter *RelationFilter, first *int, after *string, asOf *string) int
	}

	Relation struct {
		Attributes func(childComplexity int) int
		FromID     func(childComplexity int) int
		ID         func(childComplexity int) int
		Structural func(childComplexity int) int
		ToID       func(childComplexity int) int
		Type       func(childComplexity int) int
	}

	RelationConnection struct {
		Edges      func(childComplexity int) int
		PageInfo   func(childComplexity int) int
		TotalCount func(childComplexity int) int
	}

	RelationEdge struct {
		Cursor func(childComplexity int) int
		Node   func(childComplexity int) int
	}

	Subscription struct {
		EntityChanged   func(childComplexity int, filter *ChangeFilter) int
		RelationChanged func(childComplexity int, filter *ChangeFilter) int
	}
}

type DirectiveRoot

type DirectiveRoot struct {
}

type Entity

type Entity struct {
	// Stable logical identifier (a ULID). Survives identity changes.
	ID string `json:"id"`
	// Entity type, e.g. `host`, `process`, `network.interface`.
	Type string `json:"type"`
	// Identifying attributes — their values together identify the entity.
	Identity []Attribute `json:"identity"`
	// Descriptive (non-identifying) attributes, e.g. `status`, `os`.
	Attributes []Attribute `json:"attributes"`
	// URL versioning the entity definition (may be empty).
	SchemaURL string `json:"schemaUrl"`
	// True if the entity has been soft-deleted (its history is retained).
	Deleted bool `json:"deleted"`
	// Operator annotations attached out-of-band, or null if the entity has none.
	// These are an overlay kept in a per-tenant sidecar — never producer truth and
	// never part of the event log.
	Annotations *Annotation `json:"annotations,omitempty"`
}

An infrastructure entity (a host, process, network interface, address, route, or service listener) aligned with the OpenTelemetry entity data model. The `id` is a stable logical identifier that survives identity changes.

type EntityConnection

type EntityConnection struct {
	Edges    []EntityEdge `json:"edges"`
	PageInfo *PageInfo    `json:"pageInfo"`
	// Total number of entities matching the filter, across all pages.
	TotalCount int `json:"totalCount"`
}

A paginated list of entities.

type EntityEdge

type EntityEdge struct {
	Cursor string  `json:"cursor"`
	Node   *Entity `json:"node"`
}

type EntityFilter

type EntityFilter struct {
	// Restrict to this entity type, e.g. `host`.
	Type *string `json:"type,omitempty"`
	// Keep only entities where every given key equals the given value, matched
	// against both identifying and descriptive attributes (AND semantics). Mirrors
	// the MCP `find_entities` match — use it to filter on governance attributes such
	// as `service.criticality` or `entity.owner.team`.
	Match []AttributeMatch `json:"match,omitempty"`
}

Filter for the entities query.

type EntityResolver added in v0.7.0

type EntityResolver interface {
	Annotations(ctx context.Context, obj *Entity) (*Annotation, error)
}

type Mutation added in v0.7.0

type Mutation struct {
}

type MutationResolver added in v0.7.0

type MutationResolver interface {
	AnnotateEntity(ctx context.Context, id string, annotations []AnnotationInput) (*Annotation, error)
}

type PageInfo

type PageInfo struct {
	// True if more results follow the current page.
	HasNextPage bool `json:"hasNextPage"`
	// Opaque cursor of the last edge; pass as `after` to fetch the next page.
	EndCursor *string `json:"endCursor,omitempty"`
}

Relay-style pagination metadata.

type Query

type Query struct {
}

type QueryResolver

type QueryResolver interface {
	Entity(ctx context.Context, id string, asOf *string) (*Entity, error)
	Entities(ctx context.Context, filter *EntityFilter, first *int, after *string, asOf *string) (*EntityConnection, error)
	Relations(ctx context.Context, filter *RelationFilter, first *int, after *string, asOf *string) (*RelationConnection, error)
	EntityHistory(ctx context.Context, id string, since *string, until *string, asKnownAt *string, first *int, after *string) (*ChangeConnection, error)
	RecentChanges(ctx context.Context, window string, first *int, after *string) (*ChangeConnection, error)
}

type Relation

type Relation struct {
	// Deterministic identifier derived from type and endpoints.
	ID string `json:"id"`
	// Relation type, e.g. `runs_on`, `has_interface`, `listens_on`.
	Type string `json:"type"`
	// Logical id of the source entity.
	FromID string `json:"fromId"`
	// Logical id of the target entity.
	ToID string `json:"toId"`
	// Optional edge metadata, e.g. `port` on `listens_on`.
	Attributes []Attribute `json:"attributes"`
	// Whether the relation is structural (its add/remove is significant).
	Structural bool `json:"structural"`
}

A typed, directed edge between two entities (referenced by their logical ids). `structural: true` means the relation's appearance/disappearance is significant (suitable for alerting), e.g. `runs_on`, `has_interface`.

type RelationConnection

type RelationConnection struct {
	Edges      []RelationEdge `json:"edges"`
	PageInfo   *PageInfo      `json:"pageInfo"`
	TotalCount int            `json:"totalCount"`
}

A paginated list of relations.

type RelationEdge

type RelationEdge struct {
	Cursor string    `json:"cursor"`
	Node   *Relation `json:"node"`
}

type RelationFilter

type RelationFilter struct {
	// Restrict to this relation type, e.g. `runs_on`.
	Type *string `json:"type,omitempty"`
	// Restrict to relations originating from this entity id.
	FromID *string `json:"fromId,omitempty"`
	// Restrict to relations targeting this entity id.
	ToID *string `json:"toId,omitempty"`
}

Filter for the relations query.

type ResolverRoot

type ResolverRoot interface {
	Entity() EntityResolver
	Mutation() MutationResolver
	Query() QueryResolver
	Subscription() SubscriptionResolver
}

type Subscription

type Subscription struct {
}

type SubscriptionResolver

type SubscriptionResolver interface {
	EntityChanged(ctx context.Context, filter *ChangeFilter) (<-chan *ChangeEvent, error)
	RelationChanged(ctx context.Context, filter *ChangeFilter) (<-chan *ChangeEvent, error)
}

type ValueType

type ValueType string

The kind of a typed attribute value. Toise attribute values are scalars: a string, a 64-bit integer, a double, or a boolean.

const (
	ValueTypeString ValueType = "STRING"
	ValueTypeInt    ValueType = "INT"
	ValueTypeDouble ValueType = "DOUBLE"
	ValueTypeBool   ValueType = "BOOL"
	// An array AnyValue; `value` is its compact JSON encoding.
	ValueTypeArray ValueType = "ARRAY"
	// A nested map (kvlist) AnyValue; `value` is its compact JSON encoding.
	ValueTypeKvlist ValueType = "KVLIST"
)

func (ValueType) IsValid

func (e ValueType) IsValid() bool

func (ValueType) MarshalGQL

func (e ValueType) MarshalGQL(w io.Writer)

func (ValueType) MarshalJSON

func (e ValueType) MarshalJSON() ([]byte, error)

func (ValueType) String

func (e ValueType) String() string

func (*ValueType) UnmarshalGQL

func (e *ValueType) UnmarshalGQL(v any) error

func (*ValueType) UnmarshalJSON

func (e *ValueType) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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