chore: remove hand-rolled telemetry pkg; ignore build binaries

- delete internal/telemetry (replaced by oss-telemetry library in prev commit)
- gitignore root /mcp and /worker build artifacts
This commit is contained in:
2026-05-24 03:03:57 +01:00
parent 00d8871f5e
commit a59b9b1622
2 changed files with 2 additions and 55 deletions
-55
View File
@@ -1,55 +0,0 @@
// Package telemetry sends anonymous OSS usage pings.
package telemetry
import (
"bytes"
"context"
"encoding/json"
"net/http"
"strings"
"time"
"github.com/rs/zerolog/log"
)
const endpoint = "https://oss.raczylo.com/v1/ping"
type pingPayload struct {
Project string `json:"project"`
Version string `json:"version"`
Ts int64 `json:"ts"`
}
// Ping fires an anonymous analytics ping asynchronously. Never blocks the caller.
// Silently skips dev/dirty builds; all errors are logged at debug level only.
func Ping(project, version string) {
if version == "dev" || strings.Contains(version, "dirty") {
return
}
go func() {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
body, err := json.Marshal(pingPayload{
Project: project,
Version: strings.TrimPrefix(version, "v"),
Ts: time.Now().Unix(),
})
if err != nil {
return
}
req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint, bytes.NewReader(body))
if err != nil {
return
}
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Debug().Err(err).Msg("telemetry ping failed")
return
}
resp.Body.Close()
}()
}