Skip to content

Telemetry value types moved to pkg/telemetrytypes

The shared telemetry value types — EventType (with its Event* constants) and DeliveryMode (with DeliveryAtLeastOnce / DeliveryAtMostOnce) — now live in a new dependency-free leaf package, pkg/telemetrytypes. Both pkg/props and pkg/telemetry import that leaf, so the telemetry collector no longer imports pkg/props from its core. This is the last step in decoupling root pkg/telemetry from GTB's dependency-injection container (see the spec docs/development/specs/2026-07-10-telemetry-props-decoupling.md).

Impact on downstream tools: none expected

pkg/props keeps the names as type aliases, so existing code compiles unchanged:

// pkg/props — still valid, now aliases to the leaf
type EventType = telemetrytypes.EventType
type DeliveryMode = telemetrytypes.DeliveryMode

const EventCommandInvocation = telemetrytypes.EventCommandInvocation // etc.
const DeliveryAtLeastOnce = telemetrytypes.DeliveryAtLeastOnce       // etc.

Because a type alias is an identity, props.EventType is telemetrytypes.EventType. Code that references props.EventCommandInvocation, sets props.TelemetryConfig.DeliveryMode, or implements props.TelemetryCollector needs no change. The props.* aliases are retained permanently.

What changed in pkg/telemetry

  • pkg/telemetry no longer defines its own mirror EventType type or Event* constants — the mirror is removed and the package references telemetrytypes.EventType directly.
  • telemetry.Event.Type is now typed telemetrytypes.EventType (identical underlying string; JSON/wire representation unchanged).
  • telemetry.Collector.Track and telemetry.NewCollector accept the leaf types. Callers passing props.EventCommandInvocation / props.DeliveryAtLeastOnce continue to work via the aliases above.

If — and only if — your tool referenced the telemetry-package copies telemetry.EventCommandInvocation, telemetry.EventType, etc. (rather than the props.* names), repoint them:

Before:

import "gitlab.com/phpboyscout/go-tool-base/pkg/telemetry"

evt := telemetry.Event{Type: telemetry.EventCommandInvocation}

After:

import (
    "gitlab.com/phpboyscout/go-tool-base/pkg/telemetry"
    "gitlab.com/phpboyscout/go-tool-base/pkg/telemetrytypes"
)

evt := telemetry.Event{Type: telemetrytypes.EventCommandInvocation}

The props.* aliases (e.g. props.EventCommandInvocation) also remain a valid target if you prefer to keep a single import.

Wire compatibility

The on-the-wire string values are unchanged (command.invocation, at_least_once, and so on), so persisted config and emitted telemetry payloads are fully compatible across the change.