-
This commit is contained in:
parent
53cf705799
commit
a0ba6fbbd1
@ -557,7 +557,6 @@ post_tool_to_api() {
|
|||||||
"random_id": "${uuid}",
|
"random_id": "${uuid}",
|
||||||
"type": "tool",
|
"type": "tool",
|
||||||
"nsapp": "${tool_name}",
|
"nsapp": "${tool_name}",
|
||||||
"tool_name": "${tool_name}",
|
|
||||||
"status": "${status}",
|
"status": "${status}",
|
||||||
"exit_code": ${exit_code},
|
"exit_code": ${exit_code},
|
||||||
"error": "${error}",
|
"error": "${error}",
|
||||||
@ -580,8 +579,7 @@ EOF
|
|||||||
# - Arguments:
|
# - Arguments:
|
||||||
# * $1: addon_name (e.g., "filebrowser", "netdata")
|
# * $1: addon_name (e.g., "filebrowser", "netdata")
|
||||||
# * $2: status ("success" or "failed")
|
# * $2: status ("success" or "failed")
|
||||||
# * $3: parent_ct (optional, name of parent container)
|
# * $3: exit_code (optional)
|
||||||
# * $4: exit_code (optional)
|
|
||||||
# - For addons installed inside containers
|
# - For addons installed inside containers
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
post_addon_to_api() {
|
post_addon_to_api() {
|
||||||
@ -590,8 +588,7 @@ post_addon_to_api() {
|
|||||||
|
|
||||||
local addon_name="${1:-unknown}"
|
local addon_name="${1:-unknown}"
|
||||||
local status="${2:-success}"
|
local status="${2:-success}"
|
||||||
local parent_ct="${3:-}"
|
local exit_code="${3:-0}"
|
||||||
local exit_code="${4:-0}"
|
|
||||||
local error="" error_category=""
|
local error="" error_category=""
|
||||||
local uuid duration
|
local uuid duration
|
||||||
|
|
||||||
@ -623,7 +620,6 @@ post_addon_to_api() {
|
|||||||
"type": "addon",
|
"type": "addon",
|
||||||
"nsapp": "${addon_name}",
|
"nsapp": "${addon_name}",
|
||||||
"status": "${status}",
|
"status": "${status}",
|
||||||
"parent_ct": "${parent_ct}",
|
|
||||||
"exit_code": ${exit_code},
|
"exit_code": ${exit_code},
|
||||||
"error": "${error}",
|
"error": "${error}",
|
||||||
"error_category": "${error_category}",
|
"error_category": "${error_category}",
|
||||||
|
|||||||
@ -99,9 +99,8 @@ type ToolCount struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type AddonCount struct {
|
type AddonCount struct {
|
||||||
Addon string `json:"addon"`
|
Addon string `json:"addon"`
|
||||||
ParentCT string `json:"parent_ct"`
|
Count int `json:"count"`
|
||||||
Count int `json:"count"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// FetchDashboardData retrieves aggregated data from PocketBase
|
// FetchDashboardData retrieves aggregated data from PocketBase
|
||||||
@ -193,9 +192,9 @@ func (p *PBClient) FetchDashboardData(ctx context.Context, days int) (*Dashboard
|
|||||||
|
|
||||||
// === Extended metrics tracking ===
|
// === Extended metrics tracking ===
|
||||||
|
|
||||||
// Track tool executions
|
// Track tool executions (type="tool", tool name is in nsapp)
|
||||||
if r.Type == "tool" && r.ToolName != "" {
|
if r.Type == "tool" && r.NSAPP != "" {
|
||||||
toolCounts[r.ToolName]++
|
toolCounts[r.NSAPP]++
|
||||||
data.TotalTools++
|
data.TotalTools++
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -82,13 +82,7 @@ type TelemetryIn struct {
|
|||||||
Error string `json:"error,omitempty"` // Error description (max 120 chars)
|
Error string `json:"error,omitempty"` // Error description (max 120 chars)
|
||||||
ExitCode int `json:"exit_code,omitempty"` // 0-255
|
ExitCode int `json:"exit_code,omitempty"` // 0-255
|
||||||
|
|
||||||
// === NEW FIELDS ===
|
// === EXTENDED 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")
|
|
||||||
|
|
||||||
// GPU Passthrough stats
|
// GPU Passthrough stats
|
||||||
GPUVendor string `json:"gpu_vendor,omitempty"` // "intel", "amd", "nvidia"
|
GPUVendor string `json:"gpu_vendor,omitempty"` // "intel", "amd", "nvidia"
|
||||||
@ -119,8 +113,6 @@ type TelemetryOut struct {
|
|||||||
ExitCode int `json:"exit_code,omitempty"`
|
ExitCode int `json:"exit_code,omitempty"`
|
||||||
|
|
||||||
// Extended fields
|
// Extended fields
|
||||||
ToolName string `json:"tool_name,omitempty"`
|
|
||||||
ParentCT string `json:"parent_ct,omitempty"`
|
|
||||||
GPUVendor string `json:"gpu_vendor,omitempty"`
|
GPUVendor string `json:"gpu_vendor,omitempty"`
|
||||||
GPUPassthrough string `json:"gpu_passthrough,omitempty"`
|
GPUPassthrough string `json:"gpu_passthrough,omitempty"`
|
||||||
InstallDuration int `json:"install_duration,omitempty"`
|
InstallDuration int `json:"install_duration,omitempty"`
|
||||||
@ -575,9 +567,7 @@ func validate(in *TelemetryIn) error {
|
|||||||
in.PveVer = sanitizeShort(in.PveVer, 32)
|
in.PveVer = sanitizeShort(in.PveVer, 32)
|
||||||
in.Method = sanitizeShort(in.Method, 32)
|
in.Method = sanitizeShort(in.Method, 32)
|
||||||
|
|
||||||
// Sanitize new fields
|
// Sanitize extended fields
|
||||||
in.ToolName = sanitizeShort(in.ToolName, 64)
|
|
||||||
in.ParentCT = sanitizeShort(in.ParentCT, 64)
|
|
||||||
in.GPUVendor = strings.ToLower(sanitizeShort(in.GPUVendor, 16))
|
in.GPUVendor = strings.ToLower(sanitizeShort(in.GPUVendor, 16))
|
||||||
in.GPUPassthrough = strings.ToLower(sanitizeShort(in.GPUPassthrough, 16))
|
in.GPUPassthrough = strings.ToLower(sanitizeShort(in.GPUPassthrough, 16))
|
||||||
in.ErrorCategory = strings.ToLower(sanitizeShort(in.ErrorCategory, 32))
|
in.ErrorCategory = strings.ToLower(sanitizeShort(in.ErrorCategory, 32))
|
||||||
@ -983,8 +973,6 @@ func main() {
|
|||||||
Method: in.Method,
|
Method: in.Method,
|
||||||
Error: in.Error,
|
Error: in.Error,
|
||||||
ExitCode: in.ExitCode,
|
ExitCode: in.ExitCode,
|
||||||
ToolName: in.ToolName,
|
|
||||||
ParentCT: in.ParentCT,
|
|
||||||
GPUVendor: in.GPUVendor,
|
GPUVendor: in.GPUVendor,
|
||||||
GPUPassthrough: in.GPUPassthrough,
|
GPUPassthrough: in.GPUPassthrough,
|
||||||
InstallDuration: in.InstallDuration,
|
InstallDuration: in.InstallDuration,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user