telemetry

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// 基础游戏属性
	GameIDKey        = attribute.Key("game.id")
	GameUserIDKey    = attribute.Key("game.user_id") // pseudonymous
	GameSessionIDKey = attribute.Key("game.session_id")
	GamePlatformKey  = attribute.Key("game.platform") // ios/android/windows...
	GameRegionKey    = attribute.Key("game.region")
	GameTypeKey      = attribute.Key("game.type")       // 对应 game_types.yaml
	GameGenreKey     = attribute.Key("game.genre_code") // 对应 taxonomy.yaml
	GameVersionKey   = attribute.Key("game.app_version")

	// 会话相关
	SessionEntryPointKey = attribute.Key("session.entry_point")
	SessionCauseEndKey   = attribute.Key("session.cause_end") // normal/crash/disconnect/quit
	SessionDurationKey   = attribute.Key("session.duration_ms")

	// 关卡/进度相关
	ProgressionLevelIDKey    = attribute.Key("progression.level_id")
	ProgressionChapterIDKey  = attribute.Key("progression.chapter_id")
	ProgressionWaveKey       = attribute.Key("progression.wave_index")
	ProgressionDifficultyKey = attribute.Key("progression.difficulty")
	ProgressionStarsKey      = attribute.Key("progression.stars")
	ProgressionRetriesKey    = attribute.Key("progression.retries")

	// 对战相关
	MatchIDKey        = attribute.Key("match.id")
	MatchModeKey      = attribute.Key("match.mode")       // pve/pvp/ranked...
	MatchResultKey    = attribute.Key("match.result")     // win/lose/draw/abandon
	MatchQueueTypeKey = attribute.Key("match.queue_type") // solo/duo/squad...
	MatchMapIDKey     = attribute.Key("match.map_id")
	MatchDurationKey  = attribute.Key("match.duration_ms")

	// 经济系统
	EconomyCurrencyKey     = attribute.Key("economy.currency")
	EconomyCurrencyKindKey = attribute.Key("economy.currency_kind") // soft/hard/real
	EconomyAmountKey       = attribute.Key("economy.amount")
	EconomySourceKey       = attribute.Key("economy.source") // kill_enemy/wave_bonus/quest/ad_reward
	EconomySinkKey         = attribute.Key("economy.sink")   // tower_build/tower_upgrade/ability

	// 变现相关
	MonetizationOrderIDKey  = attribute.Key("monetization.order_id")
	MonetizationSKUKey      = attribute.Key("monetization.sku_id")
	MonetizationPriceKey    = attribute.Key("monetization.price_usd")
	MonetizationProviderKey = attribute.Key("monetization.provider")

	// 广告系统
	AdNetworkKey   = attribute.Key("ad.network")
	AdPlacementKey = attribute.Key("ad.placement_id")
	AdFormatKey    = attribute.Key("ad.format") // rewarded/interstitial/banner
	AdRevenueKey   = attribute.Key("ad.revenue_usd")
	AdEcpmKey      = attribute.Key("ad.ecpm_usd")

	// 性能相关
	PerformanceFPSKey    = attribute.Key("performance.fps")
	PerformanceMemoryKey = attribute.Key("performance.memory_mb")
	PerformanceCPUKey    = attribute.Key("performance.cpu_load")
	NetworkRTTKey        = attribute.Key("network.rtt_ms")
	NetworkJitterKey     = attribute.Key("network.jitter_ms")
	NetworkPacketLossKey = attribute.Key("network.packet_loss")

	// 错误相关
	ErrorStackHashKey = attribute.Key("error.stack_hash")
	ErrorSceneKey     = attribute.Key("error.scene")
	ErrorSignalKey    = attribute.Key("error.signal_code")

	// 塔防 (TD) 特有属性
	TDTowerIDKey    = attribute.Key("td.tower_id")
	TDTowerTypeKey  = attribute.Key("td.tower_type")
	TDTowerPosXKey  = attribute.Key("td.pos_x")
	TDTowerPosYKey  = attribute.Key("td.pos_y")
	TDTowerCostKey  = attribute.Key("td.cost")
	TDTowerLevelKey = attribute.Key("td.tower_level")

	// 卡牌游戏
	CardDeckIDKey    = attribute.Key("card.deck_id")
	CardArchetypeKey = attribute.Key("card.deck_archetype")
	CardIDKey        = attribute.Key("card.id")

	// 抽卡系统
	GachaPoolIDKey      = attribute.Key("gacha.pool_id")
	GachaPullsKey       = attribute.Key("gacha.pulls")
	GachaRarityKey      = attribute.Key("gacha.rarity")
	GachaPityCounterKey = attribute.Key("gacha.pity_counter")
)

