This commit is contained in:
CanbiZ (MickLesk) 2026-02-10 08:23:04 +01:00
parent 53cf705799
commit a0ba6fbbd1
3 changed files with 9 additions and 26 deletions

View File

@ -557,7 +557,6 @@ post_tool_to_api() {
"random_id": "${uuid}",
"type": "tool",
"nsapp": "${tool_name}",
"tool_name": "${tool_name}",
"status": "${status}",
"exit_code": ${exit_code},
"error": "${error}",
@ -580,8 +579,7 @@ EOF
# - Arguments:
# * $1: addon_name (e.g., "filebrowser", "netdata")
# * $2: status ("success" or "failed")
# * $3: parent_ct (optional, name of parent container)
# * $4: exit_code (optional)
# * $3: exit_code (optional)
# - For addons installed inside containers
# ------------------------------------------------------------------------------
post_addon_to_api() {
@ -590,8 +588,7 @@ post_addon_to_api() {
local addon_name="${1:-unknown}"
local status="${2:-success}"
local parent_ct="${3:-}"
local exit_code="${4:-0}"
local exit_code="${3:-0}"
local error="" error_category=""
local uuid duration
@ -623,7 +620,6 @@ post_addon_to_api() {
"type": "addon",
"nsapp": "${addon_name}",
"status": "${status}",
"parent_ct": "${parent_ct}",
"exit_code": ${exit_code},
"error": "${error}",
"error_category": "${error_category}",

View File

@ -99,9 +99,8 @@ type ToolCount struct {
}
type AddonCount struct {
Addon string `json:"addon"`
ParentCT string `json:"parent_ct"`
Count int `json:"count"`
Addon string `json:"addon"`
Count int `json:"count"`
}
// FetchDashboardData retrieves aggregated data from PocketBase
@ -193,9 +192,9 @@ func (p *PBClient) FetchDashboardData(ctx context.Context, days int) (*Dashboard
// === Extended metrics tracking ===
// Track tool executions
if r.Type == "tool" && r.ToolName != "" {
toolCounts[r.ToolName]++
// Track tool executions (type="tool", tool name is in nsapp)
if r.Type == "tool" && r.NSAPP != "" {
toolCounts[r.NSAPP]++
data.TotalTools++
}

View File

@ -82,13 +82,7 @@ type TelemetryIn struct {
Error string `json:"error,omitempty"` // Error description (max 120 chars)
ExitCode int `json:"exit_code,omitempty"` // 0-255
// === NEW FIELDS ===
// Tool telemetry (type="tool")
ToolName string `json:"tool_name,omitempty"` // "microcode", "lxc-update", "post-pve-install", etc.
// Addon telemetry (type="addon")
ParentCT string `json:"parent_ct,omitempty"` // Parent container name (e.g., "jellyfin")
// === EXTENDED FIELDS ===
// GPU Passthrough stats
GPUVendor string `json:"gpu_vendor,omitempty"` // "intel", "amd", "nvidia"
@ -119,8 +113,6 @@ type TelemetryOut struct {
ExitCode int `json:"exit_code,omitempty"`
// Extended fields
ToolName string `json:"tool_name,omitempty"`
ParentCT string `json:"parent_ct,omitempty"`
GPUVendor string `json:"gpu_vendor,omitempty"`
GPUPassthrough string `json:"gpu_passthrough,omitempty"`
InstallDuration int `json:"install_duration,omitempty"`
@ -575,9 +567,7 @@ func validate(in *TelemetryIn) error {
in.PveVer = sanitizeShort(in.PveVer, 32)
in.Method = sanitizeShort(in.Method, 32)
// Sanitize new fields
in.ToolName = sanitizeShort(in.ToolName, 64)
in.ParentCT = sanitizeShort(in.ParentCT, 64)
// Sanitize extended fields
in.GPUVendor = strings.ToLower(sanitizeShort(in.GPUVendor, 16))
in.GPUPassthrough = strings.ToLower(sanitizeShort(in.GPUPassthrough, 16))
in.ErrorCategory = strings.ToLower(sanitizeShort(in.ErrorCategory, 32))
@ -983,8 +973,6 @@ func main() {
Method: in.Method,
Error: in.Error,
ExitCode: in.ExitCode,
ToolName: in.ToolName,
ParentCT: in.ParentCT,
GPUVendor: in.GPUVendor,
GPUPassthrough: in.GPUPassthrough,
InstallDuration: in.InstallDuration,