telemetry

package
v0.0.0-...-afdc31a Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const APIName = "gram"

APIName is the name of the API as defined in the design.

View Source
const APIVersion = "0.0.1"

APIVersion is the version of the API as defined in the design.

View Source
const ServiceName = "telemetry"

ServiceName is the name of the service as defined in the design. This is the same value that is set in the endpoint request contexts under the ServiceKey key.

Variables

View Source
var MethodNames = [13]string{"searchLogs", "searchToolCalls", "searchChats", "searchUsers", "captureEvent", "getProjectMetricsSummary", "getUserMetricsSummary", "getObservabilityOverview", "getProjectOverview", "listFilterOptions", "listAttributeKeys", "getHooksSummary", "listHooksTraces"}

MethodNames lists the service method names as defined in the design. These are the same values that are set in the endpoint request contexts under the MethodKey key.

Functions

func MakeBadRequest

func MakeBadRequest(err error) *goa.ServiceError

MakeBadRequest builds a goa.ServiceError from an error.

func MakeConflict

func MakeConflict(err error) *goa.ServiceError

MakeConflict builds a goa.ServiceError from an error.

func MakeForbidden

func MakeForbidden(err error) *goa.ServiceError

MakeForbidden builds a goa.ServiceError from an error.

func MakeGatewayError

func MakeGatewayError(err error) *goa.ServiceError

MakeGatewayError builds a goa.ServiceError from an error.

func MakeInvalid

func MakeInvalid(err error) *goa.ServiceError

MakeInvalid builds a goa.ServiceError from an error.

func MakeInvariantViolation

func MakeInvariantViolation(err error) *goa.ServiceError

MakeInvariantViolation builds a goa.ServiceError from an error.

func MakeNotFound

func MakeNotFound(err error) *goa.ServiceError

MakeNotFound builds a goa.ServiceError from an error.

func MakeUnauthorized

func MakeUnauthorized(err error) *goa.ServiceError

MakeUnauthorized builds a goa.ServiceError from an error.

func MakeUnexpected

func MakeUnexpected(err error) *goa.ServiceError

MakeUnexpected builds a goa.ServiceError from an error.

func MakeUnsupportedMedia

func MakeUnsupportedMedia(err error) *goa.ServiceError

MakeUnsupportedMedia builds a goa.ServiceError from an error.

func NewCaptureEventEndpoint

func NewCaptureEventEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc, authJWTFn security.AuthJWTFunc) goa.Endpoint

NewCaptureEventEndpoint returns an endpoint function that calls the method "captureEvent" of service "telemetry".

func NewGetHooksSummaryEndpoint

func NewGetHooksSummaryEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint

NewGetHooksSummaryEndpoint returns an endpoint function that calls the method "getHooksSummary" of service "telemetry".

func NewGetObservabilityOverviewEndpoint

func NewGetObservabilityOverviewEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint

NewGetObservabilityOverviewEndpoint returns an endpoint function that calls the method "getObservabilityOverview" of service "telemetry".

func NewGetProjectMetricsSummaryEndpoint

func NewGetProjectMetricsSummaryEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint

NewGetProjectMetricsSummaryEndpoint returns an endpoint function that calls the method "getProjectMetricsSummary" of service "telemetry".

func NewGetProjectOverviewEndpoint

func NewGetProjectOverviewEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint

NewGetProjectOverviewEndpoint returns an endpoint function that calls the method "getProjectOverview" of service "telemetry".

func NewGetUserMetricsSummaryEndpoint

func NewGetUserMetricsSummaryEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint

NewGetUserMetricsSummaryEndpoint returns an endpoint function that calls the method "getUserMetricsSummary" of service "telemetry".

func NewListAttributeKeysEndpoint

func NewListAttributeKeysEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint

NewListAttributeKeysEndpoint returns an endpoint function that calls the method "listAttributeKeys" of service "telemetry".

func NewListFilterOptionsEndpoint

func NewListFilterOptionsEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint

NewListFilterOptionsEndpoint returns an endpoint function that calls the method "listFilterOptions" of service "telemetry".

func NewListHooksTracesEndpoint

func NewListHooksTracesEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint

NewListHooksTracesEndpoint returns an endpoint function that calls the method "listHooksTraces" of service "telemetry".

func NewSearchChatsEndpoint

func NewSearchChatsEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint

NewSearchChatsEndpoint returns an endpoint function that calls the method "searchChats" of service "telemetry".

func NewSearchLogsEndpoint

func NewSearchLogsEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint

NewSearchLogsEndpoint returns an endpoint function that calls the method "searchLogs" of service "telemetry".

func NewSearchToolCallsEndpoint

func NewSearchToolCallsEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint

NewSearchToolCallsEndpoint returns an endpoint function that calls the method "searchToolCalls" of service "telemetry".

func NewSearchUsersEndpoint

func NewSearchUsersEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint

NewSearchUsersEndpoint returns an endpoint function that calls the method "searchUsers" of service "telemetry".

Types

type Auther

type Auther interface {
	// APIKeyAuth implements the authorization logic for the APIKey security scheme.
	APIKeyAuth(ctx context.Context, key string, schema *security.APIKeyScheme) (context.Context, error)
	// JWTAuth implements the authorization logic for the JWT security scheme.
	JWTAuth(ctx context.Context, token string, schema *security.JWTScheme) (context.Context, error)
}

Auther defines the authorization functions to be implemented by the service.

type CaptureEventPayload

type CaptureEventPayload struct {
	ApikeyToken       *string
	SessionToken      *string
	ProjectSlugInput  *string
	ChatSessionsToken *string
	// Event name
	Event string
	// Distinct ID for the user or entity (defaults to organization ID if not
	// provided)
	DistinctID *string
	// Event properties as key-value pairs
	Properties map[string]any
}

CaptureEventPayload is the payload type of the telemetry service captureEvent method.

type CaptureEventResult

type CaptureEventResult struct {
	// Whether the event was successfully captured
	Success bool
}

CaptureEventResult is the result type of the telemetry service captureEvent method.

type ChatSummary

type ChatSummary struct {
	// Chat session ID
	GramChatID string
	// Earliest log timestamp in Unix nanoseconds (string for JS int64 precision)
	StartTimeUnixNano string
	// Latest log timestamp in Unix nanoseconds (string for JS int64 precision)
	EndTimeUnixNano string
	// Total number of logs in this chat session
	LogCount uint64
	// Number of tool calls in this chat session
	ToolCallCount uint64
	// Number of LLM completion messages in this chat session
	MessageCount uint64
	// Chat session duration in seconds
	DurationSeconds float64
	// Chat session status
	Status string
	// User ID associated with this chat session
	UserID *string
	// LLM model used in this chat session
	Model *string
	// Total input tokens used
	TotalInputTokens int64
	// Total output tokens used
	TotalOutputTokens int64
	// Total tokens used (input + output)
	TotalTokens int64
}