游戏业务 Semantic Conventions(基于 events.yaml 和 metrics.yaml)

View Source
const (
	EventSessionStart                = "session.start"
	EventSessionEnd                  = "session.end"
	EventUserRegister                = "user.register"
	EventUserLogin                   = "user.login"
	EventProgressionStart            = "progression.start"
	EventProgressionComplete         = "progression.complete"
	EventProgressionFail             = "progression.fail"
	EventMatchStart                  = "match.start"
	EventMatchEnd                    = "match.end"
	EventEconomyEarn                 = "economy.earn"
	EventEconomySpend                = "economy.spend"
	EventMonetizationPurchaseAttempt = "monetization.purchase_attempt"
	EventMonetizationPurchaseSuccess = "monetization.purchase_success"
	EventMonetizationPurchaseFail    = "monetization.purchase_fail"
	EventAdImpression                = "ad.impression"
	EventAdClick                     = "ad.click"
	EventAdReward                    = "ad.reward"
	EventGachaPull                   = "gacha.pull"
	EventErrorCrash                  = "error.crash"
	EventErrorANR                    = "error.anr"
	EventTDTowerBuild                = "td.tower.build"
	EventTDTowerUpgrade              = "td.tower.upgrade"
)

事件类型常量(基于 events.yaml)

Variables

This section is empty.

Functions

This section is empty.

Types

type AdImpressionRequest

type AdImpressionRequest struct {
	UserID        string
	AdNetwork     string
	PlacementID   string
	AdFormat      string // rewarded/interstitial/banner/native
	PlacementType string // between_waves/revive/booster/double_reward
	EcpmUSD       float64
	RevenueUSD    float64
}

AdImpressionRequest 广告曝光请求

type AnalyticsBridge

type AnalyticsBridge struct {
	// contains filtered or unexported fields
}

AnalyticsBridge 将OpenTelemetry事件桥接到现有Analytics系统

func NewAnalyticsBridge

func NewAnalyticsBridge(config AnalyticsBridgeConfig, gameID string, logger *slog.Logger) *AnalyticsBridge

NewAnalyticsBridge 创建Analytics桥接器

func (*AnalyticsBridge) Health

func (b *AnalyticsBridge) Health(ctx context.Context) error

Health 健康检查

func (*AnalyticsBridge) SendEconomyEvent

func (b *AnalyticsBridge) SendEconomyEvent(ctx context.Context, eventType string, span trace.Span, userID, currency string, amount float64, extra map[string]interface{})

SendEconomyEvent 发送经济相关事件

func (*AnalyticsBridge) SendEvent

func (b *AnalyticsBridge) SendEvent(ctx context.Context, eventType string, span trace.Span, attrs []attribute.KeyValue)

SendEvent 发送分析事件

func (*AnalyticsBridge) SendProgressionEvent

func (b *AnalyticsBridge) SendProgressionEvent(ctx context.Context, eventType string, span trace.Span, userID, sessionID, levelID string, extra map[string]interface{})

SendProgressionEvent 发送进度相关事件

func (*AnalyticsBridge) SendSessionEvent

func (b *AnalyticsBridge) SendSessionEvent(ctx context.Context, eventType string, span trace.Span, userID, sessionID, platform, region string, extra map[string]interface{})

SendSessionEvent 发送会话相关事件

func (*AnalyticsBridge) Shutdown

func (b *AnalyticsBridge) Shutdown(ctx context.Context) error

Shutdown 优雅关闭

type AnalyticsBridgeConfig

type AnalyticsBridgeConfig struct {
	Enabled        bool          `yaml:"enabled"`
	RedisAddr      string        `yaml:"redis_addr"`
	RedisPassword  string        `yaml:"redis_password"`
	RedisDB        int           `yaml:"redis_db"`
	TopicPrefix    string        `yaml:"topic_prefix"`
	RetentionHours int           `yaml:"retention_hours"`
	BatchSize      int           `yaml:"batch_size"`
	FlushInterval  time.Duration `yaml:"flush_interval"`
}

AnalyticsBridgeConfig Analytics桥接配置

