(b *testing.B)
| 283 | } |
| 284 | |
| 285 | func BenchmarkCollect(b *testing.B) { |
| 286 | var ( |
| 287 | tenant = "test-tenant" |
| 288 | reg = prometheus.NewRegistry() |
| 289 | ctx = context.Background() |
| 290 | log = log.NewNopLogger() |
| 291 | cfg = &Config{} |
| 292 | |
| 293 | walcfg = &storage.Config{ |
| 294 | Path: b.TempDir(), |
| 295 | } |
| 296 | |
| 297 | o = &mockOverrides{ |
| 298 | processors: map[string]struct{}{ |
| 299 | "span-metrics": {}, |
| 300 | "service-graphs": {}, |
| 301 | }, |
| 302 | spanMetricsDimensions: []string{"k8s.cluster.name", "k8s.namespace.name"}, |
| 303 | spanMetricsEnableTargetInfo: boolPtr(true), |
| 304 | spanMetricsTargetInfoExcludedDimensions: []string{"excluded}"}, |
| 305 | nativeHistograms: histograms.HistogramMethodBoth, |
| 306 | } |
| 307 | ) |
| 308 | |
| 309 | cfg.RegisterFlagsAndApplyDefaults("", &flag.FlagSet{}) |
| 310 | |
| 311 | wal, err := storage.New(walcfg, o, tenant, reg, log) |
| 312 | require.NoError(b, err) |
| 313 | |
| 314 | inst, err := newInstance(cfg, tenant, o, wal, log) |
| 315 | require.NoError(b, err) |
| 316 | defer inst.shutdown() |
| 317 | |
| 318 | req := &tempopb.PushSpansRequest{ |
| 319 | Batches: []*trace_v1.ResourceSpans{ |
| 320 | test.MakeBatch(100, nil), |
| 321 | test.MakeBatch(100, nil), |
| 322 | test.MakeBatch(100, nil), |
| 323 | test.MakeBatch(100, nil), |
| 324 | }, |
| 325 | } |
| 326 | |
| 327 | // Add more resource attributes to get closer to real data |
| 328 | // Add integer to increase cardinality. |
| 329 | // Currently this is about 80 active series |
| 330 | // TODO - Get more series |
| 331 | for i, b := range req.Batches { |
| 332 | b.Resource.Attributes = append(b.Resource.Attributes, []*common_v1.KeyValue{ |
| 333 | {Key: "k8s.cluster.name", Value: &common_v1.AnyValue{Value: &common_v1.AnyValue_StringValue{StringValue: "test" + strconv.Itoa(i)}}}, |
| 334 | {Key: "k8s.namespace.name", Value: &common_v1.AnyValue{Value: &common_v1.AnyValue_StringValue{StringValue: "test" + strconv.Itoa(i)}}}, |
| 335 | {Key: "k8s.node.name", Value: &common_v1.AnyValue{Value: &common_v1.AnyValue_StringValue{StringValue: "test" + strconv.Itoa(i)}}}, |
| 336 | {Key: "k8s.pod.ip", Value: &common_v1.AnyValue{Value: &common_v1.AnyValue_StringValue{StringValue: "test" + strconv.Itoa(i)}}}, |
| 337 | {Key: "k8s.pod.name", Value: &common_v1.AnyValue{Value: &common_v1.AnyValue_StringValue{StringValue: "test" + strconv.Itoa(i)}}}, |
| 338 | {Key: "excluded", Value: &common_v1.AnyValue{Value: &common_v1.AnyValue_StringValue{StringValue: "test" + strconv.Itoa(i)}}}, |
| 339 | }...) |
| 340 | } |
| 341 | inst.pushSpans(ctx, req) |
| 342 |
nothing calls this directly
no test coverage detected