Summary information for a chat session

type Client

type Client struct {
	SearchLogsEndpoint               goa.Endpoint
	SearchToolCallsEndpoint          goa.Endpoint
	SearchChatsEndpoint              goa.Endpoint
	SearchUsersEndpoint              goa.Endpoint
	CaptureEventEndpoint             goa.Endpoint
	GetProjectMetricsSummaryEndpoint goa.Endpoint
	GetUserMetricsSummaryEndpoint    goa.Endpoint
	GetObservabilityOverviewEndpoint goa.Endpoint
	GetProjectOverviewEndpoint       goa.Endpoint
	ListFilterOptionsEndpoint        goa.Endpoint
	ListAttributeKeysEndpoint        goa.Endpoint
	GetHooksSummaryEndpoint          goa.Endpoint
	ListHooksTracesEndpoint          goa.Endpoint
}

Client is the "telemetry" service client.

func NewClient

func NewClient(searchLogs, searchToolCalls, searchChats, searchUsers, captureEvent, getProjectMetricsSummary, getUserMetricsSummary, getObservabilityOverview, getProjectOverview, listFilterOptions, listAttributeKeys, getHooksSummary, listHooksTraces goa.Endpoint) *Client

NewClient initializes a "telemetry" service client given the endpoints.

func (*Client) CaptureEvent

func (c *Client) CaptureEvent(ctx context.Context, p *CaptureEventPayload) (res *CaptureEventResult, err error)

CaptureEvent calls the "captureEvent" endpoint of the "telemetry" service. CaptureEvent may return the following errors:

  • "unauthorized" (type *goa.ServiceError): unauthorized access
  • "forbidden" (type *goa.ServiceError): permission denied
  • "bad_request" (type *goa.ServiceError): request is invalid
  • "not_found" (type *goa.ServiceError): resource not found
  • "conflict" (type *goa.ServiceError): resource already exists
  • "unsupported_media" (type *goa.ServiceError): unsupported media type
  • "invalid" (type *goa.ServiceError): request contains one or more invalidation fields
  • "invariant_violation" (type *goa.ServiceError): an unexpected error occurred
  • "unexpected" (type *goa.ServiceError): an unexpected error occurred
  • "gateway_error" (type *goa.ServiceError): an unexpected error occurred
  • error: internal error

func (*Client) GetHooksSummary

func (c *Client) GetHooksSummary(ctx context.Context, p *GetHooksSummaryPayload) (res *GetHooksSummaryResult, err error)

GetHooksSummary calls the "getHooksSummary" endpoint of the "telemetry" service. GetHooksSummary may return the following errors:

  • "unauthorized" (type *goa.ServiceError): unauthorized access
  • "forbidden" (type *goa.ServiceError): permission denied
  • "bad_request" (type *goa.ServiceError): request is invalid
  • "not_found" (type *goa.ServiceError): resource not found
  • "conflict" (type *goa.ServiceError): resource already exists
  • "unsupported_media" (type *goa.ServiceError): unsupported media type
  • "invalid" (type *goa.ServiceError): request contains one or more invalidation fields
  • "invariant_violation" (type *goa.ServiceError): an unexpected error occurred
  • "unexpected" (type *goa.ServiceError): an unexpected error occurred
  • "gateway_error" (type *goa.ServiceError): an unexpected error occurred
  • error: internal error

func (*Client) GetObservabilityOverview

func (c *Client) GetObservabilityOverview(ctx context.Context, p *GetObservabilityOverviewPayload) (res *GetObservabilityOverviewResult, err error)

GetObservabilityOverview calls the "getObservabilityOverview" endpoint of the "telemetry" service. GetObservabilityOverview may return the following errors:

  • "unauthorized" (type *goa.ServiceError): unauthorized access
  • "forbidden" (type *goa.ServiceError): permission denied
  • "bad_request" (type *goa.ServiceError): request is invalid
  • "not_found" (type *goa.ServiceError): resource not found
  • "conflict" (type *goa.ServiceError): resource already exists
  • "unsupported_media" (type *goa.ServiceError): unsupported media type
  • "invalid" (type *goa.ServiceError): request contains one or more invalidation fields
  • "invariant_violation" (type *goa.ServiceError): an unexpected error occurred
  • "unexpected" (type *goa.ServiceError): an unexpected error occurred
  • "gateway_error" (type *goa.ServiceError): an unexpected error occurred
  • error: internal error

func (*Client) GetProjectMetricsSummary

func (c *Client) GetProjectMetricsSummary(ctx context.Context, p *GetProjectMetricsSummaryPayload) (res *GetMetricsSummaryResult, err error)

GetProjectMetricsSummary calls the "getProjectMetricsSummary" endpoint of the "telemetry" service. GetProjectMetricsSummary may return the following errors:

  • "unauthorized" (type *goa.ServiceError): unauthorized access
  • "forbidden" (type *goa.ServiceError): permission denied
  • "bad_request" (type *goa.ServiceError): request is invalid
  • "not_found" (type *goa.ServiceError): resource not found
  • "conflict" (type *goa.ServiceError): resource already exists
  • "unsupported_media" (type *goa.ServiceError): unsupported media type
  • "invalid" (type *goa.ServiceError): request contains one or more invalidation fields
  • "invariant_violation" (type *goa.ServiceError): an unexpected error occurred
  • "unexpected" (type *goa.ServiceError): an unexpected error occurred
  • "gateway_error" (type *goa.ServiceError): an unexpected error occurred
  • error: internal error

func (*Client) GetProjectOverview

func (c *Client) GetProjectOverview(ctx context.Context, p *GetProjectOverviewPayload) (res *GetProjectOverviewResult, err error)

GetProjectOverview calls the "getProjectOverview" endpoint of the "telemetry" service. GetProjectOverview may return the following errors:

  • "unauthorized" (type *goa.ServiceError): unauthorized access
  • "forbidden" (type *goa.ServiceError): permission denied
  • "bad_request" (type *goa.ServiceError): request is invalid
  • "not_found" (type *goa.ServiceError): resource not found
  • "conflict" (type *goa.ServiceError): resource already exists
  • "unsupported_media" (type *goa.ServiceError): unsupported media type
  • "invalid" (type *goa.ServiceError): request contains one or more invalidation fields
  • "invariant_violation" (type *goa.ServiceError): an unexpected error occurred
  • "unexpected" (type *goa.ServiceError): an unexpected error occurred
  • "gateway_error" (type *goa.ServiceError): an unexpected error occurred
  • error: internal error