type AnalyticsEvent

type AnalyticsEvent struct {
	EventType  string                 `json:"event_type"`
	GameID     string                 `json:"game_id"`
	UserID     string                 `json:"user_id"`
	SessionID  string                 `json:"session_id"`
	Platform   string                 `json:"platform"`
	Region     string                 `json:"region"`
	Timestamp  int64                  `json:"timestamp"`
	Attributes map[string]interface{} `json:"attributes"`
	TraceID    string                 `json:"trace_id,omitempty"`
	SpanID     string                 `json:"span_id,omitempty"`
}

AnalyticsEvent 标准化的游戏分析事件

type CrashEvent

type CrashEvent struct {
	UserID     string
	SessionID  string
	StackHash  string
	SignalCode string
	Scene      string
	DeviceID   string
}

CrashEvent 崩溃事件

type EconomyTransaction

type EconomyTransaction struct {
	UserID       string
	Currency     string
	CurrencyKind string // soft/hard/real
	Amount       float64
	Type         string // earn/spend
	Source       string // for earn: kill_enemy/wave_bonus/quest/ad_reward/offline
	Sink         string // for spend: tower_build/tower_upgrade/ability/unlock/boost
	ItemID       string
	BalanceAfter float64
}

EconomyTransaction 经济交易

type FunctionCallRequest

type FunctionCallRequest struct {
	FunctionID  string
	Version     string
	UserID      string
	SessionID   string
	GameID      string
	Environment string
	AgentID     string
	Parameters  map[string]interface{}
}

FunctionCallRequest Function调用请求

type FunctionCallResult

type FunctionCallResult struct {
	Success      bool
	DurationMs   int64
	ResultType   string
	ErrorMessage string
	ErrorCode    string
}

FunctionCallResult Function调用结果

type GachaPullRequest

type GachaPullRequest struct {
	UserID      string
	PoolID      string
	Pulls       int
	Rarity      string
	PityCounter int
	ItemIDs     []string
}

GachaPullRequest 抽卡请求

type GameMetrics

type GameMetrics struct {
	// === 用户活跃指标 ===
	DAU metric.Int64ObservableGauge // 日活跃用户数
	WAU metric.Int64ObservableGauge // 周活跃用户数
	MAU metric.Int64ObservableGauge // 月活跃用户数

	UserLoginCounter    metric.Int64Counter // 登录次数
	UserRegisterCounter metric.Int64Counter // 注册次数

	// === 留存指标 ===
	RetentionD1  metric.Float64ObservableGauge // 次日留存率
	RetentionD7  metric.Float64ObservableGauge // 7日留存率
	RetentionD30 metric.Float64ObservableGauge // 30日留存率

	// === 会话指标 ===
	SessionDuration metric.Float64Histogram // 会话时长分布
	SessionCounter  metric.Int64Counter     // 会话计数

	// === 变现指标 ===
	RevenueTotal metric.Float64Counter         // 总收入
	ARPU         metric.Float64ObservableGauge // 每用户平均收入
	ARPPU        metric.Float64ObservableGauge // 每付费用户收入
	PaymentRate  metric.Float64ObservableGauge // 付费率

	// 广告收入
	AdRevenue     metric.Float64Counter         // 广告收入
	AdImpressions metric.Int64Counter           // 广告曝光
	AdARPU        metric.Float64ObservableGauge // 广告ARPU

	// === 游戏玩法指标 ===
	// 关卡/进度
	LevelStartCounter    metric.Int64Counter           // 关卡开始
	LevelCompleteCounter metric.Int64Counter           // 关卡完成
	LevelFailCounter     metric.Int64Counter           // 关卡失败
	LevelCompletionRate  metric.Float64ObservableGauge // 关卡完成率
	LevelRetries         metric.Float64Histogram       // 重试次数分布

	// 对战系统
	MatchStartCounter metric.Int64Counter           // 对局开始
	MatchEndCounter   metric.Int64Counter           // 对局结束
	WinRate           metric.Float64ObservableGauge // 胜率
	MatchDuration     metric.Float64Histogram       // 对局时长
	QueueTime         metric.Float64Histogram       // 匹配等待时间

	// 经济系统
	CurrencyEarn   metric.Float64Counter         // 货币获得
	CurrencySpend  metric.Float64Counter         // 货币消费
	EconomyBalance metric.Float64ObservableGauge // 产消比

	// === 技术指标 ===
	ClientFPS      metric.Float64Histogram // 客户端帧率
	NetworkLatency metric.Float64Histogram // 网络延迟
	MemoryUsage    metric.Float64Histogram // 内存使用

	// 稳定性指标
	CrashCounter       metric.Int64Counter           // 崩溃计数
	ANRCounter         metric.Int64Counter           // ANR计数
	CrashRate          metric.Float64ObservableGauge // 崩溃率
	CrashFreeUsersRate metric.Float64ObservableGauge // 无崩溃用户率

	// === 游戏类型特有指标 ===
	// 塔防 (TD)
	TDTowerBuildCounter   metric.Int64Counter           // 塔建造次数
	TDTowerUpgradeCounter metric.Int64Counter           // 塔升级次数
	TDTowerUsageRate      metric.Float64ObservableGauge // 塔型使用率
	TDUpgradeRate         metric.Float64ObservableGauge // 塔升级率

	// 卡牌游戏
	CardUsageRate      metric.Float64ObservableGauge // 卡牌使用率
	CardWinRate        metric.Float64ObservableGauge // 卡牌胜率
	DeckArchetypeShare metric.Float64ObservableGauge // 卡组类型分布

	// 抽卡系统
	GachaPullCounter metric.Int64Counter           // 抽卡次数
	GachaPityCounter metric.Float64ObservableGauge // 保底计数
}

