MCPcopy Create free account
hub / github.com/coder/coder / GetTemplateInsights

Method GetTemplateInsights

coderd/database/querier.go:711–711  ·  view source on GitHub ↗

GetTemplateInsights returns the aggregate user-produced usage of all workspaces in a given timeframe. The template IDs, active users, and usage_seconds all reflect any usage in the template, including apps. When combining data from multiple templates, we must make a guess at how the user behaved fo

(ctx context.Context, arg GetTemplateInsightsParams)

Source from the content-addressed store, hash-verified

709 // they did so sequentially, thus we sum the usage up to a maximum of
710 // 30 minutes with LEAST(SUM(n), 30).
711 GetTemplateInsights(ctx context.Context, arg GetTemplateInsightsParams) (GetTemplateInsightsRow, error)
712 // GetTemplateInsightsByInterval returns all intervals between start and end
713 // time, if end time is a partial interval, it will be included in the results and
714 // that interval will be shorter than a full one. If there is no data for a selected

Callers 4

insightsTemplatesMethod · 0.65
GetTemplateInsightsMethod · 0.65
GetTemplateInsightsMethod · 0.65
TestTemplateMethod · 0.65

Implementers 5

sqlQueriercoderd/database/db.go
queryMetricsStorecoderd/database/dbmetrics/querymetrics
queriercoderd/database/dbauthz/dbauthz.go
MockStorecoderd/database/dbmock/dbmock.go
MockStoreMockRecordercoderd/database/dbmock/dbmock.go

Calls

no outgoing calls

Tested by 1

TestTemplateMethod · 0.52