func (*Client) GetUserMetricsSummary

func (c *Client) GetUserMetricsSummary(ctx context.Context, p *GetUserMetricsSummaryPayload) (res *GetUserMetricsSummaryResult, err error)

GetUserMetricsSummary calls the "getUserMetricsSummary" endpoint of the "telemetry" service. GetUserMetricsSummary may return the following errors:

  • "unauthorized" (type *goa.ServiceError): unauthorized access
  • "forbidden" (type *goa.ServiceError): permission denied
  • "bad_request" (type *goa.ServiceError): request is invalid
  • "not_found" (type *goa.ServiceError): resource not found
  • "conflict" (type *goa.ServiceError): resource already exists
  • "unsupported_media" (type *goa.ServiceError): unsupported media type
  • "invalid" (type *goa.ServiceError): request contains one or more invalidation fields
  • "invariant_violation" (type *goa.ServiceError): an unexpected error occurred
  • "unexpected" (type *goa.ServiceError): an unexpected error occurred
  • "gateway_error" (type *goa.ServiceError): an unexpected error occurred
  • error: internal error

func (*Client) ListAttributeKeys

func (c *Client) ListAttributeKeys(ctx context.Context, p *ListAttributeKeysPayload) (res *ListAttributeKeysResult, err error)

ListAttributeKeys calls the "listAttributeKeys" endpoint of the "telemetry" service. ListAttributeKeys may return the following errors:

  • "unauthorized" (type *goa.ServiceError): unauthorized access
  • "forbidden" (type *goa.ServiceError): permission denied
  • "bad_request" (type *goa.ServiceError): request is invalid
  • "not_found" (type *goa.ServiceError): resource not found
  • "conflict" (type *goa.ServiceError): resource already exists
  • "unsupported_media" (type *goa.ServiceError): unsupported media type
  • "invalid" (type *goa.ServiceError): request contains one or more invalidation fields
  • "invariant_violation" (type *goa.ServiceError): an unexpected error occurred
  • "unexpected" (type *goa.ServiceError): an unexpected error occurred
  • "gateway_error" (type *goa.ServiceError): an unexpected error occurred
  • error: internal error

func (*Client) ListFilterOptions

func (c *Client) ListFilterOptions(ctx context.Context, p *ListFilterOptionsPayload) (res *ListFilterOptionsResult, err error)

ListFilterOptions calls the "listFilterOptions" endpoint of the "telemetry" service. ListFilterOptions may return the following errors:

  • "unauthorized" (type *goa.ServiceError): unauthorized access
  • "forbidden" (type *goa.ServiceError): permission denied
  • "bad_request" (type *goa.ServiceError): request is invalid
  • "not_found" (type *goa.ServiceError): resource not found
  • "conflict" (type *goa.ServiceError): resource already exists
  • "unsupported_media" (type *goa.ServiceError): unsupported media type
  • "invalid" (type *goa.ServiceError): request contains one or more invalidation fields
  • "invariant_violation" (type *goa.ServiceError): an unexpected error occurred
  • "unexpected" (type *goa.ServiceError): an unexpected error occurred
  • "gateway_error" (type *goa.ServiceError): an unexpected error occurred
  • error: internal error

func (*Client) ListHooksTraces

func (c *Client) ListHooksTraces(ctx context.Context, p *ListHooksTracesPayload) (res *ListHooksTracesResult, err error)

ListHooksTraces calls the "listHooksTraces" endpoint of the "telemetry" service. ListHooksTraces may return the following errors:

  • "unauthorized" (type *goa.ServiceError): unauthorized access
  • "forbidden" (type *goa.ServiceError): permission denied
  • "bad_request" (type *goa.ServiceError): request is invalid
  • "not_found" (type *goa.ServiceError): resource not found
  • "conflict" (type *goa.ServiceError): resource already exists
  • "unsupported_media" (type *goa.ServiceError): unsupported media type
  • "invalid" (type *goa.ServiceError): request contains one or more invalidation fields
  • "invariant_violation" (type *goa.ServiceError): an unexpected error occurred
  • "unexpected" (type *goa.ServiceError): an unexpected error occurred
  • "gateway_error" (type *goa.ServiceError): an unexpected error occurred
  • error: internal error

func (*Client) SearchChats

func (c *Client) SearchChats(ctx context.Context, p *SearchChatsPayload) (res *SearchChatsResult, err error)

SearchChats calls the "searchChats" endpoint of the "telemetry" service. SearchChats may return the following errors:

  • "unauthorized" (type *goa.ServiceError): unauthorized access
  • "forbidden" (type *goa.ServiceError): permission denied
  • "bad_request" (type *goa.ServiceError): request is invalid
  • "not_found" (type *goa.ServiceError): resource not found
  • "conflict" (type *goa.ServiceError): resource already exists
  • "unsupported_media" (type *goa.ServiceError): unsupported media type
  • "invalid" (type *goa.ServiceError): request contains one or more invalidation fields
  • "invariant_violation" (type *goa.ServiceError): an unexpected error occurred
  • "unexpected" (type *goa.ServiceError): an unexpected error occurred
  • "gateway_error" (type *goa.ServiceError): an unexpected error occurred
  • error: internal error

func (*Client) SearchLogs

func (c *Client) SearchLogs(ctx context.Context, p *SearchLogsPayload) (res *SearchLogsResult, err error)

SearchLogs calls the "searchLogs" endpoint of the "telemetry" service. SearchLogs may return the following errors:

  • "unauthorized" (type *goa.ServiceError): unauthorized access
  • "forbidden" (type *goa.ServiceError): permission denied
  • "bad_request" (type *goa.ServiceError): request is invalid
  • "not_found" (type *goa.ServiceError): resource not found
  • "conflict" (type *goa.ServiceError): resource already exists
  • "unsupported_media" (type *goa.ServiceError): unsupported media type
  • "invalid" (type *goa.ServiceError): request contains one or more invalidation fields
  • "invariant_violation" (type *goa.ServiceError): an unexpected error occurred
  • "unexpected" (type *goa.ServiceError): an unexpected error occurred
  • "gateway_error" (type *goa.ServiceError): an unexpected error occurred
  • error: internal error

func (*Client) SearchToolCalls

