MCPcopy
hub / github.com/grafana/tempo / TestDrain_Train_MaxTokensEnforcement

Function TestDrain_Train_MaxTokensEnforcement

pkg/drain/drain_test.go:138–150  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

136}
137
138func TestDrain_Train_MaxTokensEnforcement(t *testing.T) {
139 t.Parallel()
140
141 config := DefaultConfig()
142 config.MaxTokens = 3 // Very small limit for testing (tokenizer produces many tokens)
143 drain := New("test-tenant", config)
144
145 // Create a span name that will exceed MaxTokens
146 // "GET /api/users" tokenizes to ["GET", " ", "/", "api", "/", "users", "<END>"] = 7 tokens
147 longSpanName := "GET /api/users/123/posts/456/comments/789/tags/101/items/202/details/303"
148 cluster := drain.Train(longSpanName)
149 require.Nil(t, cluster, "should return nil for span with too many tokens")
150}
151
152func TestDrain_Train_EmptyString(t *testing.T) {
153 t.Parallel()

Callers

nothing calls this directly

Calls 3

DefaultConfigFunction · 0.85
TrainMethod · 0.80
NewFunction · 0.70

Tested by

no test coverage detected