GameMetrics 游戏业务指标集合(基于 metrics.yaml)

func NewGameMetrics

func NewGameMetrics(meter metric.Meter) (*GameMetrics, error)

NewGameMetrics 创建游戏指标实例

type GameTelemetryService

type GameTelemetryService struct {
	// contains filtered or unexported fields
}

GameTelemetryService 游戏遥测服务 提供高级API集成到Croupier Server/Agent架构中

func NewGameTelemetryService

func NewGameTelemetryService(config TelemetryConfig, logger *slog.Logger) (*GameTelemetryService, error)

NewGameTelemetryService 创建游戏遥测服务

func (*GameTelemetryService) CompleteFunctionCall

func (s *GameTelemetryService) CompleteFunctionCall(ctx context.Context, result FunctionCallResult)

CompleteFunctionCall 完成Function调用追踪

func (*GameTelemetryService) CompleteLevelPlaythrough

func (s *GameTelemetryService) CompleteLevelPlaythrough(ctx context.Context, result LevelCompleteRequest)

CompleteLevelPlaythrough 代理到GameTracer

func (*GameTelemetryService) CompletePermissionCheck

func (s *GameTelemetryService) CompletePermissionCheck(ctx context.Context, result PermissionCheckResult)

CompletePermissionCheck 完成权限检查追踪

func (*GameTelemetryService) EndUserSession

func (s *GameTelemetryService) EndUserSession(ctx context.Context, req SessionEndRequest)

EndUserSession 代理到GameTracer

func (*GameTelemetryService) HTTPMiddleware

func (s *GameTelemetryService) HTTPMiddleware(handler http.Handler) http.Handler

HTTPMiddleware 返回标准HTTP中间件用于HTTP请求追踪

func (*GameTelemetryService) Health

func (s *GameTelemetryService) Health(ctx context.Context) error

Health 健康检查

func (*GameTelemetryService) Shutdown

func (s *GameTelemetryService) Shutdown(ctx context.Context) error

Shutdown 优雅关闭

func (*GameTelemetryService) StartLevelPlaythrough

func (s *GameTelemetryService) StartLevelPlaythrough(ctx context.Context, req LevelStartRequest) (context.Context, trace.Span)

StartLevelPlaythrough 代理到GameTracer

func (*GameTelemetryService) StartUserSession

StartUserSession 代理到GameTracer

func (*GameTelemetryService) TrackEconomyTransaction

func (s *GameTelemetryService) TrackEconomyTransaction(ctx context.Context, transaction EconomyTransaction)

TrackEconomyTransaction 代理到GameTracer

func (*GameTelemetryService) TrackFunctionCall

TrackFunctionCall 追踪Croupier Function调用

func (*GameTelemetryService) TrackPermissionCheck

func (s *GameTelemetryService) TrackPermissionCheck(ctx context.Context, req PermissionCheckRequest) (context.Context, trace.Span)

TrackPermissionCheck 追踪权限检查

type GameTracer

type GameTracer struct {
	// contains filtered or unexported fields
}