func (c *Client) SearchToolCalls(ctx context.Context, p *SearchToolCallsPayload) (res *SearchToolCallsResult, err error)

SearchToolCalls calls the "searchToolCalls" endpoint of the "telemetry" service. SearchToolCalls may return the following errors:

  • "unauthorized" (type *goa.ServiceError): unauthorized access
  • "forbidden" (type *goa.ServiceError): permission denied
  • "bad_request" (type *goa.ServiceError): request is invalid
  • "not_found" (type *goa.ServiceError): resource not found
  • "conflict" (type *goa.ServiceError): resource already exists
  • "unsupported_media" (type *goa.ServiceError): unsupported media type
  • "invalid" (type *goa.ServiceError): request contains one or more invalidation fields
  • "invariant_violation" (type *goa.ServiceError): an unexpected error occurred
  • "unexpected" (type *goa.ServiceError): an unexpected error occurred
  • "gateway_error" (type *goa.ServiceError): an unexpected error occurred
  • error: internal error

func (*Client) SearchUsers

func (c *Client) SearchUsers(ctx context.Context, p *SearchUsersPayload) (res *SearchUsersResult, err error)

SearchUsers calls the "searchUsers" endpoint of the "telemetry" service. SearchUsers may return the following errors:

  • "unauthorized" (type *goa.ServiceError): unauthorized access
  • "forbidden" (type *goa.ServiceError): permission denied
  • "bad_request" (type *goa.ServiceError): request is invalid
  • "not_found" (type *goa.ServiceError): resource not found
  • "conflict" (type *goa.ServiceError): resource already exists
  • "unsupported_media" (type *goa.ServiceError): unsupported media type
  • "invalid" (type *goa.ServiceError): request contains one or more invalidation fields
  • "invariant_violation" (type *goa.ServiceError): an unexpected error occurred
  • "unexpected" (type *goa.ServiceError): an unexpected error occurred
  • "gateway_error" (type *goa.ServiceError): an unexpected error occurred
  • error: internal error

type Endpoints

type Endpoints struct {
	SearchLogs               goa.Endpoint
	SearchToolCalls          goa.Endpoint
	SearchChats              goa.Endpoint
	SearchUsers              goa.Endpoint
	CaptureEvent             goa.Endpoint
	GetProjectMetricsSummary goa.Endpoint
	GetUserMetricsSummary    goa.Endpoint
	GetObservabilityOverview goa.Endpoint
	GetProjectOverview       goa.Endpoint
	ListFilterOptions        goa.Endpoint
	ListAttributeKeys        goa.Endpoint
	GetHooksSummary          goa.Endpoint
	ListHooksTraces          goa.Endpoint
}

Endpoints wraps the "telemetry" service endpoints.

func NewEndpoints

func NewEndpoints(s Service) *Endpoints

NewEndpoints wraps the methods of the "telemetry" service with endpoints.

func (*Endpoints) Use

func (e *Endpoints) Use(m func(goa.Endpoint) goa.Endpoint)

Use applies the given middleware to all the "telemetry" service endpoints.

type FilterOption

type FilterOption struct {
	// Unique identifier for the option
	ID string
	// Display label for the option
	Label string
	// Number of events for this option
	Count int64
}

A single filter option (API key or user)

type GetHooksSummaryPayload

type GetHooksSummaryPayload struct {
	ApikeyToken      *string
	SessionToken     *string
	ProjectSlugInput *string
	// Start time in ISO 8601 format
	From string
	// End time in ISO 8601 format
	To string
	// Filter conditions (same as listHooksTraces)
	Filters []*LogFilter
	// Hook types to include (mcp, local, skill). If empty, includes all types.
	TypesToInclude []string
}

GetHooksSummaryPayload is the payload type of the telemetry service getHooksSummary method.

type GetHooksSummaryResult

type GetHooksSummaryResult struct {
	// Aggregated metrics grouped by server
	Servers []*HooksServerSummary
	// Aggregated metrics grouped by user
	Users []*HooksUserSummary
	// Aggregated metrics grouped by skill
	Skills []*SkillSummary
	// Total number of hook events
	TotalEvents int64
	// Total number of unique sessions
	TotalSessions int64
	// Cross-dimensional pivot: (user, server, source, tool) x counts
	Breakdown []*HooksBreakdownRow
	// Time-bucketed event counts by server and user
	TimeSeries []*HooksTimeSeriesPoint
	// Time-bucketed event counts by skill
	SkillTimeSeries []*SkillTimeSeriesPoint
	// Per-user skill breakdown
	SkillBreakdown []*SkillBreakdownRow
}

GetHooksSummaryResult is the result type of the telemetry service getHooksSummary method.

type GetMetricsSummaryResult

type GetMetricsSummaryResult struct {
	// Aggregated metrics
	Metrics *ProjectSummary
}

GetMetricsSummaryResult is the result type of the telemetry service getProjectMetricsSummary method.

type GetObservabilityOverviewPayload

type GetObservabilityOverviewPayload struct {
	ApikeyToken      *string
	SessionToken     *string
	ProjectSlugInput *string
	// Start time in ISO 8601 format
	From string
	// End time in ISO 8601 format
	To string
	// Optional internal user ID filter
	UserID *string
	// Optional external user ID filter
	ExternalUserID *string
	// Optional API key ID filter
	APIKeyID *string
	// Optional toolset/MCP server slug filter
	ToolsetSlug *string
	// Optional event source filter (e.g. 'hook')
	EventSource *string
	// Optional hook source filter (e.g. 'cursor', 'claude-code')
	HookSource *string
	// Whether to include time series data (default: true)
	IncludeTimeSeries bool
}

GetObservabilityOverviewPayload is the payload type of the telemetry service getObservabilityOverview method.

type GetObservabilityOverviewResult

type GetObservabilityOverviewResult struct {
	// Current period summary metrics
	Summary *ObservabilitySummary
	// Previous period summary metrics for trend calculation
	Comparison *ObservabilitySummary
	// Time series data points
	TimeSeries []*TimeSeriesBucket
	// Top tools by call count
	TopToolsByCount []*ToolMetric
	// Top tools by failure rate
	TopToolsByFailureRate []*ToolMetric
	// The time bucket interval in seconds used for the time series data
	IntervalSeconds int64
}

GetObservabilityOverviewResult is the result type of the telemetry service getObservabilityOverview method.

type GetProjectMetricsSummaryPayload

type GetProjectMetricsSummaryPayload struct {
	ApikeyToken      *string
	SessionToken     *string
	ProjectSlugInput *string
	// Start time in ISO 8601 format
	From string
	// End time in ISO 8601 format
	To string
}

