telemetry

package
v1.0.2 Latest Latest
Warning

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

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

Documentation

Overview

Package telemetry builds opt-in usage events without workspace metadata.

Index

Constants

View Source
const (
	Endpoint = "https://telemetry.datatf.io/v1/events"
	Notice   = "https://github.com/536tech/datatf/blob/main/docs/telemetry.md"
	Timeout  = 250 * time.Millisecond
)

Variables

This section is empty.

Functions

func Payload

func Payload(run Run) ([]byte, error)

Payload returns the same allowlisted JSON for delivery and offline preview. Unknown metadata is replaced, never copied from a report or command line.

func SaveConsent

func SaveConsent(path string, enabled bool) error

SaveConsent replaces only DataTF's consent file. Invalid or missing settings default to off.

func Send

func Send(ctx context.Context, run Run)

Send attempts one event after consent. Delivery never changes the command result.

Types

type Run

type Run struct {
	Version, OS, Arch, Command, Scope, Outcome, ErrorCode string
	ResourceGroups                                        []string
	Duration                                              time.Duration
}

Run contains only the inputs permitted in a usage event.

type Status

type Status struct {
	Enabled     bool   `json:"enabled"`
	Source      string `json:"source"`
	ConfigFile  string `json:"config_file"`
	ConfigError string `json:"config_error,omitempty"`
}

Status describes effective consent without creating files or contacting a server.

func Resolve

func Resolve(path string, getenv func(string) string) Status

Resolve gives environment opt-outs priority over saved consent. An explicit environment opt-in is required in detected automation sessions.

Jump to

Keyboard shortcuts

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