GameTracer 游戏事件追踪器

func NewGameTracer

func NewGameTracer(tracer trace.Tracer, metrics *GameMetrics, bridge *AnalyticsBridge) *GameTracer

NewGameTracer 创建游戏追踪器

func (*GameTracer) CompleteLevelPlaythrough

func (t *GameTracer) CompleteLevelPlaythrough(ctx context.Context, result LevelCompleteRequest)

CompleteLevelPlaythrough 完成关卡游玩

func (*GameTracer) CompletePurchase

func (t *GameTracer) CompletePurchase(ctx context.Context, result PurchaseResult)

CompletePurchase 完成付费

func (*GameTracer) EndMatch

func (t *GameTracer) EndMatch(ctx context.Context, result MatchEndRequest)

EndMatch 结束对战

func (*GameTracer) EndUserSession

func (t *GameTracer) EndUserSession(ctx context.Context, req SessionEndRequest)

EndUserSession 结束用户会话

func (*GameTracer) FailLevelPlaythrough

func (t *GameTracer) FailLevelPlaythrough(ctx context.Context, result LevelFailRequest)

FailLevelPlaythrough 关卡失败

func (*GameTracer) RecordPerformance

func (t *GameTracer) RecordPerformance(ctx context.Context, perf PerformanceMetrics)

RecordPerformance 记录性能指标

func (*GameTracer) StartLevelPlaythrough

func (t *GameTracer) StartLevelPlaythrough(ctx context.Context, req LevelStartRequest) (context.Context, trace.Span)

StartLevelPlaythrough 开始关卡游玩链路

func (*GameTracer) StartMatch

func (t *GameTracer) StartMatch(ctx context.Context, req MatchStartRequest) (context.Context, trace.Span)

StartMatch 开始对战

func (*GameTracer) StartPurchase

func (t *GameTracer) StartPurchase(ctx context.Context, purchase PurchaseFlow) (context.Context, trace.Span)

StartPurchase 开始付费流程

func (*GameTracer) StartUserSession

func (t *GameTracer) StartUserSession(ctx context.Context, req SessionStartRequest) (context.Context, trace.Span)

StartUserSession 开始用户会话(顶级 Trace)

func (*GameTracer) TrackAdImpression

func (t *GameTracer) TrackAdImpression(ctx context.Context, req AdImpressionRequest)

TrackAdImpression 追踪广告曝光

func (*GameTracer) TrackCrash

func (t *GameTracer) TrackCrash(ctx context.Context, crash CrashEvent)

TrackCrash 追踪崩溃

func (*GameTracer) TrackEconomyTransaction

func (t *GameTracer) TrackEconomyTransaction(ctx context.Context, transaction EconomyTransaction)

TrackEconomyTransaction 追踪经济交易

func (*GameTracer) TrackGachaPull

func (t *GameTracer) TrackGachaPull(ctx context.Context, req GachaPullRequest)

TrackGachaPull 追踪抽卡

func (*GameTracer) TrackTowerBuild

func (t *GameTracer) TrackTowerBuild(ctx context.Context, req TowerBuildRequest)

TrackTowerBuild 追踪塔建造

func (*GameTracer) TrackTowerUpgrade

func (t *GameTracer) TrackTowerUpgrade(ctx context.Context, req TowerUpgradeRequest)

TrackTowerUpgrade 追踪塔升级

type LevelCompleteRequest

type LevelCompleteRequest struct {
	LevelID         string
	DurationMs      int64
	Stars           int
	Retries         int
	WaveIndex       int
	HeartsRemaining int
	Difficulty      string
}

LevelCompleteRequest 关卡完成请求

type LevelFailRequest

type LevelFailRequest struct {
	LevelID         string
	DurationMs      int64
	Reason          string
	FailWave        int
	HeartsRemaining int
	Difficulty      string
}

LevelFailRequest 关卡失败请求

type LevelStartRequest

type LevelStartRequest struct {
	UserID       string
	SessionID    string
	LevelID      string
	ChapterID    string
	StageID      string
	Difficulty   string
	WaveIndex    int
	AttemptIndex int
	IsBossWave   bool
}

LevelStartRequest 关卡开始请求

type MatchEndRequest

type MatchEndRequest struct {
	MatchID       string
	MatchResult   string // win/lose/draw/abandon
	DurationMs    int64
	GameMode      string
	Kills         int
	Deaths        int
	Assists       int
	DamageDone    int
	DamageTaken   int
	Surrender     bool
	DeckID        string
	DeckArchetype string
}