GetProjectMetricsSummaryPayload is the payload type of the telemetry service getProjectMetricsSummary method.

type GetProjectOverviewPayload

type GetProjectOverviewPayload struct {
	ApikeyToken      *string
	SessionToken     *string
	ProjectSlugInput *string
	// Start time in ISO 8601 format
	From string
	// End time in ISO 8601 format
	To string
}

GetProjectOverviewPayload is the payload type of the telemetry service getProjectOverview method.

type GetProjectOverviewResult

type GetProjectOverviewResult struct {
	// Current period summary metrics
	Summary *ProjectOverviewSummary
	// Previous period summary metrics for trend calculation
	Comparison *ProjectOverviewSummary
	// Indicates whether metrics are session-based or tool-call-based
	MetricsMode string
}

GetProjectOverviewResult is the result type of the telemetry service getProjectOverview method.

type GetUserMetricsSummaryPayload

type GetUserMetricsSummaryPayload struct {
	ApikeyToken      *string
	SessionToken     *string
	ProjectSlugInput *string
	// Start time in ISO 8601 format
	From string
	// End time in ISO 8601 format
	To string
	// User ID to get metrics for (mutually exclusive with external_user_id)
	UserID *string
	// External user ID to get metrics for (mutually exclusive with user_id)
	ExternalUserID *string
	// Optional event source filter (e.g. 'hook')
	EventSource *string
	// Optional hook source filter (e.g. 'cursor', 'claude-code')
	HookSource *string
}

GetUserMetricsSummaryPayload is the payload type of the telemetry service getUserMetricsSummary method.

type GetUserMetricsSummaryResult

type GetUserMetricsSummaryResult struct {
	// Aggregated metrics for the user
	Metrics *ProjectSummary
}

GetUserMetricsSummaryResult is the result type of the telemetry service getUserMetricsSummary method.

type HookSourceUsage

type HookSourceUsage struct {
	// Hook source (from attributes.gram.hook.source)
	Source string
	// Total hook events for this source
	EventCount int64
}

Hook source usage statistics

type HookTraceSummary

type HookTraceSummary struct {
	// Trace ID (32 hex characters)
	TraceID string
	// Earliest log timestamp in Unix nanoseconds (string for JS int64 precision)
	StartTimeUnixNano string
	// Total number of logs in this trace
	LogCount uint64
	// Hook execution status
	HookStatus *string
	// Reason set when hook_status is 'blocked' (e.g. shadow-MCP guard rejection)
	BlockReason *string
	// Gram URN associated with this hook trace
	GramUrn string
	// Tool name (from materialized column)
	ToolName *string
	// Tool call source (from materialized column)
	ToolSource *string
	// Event source (from materialized column)
	EventSource *string
	// User email (from attributes.user.email)
	UserEmail *string
	// Hook source (from attributes.gram.hook.source)
	HookSource *string
	// Skill name (from materialized column, only for Skill tool)
	SkillName *string
}

Summary information for a hook trace

type HooksBreakdownRow

type HooksBreakdownRow struct {
	// User email address
	UserEmail string
	// Server name ('local' for non-MCP tools)
	ServerName string
	// Hook source (e.g. claude-desktop, cursor)
	HookSource string
	// Tool name
	ToolName string
	// Total events for this combination
	EventCount int64
	// Number of failures for this combination
	FailureCount int64
}

Cross-dimensional aggregation row: one entry per unique (user, server, hook_source, tool) combination

type HooksServerSummary

type HooksServerSummary struct {
	// Server name (extracted from tool name, or 'local' for non-MCP tools)
	ServerName string
	// Total number of hook events for this server
	EventCount int64
	// Number of unique tools used for this server
	UniqueTools int64
	// Number of successful tool completions (PostToolUse events)
	SuccessCount int64
	// Number of failed tool completions (PostToolUseFailure events)
	FailureCount int64
	// Failure rate as a decimal (0.0 to 1.0)
	FailureRate float64
}

Aggregated hooks metrics for a single server

type HooksTimeSeriesPoint

type HooksTimeSeriesPoint struct {
	// Bucket start time in Unix nanoseconds (string for JS int64 precision)
	BucketStartNs string
	// Server name
	ServerName string
	// User email address
	UserEmail string
	// Number of events in this bucket
	EventCount int64
	// Number of failed hook events in this bucket
	FailureCount int64
}

A single time-series bucket for hooks activity

type HooksUserSummary

type HooksUserSummary struct {
	// User email address
	UserEmail string
	// Total number of hook events for this user
	EventCount int64
	// Number of unique tools used by this user
	UniqueTools int64
	// Number of successful tool completions (PostToolUse events)
	SuccessCount int64
	// Number of failed tool completions (PostToolUseFailure events)
	FailureCount int64
	// Failure rate as a decimal (0.0 to 1.0)
	FailureRate float64
}

Aggregated hooks metrics for a single user

type LLMClientUsage

type LLMClientUsage struct {
	// Client/agent name (e.g., 'cursor', 'claude-code', 'cowork')
	ClientName string
	// Number of messages (session mode) or tool calls (tool_call mode)
	ActivityCount int64
}

Usage breakdown by LLM client/agent

type ListAttributeKeysPayload

type ListAttributeKeysPayload struct {
	ApikeyToken      *string
	SessionToken     *string
	ProjectSlugInput *string
	// Start time in ISO 8601 format
	From string
	// End time in ISO 8601 format
	To string
}

ListAttributeKeysPayload is the payload type of the telemetry service listAttributeKeys method.

type ListAttributeKeysResult

type ListAttributeKeysResult struct {
	// Distinct attribute keys. User attributes are prefixed with @
	Keys []string
}

ListAttributeKeysResult is the result type of the telemetry service listAttributeKeys method.

type ListFilterOptionsPayload

type ListFilterOptionsPayload struct {
	ApikeyToken      *string
	SessionToken     *string
	ProjectSlugInput *string
	// Start time in ISO 8601 format
	From string
	// End time in ISO 8601 format
	To string
	// Type of filter to list options for
	FilterType string
	// Optional event source filter for the option list
	EventSource *string
}

ListFilterOptionsPayload is the payload type of the telemetry service listFilterOptions method.

type ListFilterOptionsResult

type ListFilterOptionsResult struct {
	// List of filter options
	Options []*FilterOption
}

ListFilterOptionsResult is the result type of the telemetry service listFilterOptions method.

type ListHooksTracesPayload

