Skip to content

Commit

Permalink
delete commented out benchmarks
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Kruse <[email protected]>
  • Loading branch information
c-kruse committed Sep 21, 2023
1 parent cb8215d commit 63ffd87
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 124 deletions.
99 changes: 0 additions & 99 deletions pkg/processor/k8sprocessor/kube/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1326,102 +1326,3 @@ func TestServiceInfoArrivesLate(t *testing.T) {
// Desired behavior: we get all three service names in response:
assert.Equal(t, "firstService, secondService, thirdService", serviceName)
}

//func newBenchmarkClient(b *testing.B) *WatchClient {
// e := ExtractionRules{
// ContainerID: true,
// ContainerImage: true,
// ContainerName: true,
// DaemonSetName: true,
// DeploymentName: true,
// HostName: true,
// PodUID: true,
// PodName: true,
// ReplicaSetName: true,
// ServiceName: true,
// StatefulSetName: true,
// StartTime: true,
// Namespace: true,
// NodeName: true,
// Tags: NewExtractionFieldTags(),
// }
//
// c, _ := New(
// zap.NewNop(),
// k8sconfig.APIConfig{},
// e,
// Filters{},
// []Association{},
// Excludes{},
// newFakeAPIClientset,
// NewFakeInformer,
// newFakeOwnerProvider,
// "",
// 30*time.Second,
// DefaultPodDeleteGracePeriod,
// )
// return c.(*WatchClient)
//}
//
//// benchmark actually checks what's the impact of adding new Pod, which is mostly impacted by duration of API call
//func benchmark(b *testing.B, podsPerUniqueOwner int) {
// c := newBenchmarkClient(b)
//
// b.ResetTimer()
// for i := 0; i < b.N; i++ {
// pod := &api_v1.Pod{
// ObjectMeta: meta_v1.ObjectMeta{
// Name: fmt.Sprintf("pod-number-%d", i),
// Namespace: "ns1",
// UID: types.UID(fmt.Sprintf("33333-%d", i)),
// CreationTimestamp: meta_v1.Now(),
// Labels: map[string]string{
// "label1": fmt.Sprintf("lv1-%d", i),
// "label2": "k1=v1 k5=v5 extra!",
// },
// Annotations: map[string]string{
// "annotation1": fmt.Sprintf("av%d", i),
// },
// OwnerReferences: []meta_v1.OwnerReference{
// {
// Kind: "ReplicaSet",
// Name: "foo-bar-rs",
// UID: types.UID(fmt.Sprintf("1a1658f9-7818-11e9-90f1-02324f7e0d1e-%d", i/podsPerUniqueOwner)),
// },
// },
// },
// Spec: api_v1.PodSpec{
// NodeName: "node1",
// Hostname: "auth-hostname3",
// Containers: []api_v1.Container{
// {
// Image: "auth-service-image",
// Name: "auth-service-container-name",
// },
// },
// },
// Status: api_v1.PodStatus{
// PodIP: fmt.Sprintf("%d.%d.%d.%d", (i>>24)%256, (i>>16)%256, (i>>8)%256, i%256),
// ContainerStatuses: []api_v1.ContainerStatus{
// {
// ContainerID: fmt.Sprintf("111-222-333-%d", i),
// },
// },
// },
// }
//
// c.handlePodAdd(pod)
// _, ok := c.getPod(PodIdentifier(pod.Status.PodIP))
// require.True(b, ok)
//
// }
//
//}
//
//func BenchmarkManyPodsPerOwner(b *testing.B) {
// benchmark(b, 100000)
//}
//
//func BenchmarkFewPodsPerOwner(b *testing.B) {
// benchmark(b, 10)
//}
25 changes: 0 additions & 25 deletions pkg/processor/k8sprocessor/processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1025,28 +1025,3 @@ func assertResourceHasStringAttribute(t *testing.T, r pcommon.Resource, k, v str
assert.EqualValues(t, pcommon.ValueTypeStr, got.Type(), "attribute %s is not of type string", k)
assert.EqualValues(t, v, got.Str(), "attribute %s is not equal to %s", k, v)
}

//func BenchmarkConsumingTraceData(b *testing.B) {
// next := &testConsumer{}
// p, _ := NewTraceProcessor(
// zap.NewNop(),
// next,
// kube.NewFakeClient,
// )
//
// kp, _ := p.(*kubernetesprocessor)
// kc, _ := kp.kc.(*kube.FakeClient)
//
// b.ResetTimer()
// for i := 0; i < b.N; i++ {
// ip := "1.1.1.1"
// attrs := map[string]string{
// "pod": "test-2323",
// "ns": "default",
// "another tag": "value",
// }
// kc.Pods[ip] = &kube.Pod{Attributes: attrs}
// ctx := client.NewContext(context.Background(), &client.Client{IP: ip})
// p.ConsumeTraceData(ctx, consumerdata.TraceData{})
// }
//}

0 comments on commit 63ffd87

Please sign in to comment.