MatchEndRequest 对战结束请求

type MatchStartRequest

type MatchStartRequest struct {
	UserID        string
	SessionID     string
	MatchID       string
	GameMode      string
	QueueType     string
	MapID         string
	QueueTimeMs   int
	MMR           int
	TeamID        string
	DeckID        string
	DeckArchetype string
}

MatchStartRequest 对战开始请求

type PerformanceMetrics

type PerformanceMetrics struct {
	UserID     string
	FPS        float64
	MemoryMB   float64
	CPULoad    float64
	RTTMs      float64
	JitterMs   float64
	PacketLoss float64
}

PerformanceMetrics 性能指标

type PermissionCheckRequest

type PermissionCheckRequest struct {
	UserID   string
	Resource string
	Action   string
	Scope    string
}

PermissionCheckRequest 权限检查请求

type PermissionCheckResult

type PermissionCheckResult struct {
	Granted    bool
	Reason     string
	DurationMs int64
}

PermissionCheckResult 权限检查结果

type Provider

type Provider struct {
	TracerProvider *trace.TracerProvider
	MeterProvider  *metric.MeterProvider
	GameMetrics    *GameMetrics
	GameTracer     *GameTracer
	Bridge         *AnalyticsBridge
	// contains filtered or unexported fields
}

Provider OpenTelemetry提供者

func NewProvider

func NewProvider(ctx context.Context, config TelemetryConfig, logger *slog.Logger) (*Provider, error)

NewProvider 创建OpenTelemetry提供者

func (*Provider) Shutdown

func (p *Provider) Shutdown(ctx context.Context) error

Shutdown 优雅关闭

type PurchaseFlow

type PurchaseFlow struct {
	UserID          string
	OrderID         string
	SKUID           string
	PriceUSD        float64
	CurrencyCode    string
	PaymentProvider string
}

PurchaseFlow 付费流程

type PurchaseResult

type PurchaseResult struct {
	OrderID    string
	SKUID      string
	PriceUSD   float64
	Success    bool
	FailReason string
	TaxUSD     float64
	Country    string
}

PurchaseResult 付费结果

type SessionEndRequest

type SessionEndRequest struct {
	UserID     string
	SessionID  string
	DurationMs int64
	CauseOfEnd string // normal/crash/disconnect/quit
}

SessionEndRequest 会话结束请求

type SessionStartRequest

type SessionStartRequest struct {
	UserID     string
	SessionID  string
	Platform   string
	Region     string
	GameType   string
	GenreCode  string
	AppVersion string
	EntryPoint string
	CampaignID string
	DeviceID   string
}

SessionStartRequest 会话开始请求

type TelemetryConfig

type TelemetryConfig struct {
	ServiceName    string  `yaml:"service_name"`
	ServiceVersion string  `yaml:"service_version"`
	Environment    string  `yaml:"environment"`
	CollectorURL   string  `yaml:"collector_url"`
	GameID         string  `yaml:"game_id"`
	EnableTracing  bool    `yaml:"enable_tracing"`
	EnableMetrics  bool    `yaml:"enable_metrics"`
	SamplingRatio  float64 `yaml:"sampling_ratio"`

	// TLS配置
	UseTLS  bool   `yaml:"use_tls"` // 是否使用TLS连接到Collector
	Headers string `yaml:"headers"` // 自定义HTTP头(如Authorization)

	// Analytics桥接配置
	Analytics AnalyticsBridgeConfig `yaml:"analytics"`
}

TelemetryConfig OpenTelemetry配置

func LoadConfigFromEnv

func LoadConfigFromEnv() TelemetryConfig

LoadConfigFromEnv 从环境变量加载配置

type TowerBuildRequest

type TowerBuildRequest struct {
	UserID    string
	LevelID   string
	TowerID   string
	TowerType string
	PosX      int
	PosY      int
	Cost      float64
	WaveIndex int
}

TowerBuildRequest 塔建造请求

type TowerUpgradeRequest

type TowerUpgradeRequest struct {
	UserID    string
	LevelID   string
	TowerID   string
	TowerType string
	FromLevel int
	ToLevel   int
	Cost      float64
	WaveIndex int
}

TowerUpgradeRequest 塔升级请求

Jump to

Keyboard shortcuts

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