type ListHooksTracesPayload struct {
	ApikeyToken      *string
	SessionToken     *string
	ProjectSlugInput *string
	// Start time in ISO 8601 format (e.g., '2025-12-19T10:00:00Z')
	From string
	// End time in ISO 8601 format (e.g., '2025-12-19T11:00:00Z')
	To string
	// Filter conditions for the search query
	Filters []*LogFilter
	// Hook types to include (mcp, local, skill). If empty or not provided,
	// includes all types.
	TypesToInclude []string
	// Cursor for pagination (trace_id)
	Cursor *string
	// Sort order
	Sort string
	// Number of items to return (1-1000)
	Limit int
}

ListHooksTracesPayload is the payload type of the telemetry service listHooksTraces method.

type ListHooksTracesResult

type ListHooksTracesResult struct {
	// List of hook trace summaries
	Traces []*HookTraceSummary
	// Cursor for next page
	NextCursor *string
}

ListHooksTracesResult is the result type of the telemetry service listHooksTraces method.

type LogFilter

type LogFilter struct {
	// Attribute path. Use @ prefix for custom attributes (e.g. '@user.region'), or
	// bare path for system attributes (e.g. 'http.route').
	Path string
	// Comparison operator
	Operator string
	// Values to compare against. Pass one value for single-value operators (eq,
	// not_eq, contains) and multiple for 'in'. Ignored for 'exists' and
	// 'not_exists'.
	Values []string
}

A single filter condition for a log search query.

type ModelUsage

type ModelUsage struct {
	// Model name
	Name string
	// Number of times used
	Count int64
}

Model usage statistics

type ObservabilitySummary

type ObservabilitySummary struct {
	// Total number of chat sessions
	TotalChats int64
	// Number of resolved chat sessions
	ResolvedChats int64
	// Number of failed chat sessions
	FailedChats int64
	// Average session duration in milliseconds
	AvgSessionDurationMs float64
	// Average time to resolution in milliseconds
	AvgResolutionTimeMs float64
	// Sum of input tokens used
	TotalInputTokens int64
	// Sum of output tokens used
	TotalOutputTokens int64
	// Sum of all tokens used
	TotalTokens int64
	// Sum of cache read input tokens
	CacheReadInputTokens int64
	// Sum of cache creation input tokens
	CacheCreationInputTokens int64
	// Total cost of all requests
	TotalCost float64
	// Total number of tool calls
	TotalToolCalls int64
	// Number of failed tool calls
	FailedToolCalls int64
	// Average tool latency in milliseconds
	AvgLatencyMs float64
}

Aggregated summary metrics for a time period

type ProjectOverviewSummary

type ProjectOverviewSummary struct {
	// Total number of chat sessions
	TotalChats int64
	// Number of resolved chat sessions
	ResolvedChats int64
	// Number of failed chat sessions
	FailedChats int64
	// Total number of tool calls
	TotalToolCalls int64
	// Number of failed tool calls
	FailedToolCalls int64
	// Number of MCP servers with at least one tool call in the time period
	ActiveServersCount int64
	// Number of unique users with activity in the time period
	ActiveUsersCount int64
	// Top 10 users by activity (# of messages or tool calls depending on
	// metrics_mode)
	TopUsers []*TopUser
	// Top 10 MCP servers by tool call count
	TopServers []*TopServer
	// Breakdown of messages/activity by LLM client/agent
	LlmClientBreakdown []*LLMClientUsage
}

Aggregated project-level summary metrics for a time period

type ProjectSummary

type ProjectSummary struct {
	// Earliest activity timestamp in Unix nanoseconds
	FirstSeenUnixNano string
	// Latest activity timestamp in Unix nanoseconds
	LastSeenUnixNano string
	// Sum of input tokens used
	TotalInputTokens int64
	// Sum of output tokens used
	TotalOutputTokens int64
	// Sum of all tokens used
	TotalTokens int64
	// Sum of cache read input tokens
	CacheReadInputTokens int64
	// Sum of cache creation input tokens
	CacheCreationInputTokens int64
	// Average tokens per chat request
	AvgTokensPerRequest float64
	// Total cost of all requests
	TotalCost float64
	// Total number of chat requests
	TotalChatRequests int64
	// Average chat request duration in milliseconds
	AvgChatDurationMs float64
	// Requests that completed naturally
	FinishReasonStop int64
	// Requests that resulted in tool calls
	FinishReasonToolCalls int64
	// Total number of tool calls
	TotalToolCalls int64
	// Successful tool calls (2xx status)
	ToolCallSuccess int64
	// Failed tool calls (4xx/5xx status)
	ToolCallFailure int64
	// Average tool call duration in milliseconds
	AvgToolDurationMs float64
	// Chats resolved successfully
	ChatResolutionSuccess int64
	// Chats that failed to resolve
	ChatResolutionFailure int64
	// Chats partially resolved
	ChatResolutionPartial int64
	// Chats abandoned by user
	ChatResolutionAbandoned int64
	// Average chat resolution score (0-100)
	AvgChatResolutionScore float64
	// Number of unique chat sessions (project scope only)
	TotalChats int64
	// Number of distinct models used (project scope only)
	DistinctModels int64
	// Number of distinct providers used (project scope only)
	DistinctProviders int64
	// List of models used with call counts
	Models []*ModelUsage
	// List of tools used with success/failure counts
	Tools []*ToolUsage
}

Aggregated metrics

type SearchChatsFilter

type SearchChatsFilter struct {
	// Start time in ISO 8601 format (e.g., '2025-12-19T10:00:00Z')
	From *string
	// End time in ISO 8601 format (e.g., '2025-12-19T11:00:00Z')
	To *string
	// Deployment ID filter
	DeploymentID *string
	// Gram URN filter (single URN, use gram_urns for multiple)
	GramUrn *string
	// User ID filter
	UserID *string
	// External user ID filter
	ExternalUserID *string
}

Filter criteria for searching chat sessions

type SearchChatsPayload

type SearchChatsPayload struct {
	ApikeyToken      *string
	SessionToken     *string
	ProjectSlugInput *string
	// Filter criteria for the search
	Filter *SearchChatsFilter
	// Cursor for pagination
	Cursor *string
	// Sort order
	Sort string
	// Number of items to return (1-1000)
	Limit int
}

SearchChatsPayload is the payload type of the telemetry service searchChats method.

type SearchChatsResult

type SearchChatsResult struct {
	// List of chat session summaries
	Chats []*ChatSummary
	// Cursor for next page
	NextCursor *string
}

SearchChatsResult is the result type of the telemetry service searchChats method.

type SearchLogsFilter

