telemetry
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Index¶
- Constants
- func ShouldReportTelemetryDisabled(recordedTelemetryEnabled *bool, telemetryEnabled bool) bool
- type APIKey
- type DERPMap
- type DERPMapHomeParams
- type DERPNode
- type DERPRegion
- type Deployment
- type ExternalProvisioner
- type Group
- type GroupMember
- type License
- type ModuleSourceType
- type Netcheck
- type NetcheckIP
- type NetworkEvent
- type NetworkEventIPFields
- type NetworkEventP2PEndpoint
- type Options
- type Organization
- type ProvisionerJob
- type Reporter
- type Snapshot
- type TelemetryItem
- type Template
- type TemplateVersion
- type User
- type UserTailnetConnection
- type Workspace
- type WorkspaceAgent
- type WorkspaceAgentMemoryResourceMonitor
- type WorkspaceAgentStat
- type WorkspaceAgentVolumeResourceMonitor
- type WorkspaceApp
- type WorkspaceBuild
- type WorkspaceModule
- type WorkspaceProxy
- type WorkspaceResource
- type WorkspaceResourceMetadata
Constants¶
const (TelemetryItemKeyHTMLFirstServedAt telemetryItemKey = "html_first_served_at"TelemetryItemKeyTelemetryEnabled telemetryItemKey = "telemetry_enabled")
The comment below gets rid of the warning that the name "TelemetryItemKey" hasthe "Telemetry" prefix, and that stutters when you use it outside the package(telemetry.TelemetryItemKey...). "TelemetryItem" is the name of a database table,so it makes sense to use the "Telemetry" prefix.
const (// VersionHeader is sent in every telemetry request to// report the semantic version of Coder.VersionHeader = "X-Coder-Version")
Variables¶
This section is empty.
Functions¶
funcShouldReportTelemetryDisabled¶added inv2.19.0
See the corresponding test in telemetry_test.go for a truth table.
Types¶
typeAPIKey¶
type APIKey struct {IDstring `json:"id"`UserIDuuid.UUID `json:"user_id"`CreatedAttime.Time `json:"created_at"`LastUsedtime.Time `json:"last_used"`LoginTypedatabase.LoginType `json:"login_type"`IPAddressnet.IP `json:"ip_address"`}
funcConvertAPIKey¶
ConvertAPIKey anonymizes an API key.
typeDERPMap¶added inv2.14.0
type DERPMap struct {HomeParamsDERPMapHomeParams `json:"home_params"`Regions map[int64]DERPRegion}
typeDERPMapHomeParams¶added inv2.14.0
typeDERPNode¶added inv2.14.0
type DERPNode struct {Namestring `json:"name"`RegionIDint64 `json:"region_id"`HostNamestring `json:"host_name"`CertNamestring `json:"cert_name"`IPv4string `json:"ipv4"`IPv6string `json:"ipv6"`STUNPortint32 `json:"stun_port"`STUNOnlybool `json:"stun_only"`DERPPortint32 `json:"derp_port"`InsecureForTestsbool `json:"insecure_for_tests"`ForceHTTPbool `json:"force_http"`STUNTestIPstring `json:"stun_test_ip"`CanPort80bool `json:"can_port_80"`}
typeDERPRegion¶added inv2.14.0
typeDeployment¶
type Deployment struct {IDstring `json:"id"`Architecturestring `json:"architecture"`BuiltinPostgresbool `json:"builtin_postgres"`Containerizedbool `json:"containerized"`Kubernetesbool `json:"kubernetes"`Config *codersdk.DeploymentValues `json:"config"`Tunnelbool `json:"tunnel"`InstallSourcestring `json:"install_source"`OSTypestring `json:"os_type"`OSFamilystring `json:"os_family"`OSPlatformstring `json:"os_platform"`OSNamestring `json:"os_name"`OSVersionstring `json:"os_version"`CPUCoresint `json:"cpu_cores"`MemoryTotaluint64 `json:"memory_total"`MachineIDstring `json:"machine_id"`StartedAttime.Time `json:"started_at"`ShutdownAt *time.Time `json:"shutdown_at"`// While IDPOrgSync will always be set, it's nullable to make// the struct backwards compatible with older coder versions.IDPOrgSync *bool `json:"idp_org_sync"`}
Deployment contains information about the host running Coder.
typeExternalProvisioner¶added inv2.3.2
type ExternalProvisioner struct {IDstring `json:"id"`Tags map[string]string `json:"tags"`Provisioners []string `json:"provisioners"`StartedAttime.Time `json:"started_at"`ShutdownAt *time.Time `json:"shutdown_at"`}
funcConvertExternalProvisioner¶added inv2.3.2
func ConvertExternalProvisioner(iduuid.UUID, tags map[string]string, provisioners []database.ProvisionerType)ExternalProvisioner
typeGroup¶added inv2.13.0
type Group struct {IDuuid.UUID `json:"id"`Namestring `json:"name"`OrganizationIDuuid.UUID `json:"organization_id"`AvatarURLstring `json:"avatar_url"`QuotaAllowanceint32 `json:"quota_allowance"`DisplayNamestring `json:"display_name"`Sourcedatabase.GroupSource `json:"source"`}
funcConvertGroup¶added inv2.13.0
typeGroupMember¶added inv2.13.0
funcConvertGroupMember¶added inv2.13.0
func ConvertGroupMember(memberdatabase.GroupMember)GroupMember
typeLicense¶
type License struct {JWTstring `json:"jwt"`UploadedAttime.Time `json:"uploaded_at"`Exptime.Time `json:"exp"`UUIDuuid.UUID `json:"uuid"`// These two fields are set by decoding the JWT. If the signing keys aren't// passed in, these will always be nil.Email *string `json:"email"`Trial *bool `json:"trial"`}
funcConvertLicense¶
typeModuleSourceType¶added inv2.18.0
type ModuleSourceTypestring
ModuleSourceType is the type of source for a module.For reference, seehttps://developer.hashicorp.com/terraform/language/modules/sources
const (ModuleSourceTypeLocalModuleSourceType = "local"ModuleSourceTypeLocalAbsModuleSourceType = "local_absolute"ModuleSourceTypePublicRegistryModuleSourceType = "public_registry"ModuleSourceTypePrivateRegistryModuleSourceType = "private_registry"ModuleSourceTypeCoderRegistryModuleSourceType = "coder_registry"ModuleSourceTypeGitHubModuleSourceType = "github"ModuleSourceTypeBitbucketModuleSourceType = "bitbucket"ModuleSourceTypeGitModuleSourceType = "git"ModuleSourceTypeMercurialModuleSourceType = "mercurial"ModuleSourceTypeHTTPModuleSourceType = "http"ModuleSourceTypeS3ModuleSourceType = "s3"ModuleSourceTypeGCSModuleSourceType = "gcs"ModuleSourceTypeUnknownModuleSourceType = "unknown")
funcGetModuleSourceType¶added inv2.18.0
func GetModuleSourceType(sourcestring)ModuleSourceType
Terraform supports a variety of module source types, like:
- local paths (./ or ../)
- absolute local paths (/)
- git URLs (git:: or git@)
- http URLs
- s3 URLs
and more!
Seehttps://developer.hashicorp.com/terraform/language/modules/sources for an overview.
This function attempts to classify the source type of a module. It's imperfect,as checks that terraform actually does are pretty complicated.See e.g.https://github.com/hashicorp/go-getter/blob/842d6c379e5e70d23905b8f6b5a25a80290acb66/detect.go#L47if you're interested in the complexity.
typeNetcheck¶added inv2.14.0
type Netcheck struct {UDPbool `json:"udp"`IPv6bool `json:"ipv6"`IPv4bool `json:"ipv4"`IPv6CanSendbool `json:"ipv6_can_send"`IPv4CanSendbool `json:"ipv4_can_send"`ICMPv4bool `json:"icmpv4"`OSHasIPv6 *bool `json:"os_has_ipv6"`MappingVariesByDestIP *bool `json:"mapping_varies_by_dest_ip"`HairPinning *bool `json:"hair_pinning"`UPnP *bool `json:"upnp"`PMP *bool `json:"pmp"`PCP *bool `json:"pcp"`PreferredDERPint64 `json:"preferred_derp"`RegionV4Latency map[int64]time.Duration `json:"region_v4_latency"`RegionV6Latency map[int64]time.Duration `json:"region_v6_latency"`GlobalV4NetcheckIP `json:"global_v4"`GlobalV6NetcheckIP `json:"global_v6"`}
typeNetcheckIP¶added inv2.14.0
type NetcheckIP struct {Hashstring `json:"hash"`FieldsNetworkEventIPFields `json:"fields"`}
typeNetworkEvent¶added inv2.14.0
type NetworkEvent struct {IDuuid.UUID `json:"id"`Timetime.Time `json:"time"`Applicationstring `json:"application"`Statusstring `json:"status"`// connected, disconnectedClientTypestring `json:"client_type"`// cli, agent, coderd, wsproxyClientVersionstring `json:"client_version"`NodeIDSelfuint64 `json:"node_id_self"`NodeIDRemoteuint64 `json:"node_id_remote"`P2PEndpointNetworkEventP2PEndpoint `json:"p2p_endpoint"`HomeDERPint `json:"home_derp"`DERPMapDERPMap `json:"derp_map"`LatestNetcheckNetcheck `json:"latest_netcheck"`ConnectionAge *time.Duration `json:"connection_age"`ConnectionSetup *time.Duration `json:"connection_setup"`P2PSetup *time.Duration `json:"p2p_setup"`DERPLatency *time.Duration `json:"derp_latency"`P2PLatency *time.Duration `json:"p2p_latency"`ThroughputMbits *float32 `json:"throughput_mbits"`}
NetworkEvent and all related structs come from tailnet.proto.
funcNetworkEventFromProto¶added inv2.14.0
func NetworkEventFromProto(proto *tailnetproto.TelemetryEvent) (NetworkEvent,error)
typeNetworkEventIPFields¶added inv2.14.0
typeNetworkEventP2PEndpoint¶added inv2.14.0
type NetworkEventP2PEndpoint struct {Hashstring `json:"hash"`Portint `json:"port"`FieldsNetworkEventIPFields `json:"fields"`}
typeOrganization¶added inv2.19.0
type Organization struct {IDuuid.UUID `json:"id"`IsDefaultbool `json:"is_default"`CreatedAttime.Time `json:"created_at"`}
funcConvertOrganization¶added inv2.19.0
func ConvertOrganization(orgdatabase.Organization)Organization
typeProvisionerJob¶
type ProvisionerJob struct {IDuuid.UUID `json:"id"`OrganizationIDuuid.UUID `json:"organization_id"`InitiatorIDuuid.UUID `json:"initiator_id"`CreatedAttime.Time `json:"created_at"`UpdatedAttime.Time `json:"updated_at"`StartedAt *time.Time `json:"started_at,omitempty"`CanceledAt *time.Time `json:"canceled_at,omitempty"`CompletedAt *time.Time `json:"completed_at,omitempty"`Errorstring `json:"error"`Typedatabase.ProvisionerJobType `json:"type"`}
funcConvertProvisionerJob¶
func ConvertProvisionerJob(jobdatabase.ProvisionerJob)ProvisionerJob
ConvertProvisionerJob anonymizes a provisioner job.
typeReporter¶
type Reporter interface {// Report sends a snapshot to the telemetry server.// The contents of the snapshot can be a partial representation of the// database. For example, if a new user is added, a snapshot can// contain just that user entry.Report(snapshot *Snapshot)Enabled()boolClose()}
Reporter sends data to the telemetry server.
typeSnapshot¶
type Snapshot struct {DeploymentIDstring `json:"deployment_id"`APIKeys []APIKey `json:"api_keys"`CLIInvocations []clitelemetry.Invocation `json:"cli_invocations"`ExternalProvisioners []ExternalProvisioner `json:"external_provisioners"`Licenses []License `json:"licenses"`ProvisionerJobs []ProvisionerJob `json:"provisioner_jobs"`TemplateVersions []TemplateVersion `json:"template_versions"`Templates []Template `json:"templates"`Users []User `json:"users"`Groups []Group `json:"groups"`GroupMembers []GroupMember `json:"group_members"`WorkspaceAgentStats []WorkspaceAgentStat `json:"workspace_agent_stats"`WorkspaceAgents []WorkspaceAgent `json:"workspace_agents"`WorkspaceApps []WorkspaceApp `json:"workspace_apps"`WorkspaceBuilds []WorkspaceBuild `json:"workspace_build"`WorkspaceProxies []WorkspaceProxy `json:"workspace_proxies"`WorkspaceResourceMetadata []WorkspaceResourceMetadata `json:"workspace_resource_metadata"`WorkspaceResources []WorkspaceResource `json:"workspace_resources"`WorkspaceAgentMemoryResourceMonitors []WorkspaceAgentMemoryResourceMonitor `json:"workspace_agent_memory_resource_monitors"`WorkspaceAgentVolumeResourceMonitors []WorkspaceAgentVolumeResourceMonitor `json:"workspace_agent_volume_resource_monitors"`WorkspaceModules []WorkspaceModule `json:"workspace_modules"`Workspaces []Workspace `json:"workspaces"`NetworkEvents []NetworkEvent `json:"network_events"`Organizations []Organization `json:"organizations"`TelemetryItems []TelemetryItem `json:"telemetry_items"`UserTailnetConnections []UserTailnetConnection `json:"user_tailnet_connections"`}
Snapshot represents a point-in-time anonymized database dump.Data is aggregated by latest on the server-side, so partial datacan be sent without issue.
funcRecordTelemetryStatus¶added inv2.19.0
func RecordTelemetryStatus(ctxcontext.Context,loggerslog.Logger,dbdatabase.Store,telemetryEnabledbool,) (*Snapshot,error)
RecordTelemetryStatus records the telemetry status in the database.If the status changed from enabled to disabled, returns a snapshot tobe sent to the telemetry server.
typeTelemetryItem¶added inv2.19.0
type TelemetryItem struct {Keystring `json:"key"`Valuestring `json:"value"`CreatedAttime.Time `json:"created_at"`UpdatedAttime.Time `json:"updated_at"`}
funcConvertTelemetryItem¶added inv2.19.0
func ConvertTelemetryItem(itemdatabase.TelemetryItem)TelemetryItem
typeTemplate¶
type Template struct {IDuuid.UUID `json:"id"`CreatedByuuid.UUID `json:"created_by"`CreatedAttime.Time `json:"created_at"`UpdatedAttime.Time `json:"updated_at"`OrganizationIDuuid.UUID `json:"organization_id"`Deletedbool `json:"deleted"`ActiveVersionIDuuid.UUID `json:"active_version_id"`Namestring `json:"name"`Descriptionbool `json:"description"`DefaultTTLMillisint64 `json:"default_ttl_ms"`AllowUserCancelWorkspaceJobsbool `json:"allow_user_cancel_workspace_jobs"`AllowUserAutostartbool `json:"allow_user_autostart"`AllowUserAutostopbool `json:"allow_user_autostop"`FailureTTLMillisint64 `json:"failure_ttl_ms"`TimeTilDormantMillisint64 `json:"time_til_dormant_ms"`TimeTilDormantAutoDeleteMillisint64 `json:"time_til_dormant_auto_delete_ms"`AutostopRequirementDaysOfWeek []string `json:"autostop_requirement_days_of_week"`AutostopRequirementWeeksint64 `json:"autostop_requirement_weeks"`AutostartAllowedDays []string `json:"autostart_allowed_days"`RequireActiveVersionbool `json:"require_active_version"`Deprecatedbool `json:"deprecated"`}
funcConvertTemplate¶
ConvertTemplate anonymizes a template.
typeTemplateVersion¶
type TemplateVersion struct {IDuuid.UUID `json:"id"`CreatedAttime.Time `json:"created_at"`TemplateID *uuid.UUID `json:"template_id,omitempty"`OrganizationIDuuid.UUID `json:"organization_id"`JobIDuuid.UUID `json:"job_id"`SourceExampleID *string `json:"source_example_id,omitempty"`}
funcConvertTemplateVersion¶
func ConvertTemplateVersion(versiondatabase.TemplateVersion)TemplateVersion
ConvertTemplateVersion anonymizes a template version.
typeUser¶
type User struct {IDuuid.UUID `json:"id"`CreatedAttime.Time `json:"created_at"`// Email is only filled in for the first/admin user!Email *string `json:"email"`EmailHashedstring `json:"email_hashed"`RBACRoles []string `json:"rbac_roles"`Statusdatabase.UserStatus `json:"status"`GithubComUserIDint64 `json:"github_com_user_id"`// Omitempty for backwards compatibility.LoginTypestring `json:"login_type,omitempty"`}
typeUserTailnetConnection¶added inv2.21.0
type UserTailnetConnection struct {ConnectedAttime.Time `json:"connected_at"`DisconnectedAt *time.Time `json:"disconnected_at"`UserIDstring `json:"user_id"`PeerIDstring `json:"peer_id"`DeviceID *string `json:"device_id"`DeviceOS *string `json:"device_os"`CoderDesktopVersion *string `json:"coder_desktop_version"`}
typeWorkspace¶
type Workspace struct {IDuuid.UUID `json:"id"`OrganizationIDuuid.UUID `json:"organization_id"`OwnerIDuuid.UUID `json:"owner_id"`TemplateIDuuid.UUID `json:"template_id"`CreatedAttime.Time `json:"created_at"`Deletedbool `json:"deleted"`Namestring `json:"name"`AutostartSchedulestring `json:"autostart_schedule"`AutomaticUpdatesstring `json:"automatic_updates"`}
funcConvertWorkspace¶
ConvertWorkspace anonymizes a workspace.
typeWorkspaceAgent¶
type WorkspaceAgent struct {IDuuid.UUID `json:"id"`CreatedAttime.Time `json:"created_at"`ResourceIDuuid.UUID `json:"resource_id"`InstanceAuthbool `json:"instance_auth"`Architecturestring `json:"architecture"`OperatingSystemstring `json:"operating_system"`EnvironmentVariablesbool `json:"environment_variables"`Directorybool `json:"directory"`FirstConnectedAt *time.Time `json:"first_connected_at"`LastConnectedAt *time.Time `json:"last_connected_at"`DisconnectedAt *time.Time `json:"disconnected_at"`ConnectionTimeoutSecondsint32 `json:"connection_timeout_seconds"`Subsystems []string `json:"subsystems"`}
funcConvertWorkspaceAgent¶
func ConvertWorkspaceAgent(agentdatabase.WorkspaceAgent)WorkspaceAgent
ConvertWorkspaceAgent anonymizes a workspace agent.
typeWorkspaceAgentMemoryResourceMonitor¶added inv2.20.0
type WorkspaceAgentMemoryResourceMonitor struct {AgentIDuuid.UUID `json:"agent_id"`Enabledbool `json:"enabled"`Thresholdint32 `json:"threshold"`CreatedAttime.Time `json:"created_at"`UpdatedAttime.Time `json:"updated_at"`}
funcConvertWorkspaceAgentMemoryResourceMonitor¶added inv2.20.0
func ConvertWorkspaceAgentMemoryResourceMonitor(monitordatabase.WorkspaceAgentMemoryResourceMonitor)WorkspaceAgentMemoryResourceMonitor
typeWorkspaceAgentStat¶
type WorkspaceAgentStat struct {UserIDuuid.UUID `json:"user_id"`TemplateIDuuid.UUID `json:"template_id"`WorkspaceIDuuid.UUID `json:"workspace_id"`AggregatedFromtime.Time `json:"aggregated_from"`AgentIDuuid.UUID `json:"agent_id"`RxBytesint64 `json:"rx_bytes"`TxBytesint64 `json:"tx_bytes"`ConnectionLatency50float64 `json:"connection_latency_50"`ConnectionLatency95float64 `json:"connection_latency_95"`SessionCountVSCodeint64 `json:"session_count_vscode"`SessionCountJetBrainsint64 `json:"session_count_jetbrains"`SessionCountReconnectingPTYint64 `json:"session_count_reconnecting_pty"`SessionCountSSHint64 `json:"session_count_ssh"`}
funcConvertWorkspaceAgentStat¶
func ConvertWorkspaceAgentStat(statdatabase.GetWorkspaceAgentStatsRow)WorkspaceAgentStat
ConvertWorkspaceAgentStat anonymizes a workspace agent stat.
typeWorkspaceAgentVolumeResourceMonitor¶added inv2.20.0
type WorkspaceAgentVolumeResourceMonitor struct {AgentIDuuid.UUID `json:"agent_id"`Enabledbool `json:"enabled"`Thresholdint32 `json:"threshold"`CreatedAttime.Time `json:"created_at"`UpdatedAttime.Time `json:"updated_at"`}
funcConvertWorkspaceAgentVolumeResourceMonitor¶added inv2.20.0
func ConvertWorkspaceAgentVolumeResourceMonitor(monitordatabase.WorkspaceAgentVolumeResourceMonitor)WorkspaceAgentVolumeResourceMonitor
typeWorkspaceApp¶
type WorkspaceApp struct {IDuuid.UUID `json:"id"`CreatedAttime.Time `json:"created_at"`AgentIDuuid.UUID `json:"agent_id"`Iconstring `json:"icon"`Subdomainbool `json:"subdomain"`}
funcConvertWorkspaceApp¶
func ConvertWorkspaceApp(appdatabase.WorkspaceApp)WorkspaceApp
ConvertWorkspaceApp anonymizes a workspace app.
typeWorkspaceBuild¶
type WorkspaceBuild struct {IDuuid.UUID `json:"id"`CreatedAttime.Time `json:"created_at"`WorkspaceIDuuid.UUID `json:"workspace_id"`TemplateVersionIDuuid.UUID `json:"template_version_id"`JobIDuuid.UUID `json:"job_id"`BuildNumberuint32 `json:"build_number"`}
funcConvertWorkspaceBuild¶
func ConvertWorkspaceBuild(builddatabase.WorkspaceBuild)WorkspaceBuild
ConvertWorkspaceBuild anonymizes a workspace build.
typeWorkspaceModule¶added inv2.18.0
type WorkspaceModule struct {IDuuid.UUID `json:"id"`CreatedAttime.Time `json:"created_at"`JobIDuuid.UUID `json:"job_id"`Transitiondatabase.WorkspaceTransition `json:"transition"`Keystring `json:"key"`Versionstring `json:"version"`Sourcestring `json:"source"`SourceTypeModuleSourceType `json:"source_type"`}
funcConvertWorkspaceModule¶added inv2.18.0
func ConvertWorkspaceModule(moduledatabase.WorkspaceModule)WorkspaceModule
typeWorkspaceProxy¶
type WorkspaceProxy struct {IDuuid.UUID `json:"id"`Namestring `json:"name"`DisplayNamestring `json:"display_name"`// No URLs since we don't send deployment URL.DerpEnabledbool `json:"derp_enabled"`DerpOnlybool `json:"derp_only"`// No Status since it may contain sensitive information.CreatedAttime.Time `json:"created_at"`UpdatedAttime.Time `json:"updated_at"`}
funcConvertWorkspaceProxy¶
func ConvertWorkspaceProxy(proxydatabase.WorkspaceProxy)WorkspaceProxy
ConvertWorkspaceProxy anonymizes a workspace proxy.
typeWorkspaceResource¶
type WorkspaceResource struct {IDuuid.UUID `json:"id"`CreatedAttime.Time `json:"created_at"`JobIDuuid.UUID `json:"job_id"`Transitiondatabase.WorkspaceTransition `json:"transition"`Typestring `json:"type"`InstanceTypestring `json:"instance_type"`// ModulePath is nullable because it was added a long time after the// original workspace resource telemetry was added. All new resources// will have a module path, but deployments with older resources still// in the database will not.ModulePath *string `json:"module_path"`}
funcConvertWorkspaceResource¶
func ConvertWorkspaceResource(resourcedatabase.WorkspaceResource)WorkspaceResource
ConvertWorkspaceResource anonymizes a workspace resource.
typeWorkspaceResourceMetadata¶
type WorkspaceResourceMetadata struct {ResourceIDuuid.UUID `json:"resource_id"`Keystring `json:"key"`Sensitivebool `json:"sensitive"`}
funcConvertWorkspaceResourceMetadata¶
func ConvertWorkspaceResourceMetadata(metadatadatabase.WorkspaceResourceMetadatum)WorkspaceResourceMetadata
ConvertWorkspaceResourceMetadata anonymizes workspace metadata.