(b *testing.B)
| 149 | } |
| 150 | |
| 151 | func BenchmarkPushSpans(b *testing.B) { |
| 152 | var ( |
| 153 | tenant = "test-tenant" |
| 154 | reg = prometheus.NewRegistry() |
| 155 | ctx = context.Background() |
| 156 | log = log.NewNopLogger() |
| 157 | cfg = &Config{} |
| 158 | |
| 159 | walcfg = &storage.Config{ |
| 160 | Path: b.TempDir(), |
| 161 | } |
| 162 | |
| 163 | o = &mockOverrides{ |
| 164 | processors: map[string]struct{}{ |
| 165 | "span-metrics": {}, |
| 166 | "service-graphs": {}, |
| 167 | }, |
| 168 | spanMetricsEnableTargetInfo: boolPtr(true), |
| 169 | spanMetricsTargetInfoExcludedDimensions: []string{"excluded}"}, |
| 170 | } |
| 171 | ) |
| 172 | |
| 173 | cfg.RegisterFlagsAndApplyDefaults("", &flag.FlagSet{}) |
| 174 | |
| 175 | wal, err := storage.New(walcfg, o, tenant, reg, log) |
| 176 | require.NoError(b, err) |
| 177 | |
| 178 | inst, err := newInstance(cfg, tenant, o, wal, log) |
| 179 | require.NoError(b, err) |
| 180 | defer inst.shutdown() |
| 181 | |
| 182 | req := &tempopb.PushSpansRequest{ |
| 183 | Batches: []*trace_v1.ResourceSpans{ |
| 184 | test.MakeBatch(100, nil), |
| 185 | test.MakeBatch(100, nil), |
| 186 | test.MakeBatch(100, nil), |
| 187 | test.MakeBatch(100, nil), |
| 188 | test.MakeBatch(100, nil), |
| 189 | test.MakeBatch(100, nil), |
| 190 | test.MakeBatch(100, nil), |
| 191 | test.MakeBatch(100, nil), |
| 192 | test.MakeBatch(100, nil), |
| 193 | test.MakeBatch(100, nil), |
| 194 | }, |
| 195 | } |
| 196 | |
| 197 | // Add more resource attributes to get closer to real data |
| 198 | // Add integer to increase cardinality. |
| 199 | // Currently this is about 80 active series |
| 200 | // TODO - Get more series |
| 201 | for i, b := range req.Batches { |
| 202 | b.Resource.Attributes = append(b.Resource.Attributes, []*common_v1.KeyValue{ |
| 203 | {Key: "k8s.cluster.name", Value: &common_v1.AnyValue{Value: &common_v1.AnyValue_StringValue{StringValue: "test" + strconv.Itoa(i)}}}, |
| 204 | {Key: "k8s.namespace.name", Value: &common_v1.AnyValue{Value: &common_v1.AnyValue_StringValue{StringValue: "test" + strconv.Itoa(i)}}}, |
| 205 | {Key: "k8s.node.name", Value: &common_v1.AnyValue{Value: &common_v1.AnyValue_StringValue{StringValue: "test" + strconv.Itoa(i)}}}, |
| 206 | {Key: "k8s.pod.ip", Value: &common_v1.AnyValue{Value: &common_v1.AnyValue_StringValue{StringValue: "test" + strconv.Itoa(i)}}}, |
| 207 | {Key: "k8s.pod.name", Value: &common_v1.AnyValue{Value: &common_v1.AnyValue_StringValue{StringValue: "test" + strconv.Itoa(i)}}}, |
| 208 | {Key: "service.instance.id", Value: &common_v1.AnyValue{Value: &common_v1.AnyValue_StringValue{StringValue: "test" + strconv.Itoa(i)}}}, |
nothing calls this directly
no test coverage detected