type SearchLogsFilter struct {
	// Trace ID filter (32 hex characters)
	TraceID *string
	// Severity level filter
	SeverityText *string
	// HTTP status code filter
	HTTPStatusCode *int32
	// HTTP route filter
	HTTPRoute *string
	// HTTP method filter
	HTTPMethod *string
	// Service name filter
	ServiceName *string
	// Gram URN filter (one or more URNs)
	GramUrns []string
	// Chat ID filter
	GramChatID *string
	// User ID filter
	UserID *string
	// External user ID filter
	ExternalUserID *string
	// Event source filter (e.g., 'hook', 'tool_call', 'chat_completion')
	EventSource *string
	// Start time in ISO 8601 format (e.g., '2025-12-19T10:00:00Z')
	From *string
	// End time in ISO 8601 format (e.g., '2025-12-19T11:00:00Z')
	To *string
	// Deployment ID filter
	DeploymentID *string
	// Function ID filter
	FunctionID *string
	// Gram URN filter (single URN, use gram_urns for multiple)
	GramUrn *string
}

Filter criteria for searching logs

type SearchLogsPayload

type SearchLogsPayload struct {
	ApikeyToken      *string
	SessionToken     *string
	ProjectSlugInput *string
	// Start time in ISO 8601 format (e.g., '2025-12-19T10:00:00Z')
	From *string
	// End time in ISO 8601 format (e.g., '2025-12-19T11:00:00Z')
	To *string
	// Filter conditions for the search query
	Filters []*LogFilter
	// [Deprecated] Use 'filters' and top-level 'from'/'to' instead.
	Filter *SearchLogsFilter
	// Cursor for pagination
	Cursor *string
	// Sort order
	Sort string
	// Number of items to return (1-1000)
	Limit int
}

SearchLogsPayload is the payload type of the telemetry service searchLogs method.

type SearchLogsResult

type SearchLogsResult struct {
	// List of telemetry log records
	Logs []*TelemetryLogRecord
	// Cursor for next page
	NextCursor *string
}

SearchLogsResult is the result type of the telemetry service searchLogs method.

type SearchToolCallsFilter

type SearchToolCallsFilter struct {
	// Event source filter (e.g., 'hook', 'tool_call', 'chat_completion')
	EventSource *string
	// Start time in ISO 8601 format (e.g., '2025-12-19T10:00:00Z')
	From *string
	// End time in ISO 8601 format (e.g., '2025-12-19T11:00:00Z')
	To *string
	// Deployment ID filter
	DeploymentID *string
	// Function ID filter
	FunctionID *string
	// Gram URN filter (single URN, use gram_urns for multiple)
	GramUrn *string
}

Filter criteria for searching tool calls

type SearchToolCallsPayload

type SearchToolCallsPayload struct {
	ApikeyToken      *string
	SessionToken     *string
	ProjectSlugInput *string
	// Filter criteria for the search
	Filter *SearchToolCallsFilter
	// Cursor for pagination
	Cursor *string
	// Sort order
	Sort string
	// Number of items to return (1-1000)
	Limit int
}

SearchToolCallsPayload is the payload type of the telemetry service searchToolCalls method.

type SearchToolCallsResult

type SearchToolCallsResult struct {
	// List of tool call summaries
	ToolCalls []*ToolCallSummary
	// Cursor for next page
	NextCursor *string
}

SearchToolCallsResult is the result type of the telemetry service searchToolCalls method.

type SearchUsersFilter

type SearchUsersFilter struct {
	// Start time in ISO 8601 format (e.g., '2025-12-19T10:00:00Z')
	From string
	// End time in ISO 8601 format (e.g., '2025-12-19T11:00:00Z')
	To string
	// Deployment ID filter
	DeploymentID *string
	// Optional list of user identifiers to include. Matches user_id for internal
	// searches and external_user_id for external searches.
	UserIds []string
	// Optional event source filter (e.g. 'hook'). When set, only rows with a
	// matching event_source are included.
	EventSource *string
	// Optional hook source filter (e.g. 'cursor', 'claude-code').
	HookSource *string
}

Filter criteria for searching user usage summaries

type SearchUsersPayload

type SearchUsersPayload struct {
	ApikeyToken      *string
	SessionToken     *string
	ProjectSlugInput *string
	// Filter criteria for the search
	Filter *SearchUsersFilter
	// Type of user identifier to group by
	UserType string
	// Cursor for pagination (user identifier from last item)
	Cursor *string
	// Sort order
	Sort string
	// Number of items to return (1-1000)
	Limit int
}

SearchUsersPayload is the payload type of the telemetry service searchUsers method.

type SearchUsersResult

type SearchUsersResult struct {
	// List of user usage summaries
	Users []*UserSummary
	// Cursor for next page
	NextCursor *string
}

SearchUsersResult is the result type of the telemetry service searchUsers method.

type Service

type Service interface {
	// Search and list telemetry logs that match a search filter
	SearchLogs(context.Context, *SearchLogsPayload) (res *SearchLogsResult, err error)
	// Search and list tool calls that match a search filter
	SearchToolCalls(context.Context, *SearchToolCallsPayload) (res *SearchToolCallsResult, err error)
	// Search and list chat session summaries that match a search filter
	SearchChats(context.Context, *SearchChatsPayload) (res *SearchChatsResult, err error)
	// Search and list user usage summaries grouped by user_id or external_user_id
	SearchUsers(context.Context, *SearchUsersPayload) (res *SearchUsersResult, err error)
	// Capture a telemetry event and forward it to PostHog
	CaptureEvent(context.Context, *CaptureEventPayload) (res *CaptureEventResult, err error)
	// Get aggregated metrics summary for an entire project
	GetProjectMetricsSummary(context.Context, *GetProjectMetricsSummaryPayload) (res *GetMetricsSummaryResult, err error)
	// Get aggregated metrics summary grouped by user
	GetUserMetricsSummary(context.Context, *GetUserMetricsSummaryPayload) (res *GetUserMetricsSummaryResult, err error)
	// Get observability overview metrics including time series, tool breakdowns,
	// and summary stats
	GetObservabilityOverview(context.Context, *GetObservabilityOverviewPayload) (res *GetObservabilityOverviewResult, err error)
	// Get project-level overview including total chats, tool calls, active
	// servers/users, and top lists
	GetProjectOverview(context.Context, *GetProjectOverviewPayload) (res *GetProjectOverviewResult, err error)
	// List available filter options (API keys or users) for the observability
	// overview
	ListFilterOptions(context.Context, *ListFilterOptionsPayload) (res *ListFilterOptionsResult, err error)
	// List distinct attribute keys available for filtering
	ListAttributeKeys(context.Context, *ListAttributeKeysPayload) (res *ListAttributeKeysResult, err error)
	// Get aggregated hooks metrics grouped by server
	GetHooksSummary(context.Context, *GetHooksSummaryPayload) (res *GetHooksSummaryResult, err error)
	// List hook traces aggregated by trace_id with user information
	ListHooksTraces(context.Context, *ListHooksTracesPayload) (res *ListHooksTracesResult, err error)
}

Fetch telemetry data for tools in Gram.

type ServiceInfo

type ServiceInfo struct {
	// Service name
	Name string
	// Service version
	Version *string
}

Service information

type SkillBreakdownRow

type SkillBreakdownRow struct {
	// Skill name
	SkillName string
	// User email address
	UserEmail string
	// Use count for this skill/user combination
	UseCount int64
}

Per-(skill, user) aggregated counts

type SkillSummary

type SkillSummary struct {
	// Skill name (extracted from tool name)
	SkillName string
	// Total number of times this skill was used
	UseCount int64
	// Number of unique users who used this skill
	UniqueUsers int64
}

Aggregated skills metrics for a single skill

type SkillTimeSeriesPoint

type SkillTimeSeriesPoint struct {
	// Bucket start time in Unix nanoseconds (string for JS int64 precision)
	BucketStartNs string
	// Skill name
	SkillName string
	// Number of skill use events in this bucket
	EventCount int64
}

A single time-series bucket for skill usage activity

type TelemetryLogRecord

type TelemetryLogRecord struct {
	// Log record ID
	ID string
	// Unix time in nanoseconds when event occurred (string for JS int64 precision)
	TimeUnixNano string
	// Unix time in nanoseconds when event was observed (string for JS int64
	// precision)
	ObservedTimeUnixNano string
	// Text representation of severity
	SeverityText *string
	// The primary log message
	Body string
	// W3C trace ID (32 hex characters)
	TraceID *string
	// W3C span ID (16 hex characters)
	SpanID *string
	// Log attributes as JSON object
	Attributes any
	// Resource attributes as JSON object
	ResourceAttributes any
	// Service information
	Service *ServiceInfo
}

OpenTelemetry log record

type TimeSeriesBucket

type TimeSeriesBucket struct {
	// Bucket start time in Unix nanoseconds (string for JS precision)
	BucketTimeUnixNano string
	// Total chat sessions in this bucket
	TotalChats int64
	// Resolved chat sessions in this bucket
	ResolvedChats int64
	// Failed chat sessions in this bucket
	FailedChats int64
	// Partially resolved chat sessions in this bucket
	PartialChats int64
	// Abandoned chat sessions in this bucket
	AbandonedChats int64
	// Sum of input tokens in this bucket
	TotalInputTokens int64
	// Sum of output tokens in this bucket
	TotalOutputTokens int64
	// Sum of all tokens in this bucket
	TotalTokens int64
	// Sum of cache read input tokens in this bucket
	CacheReadInputTokens int64
	// Sum of cache creation input tokens in this bucket
	CacheCreationInputTokens int64
	// Total cost in this bucket
	TotalCost float64
	// Total tool calls in this bucket
	TotalToolCalls int64
	// Failed tool calls in this bucket
	FailedToolCalls int64
	// Average tool latency in milliseconds
	AvgToolLatencyMs float64
	// Average session duration in milliseconds
	AvgSessionDurationMs float64
}

A single time bucket for time series metrics

type ToolCallSummary

type ToolCallSummary struct {
	// Trace ID (32 hex characters)
	TraceID string
	// Earliest log timestamp in Unix nanoseconds (string for JS int64 precision)
	StartTimeUnixNano string
	// Total number of logs in this tool call
	LogCount uint64
	// HTTP status code (if applicable)
	HTTPStatusCode *int32
	// Gram URN associated with this tool call
	GramUrn string
	// Tool name (from attributes.gram.tool.name)
	ToolName *string
	// Tool call source (from attributes.gram.tool_call.source)
	ToolSource *string
	// Event source (from attributes.gram.event.source)
	EventSource *string
}

Summary information for a tool call

type ToolMetric

type ToolMetric struct {
	// Tool URN
	GramUrn string
	// Total number of calls
	CallCount int64
	// Number of successful calls
	SuccessCount int64
	// Number of failed calls
	FailureCount int64
	// Average latency in milliseconds
	AvgLatencyMs float64
	// Failure rate (0.0 to 1.0)
	FailureRate float64
}

Aggregated metrics for a single tool

type ToolUsage

type ToolUsage struct {
	// Tool URN
	Urn string
	// Total call count
	Count int64
	// Successful calls (2xx status)
	SuccessCount int64
	// Failed calls (4xx/5xx status)
	FailureCount int64
}

Tool usage statistics

type TopServer

type TopServer struct {
	// MCP server name
	ServerName string
	// Total number of tool calls
	ToolCallCount int64
}

Top MCP server by tool call count

type TopUser

type TopUser struct {
	// User ID (internal or external depending on availability)
	UserID string
	// Type of user ID
	UserType string
	// Number of messages (session mode) or tool calls (tool_call mode)
	ActivityCount int64
}

Top user by activity

type UserSummary

type UserSummary struct {
	// User identifier (user_id or external_user_id depending on group_by)
	UserID string
	// Earliest activity timestamp in Unix nanoseconds
	FirstSeenUnixNano string
	// Latest activity timestamp in Unix nanoseconds
	LastSeenUnixNano string
	// Number of unique chat sessions
	TotalChats int64
	// Total number of chat completion requests
	TotalChatRequests int64
	// Sum of input tokens used
	TotalInputTokens int64
	// Sum of output tokens used
	TotalOutputTokens int64
	// Sum of all tokens used
	TotalTokens int64
	// Sum of cache read input tokens
	CacheReadInputTokens int64
	// Sum of cache creation input tokens
	CacheCreationInputTokens int64
	// Average tokens per chat request
	AvgTokensPerRequest float64
	// Total cost of all requests
	TotalCost float64
	// Total number of tool calls
	TotalToolCalls int64
	// Successful tool calls (2xx status)
	ToolCallSuccess int64
	// Failed tool calls (4xx/5xx status)
	ToolCallFailure int64
	// Per-tool usage breakdown
	Tools []*ToolUsage
	// Per-hook-source usage breakdown
	HookSources []*HookSourceUsage
}

Aggregated usage summary for a single user

Jump to

Keyboard shortcuts

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