log_test.go 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. // Copyright The OpenTelemetry Authors
  2. // SPDX-License-Identifier: Apache-2.0
  3. // Package tests contains test cases. To run the tests go to tests directory and run:
  4. // RUN_TESTBED=1 go test -v
  5. package tests
  6. import (
  7. "testing"
  8. "github.com/open-telemetry/opentelemetry-collector-contrib/testbed/datareceivers"
  9. "github.com/open-telemetry/opentelemetry-collector-contrib/testbed/datasenders"
  10. "github.com/open-telemetry/opentelemetry-collector-contrib/testbed/testbed"
  11. )
  12. func TestLog10kDPS(t *testing.T) {
  13. tests := []struct {
  14. name string
  15. sender testbed.DataSender
  16. receiver testbed.DataReceiver
  17. resourceSpec testbed.ResourceSpec
  18. extensions map[string]string
  19. }{
  20. {
  21. name: "OTLP",
  22. sender: testbed.NewOTLPLogsDataSender(testbed.DefaultHost, testbed.GetAvailablePort(t)),
  23. receiver: testbed.NewOTLPDataReceiver(testbed.GetAvailablePort(t)),
  24. resourceSpec: testbed.ResourceSpec{
  25. ExpectedMaxCPU: 30,
  26. ExpectedMaxRAM: 120,
  27. },
  28. },
  29. {
  30. name: "OTLP-HTTP",
  31. sender: testbed.NewOTLPHTTPLogsDataSender(testbed.DefaultHost, testbed.GetAvailablePort(t)),
  32. receiver: testbed.NewOTLPHTTPDataReceiver(testbed.GetAvailablePort(t)),
  33. resourceSpec: testbed.ResourceSpec{
  34. ExpectedMaxCPU: 30,
  35. ExpectedMaxRAM: 120,
  36. },
  37. },
  38. {
  39. name: "filelog",
  40. sender: datasenders.NewFileLogWriter(),
  41. receiver: testbed.NewOTLPDataReceiver(testbed.GetAvailablePort(t)),
  42. resourceSpec: testbed.ResourceSpec{
  43. ExpectedMaxCPU: 50,
  44. ExpectedMaxRAM: 120,
  45. },
  46. },
  47. {
  48. name: "filelog checkpoints",
  49. sender: datasenders.NewFileLogWriter(),
  50. receiver: testbed.NewOTLPDataReceiver(testbed.GetAvailablePort(t)),
  51. resourceSpec: testbed.ResourceSpec{
  52. ExpectedMaxCPU: 50,
  53. ExpectedMaxRAM: 120,
  54. },
  55. extensions: datasenders.NewLocalFileStorageExtension(),
  56. },
  57. {
  58. name: "kubernetes containers",
  59. sender: datasenders.NewKubernetesContainerWriter(),
  60. receiver: testbed.NewOTLPDataReceiver(testbed.GetAvailablePort(t)),
  61. resourceSpec: testbed.ResourceSpec{
  62. ExpectedMaxCPU: 110,
  63. ExpectedMaxRAM: 150,
  64. },
  65. },
  66. {
  67. name: "k8s CRI-Containerd",
  68. sender: datasenders.NewKubernetesCRIContainerdWriter(),
  69. receiver: testbed.NewOTLPDataReceiver(testbed.GetAvailablePort(t)),
  70. resourceSpec: testbed.ResourceSpec{
  71. ExpectedMaxCPU: 100,
  72. ExpectedMaxRAM: 150,
  73. },
  74. },
  75. {
  76. name: "k8s CRI-Containerd no attr ops",
  77. sender: datasenders.NewKubernetesCRIContainerdNoAttributesOpsWriter(),
  78. receiver: testbed.NewOTLPDataReceiver(testbed.GetAvailablePort(t)),
  79. resourceSpec: testbed.ResourceSpec{
  80. ExpectedMaxCPU: 100,
  81. ExpectedMaxRAM: 150,
  82. },
  83. },
  84. {
  85. name: "CRI-Containerd",
  86. sender: datasenders.NewCRIContainerdWriter(),
  87. receiver: testbed.NewOTLPDataReceiver(testbed.GetAvailablePort(t)),
  88. resourceSpec: testbed.ResourceSpec{
  89. ExpectedMaxCPU: 100,
  90. ExpectedMaxRAM: 150,
  91. },
  92. },
  93. {
  94. name: "syslog-tcp-batch-1",
  95. sender: datasenders.NewTCPUDPWriter("tcp", testbed.DefaultHost, testbed.GetAvailablePort(t), 1),
  96. receiver: testbed.NewOTLPDataReceiver(testbed.GetAvailablePort(t)),
  97. resourceSpec: testbed.ResourceSpec{
  98. ExpectedMaxCPU: 80,
  99. ExpectedMaxRAM: 150,
  100. },
  101. },
  102. {
  103. name: "syslog-tcp-batch-100",
  104. sender: datasenders.NewTCPUDPWriter("tcp", testbed.DefaultHost, testbed.GetAvailablePort(t), 100),
  105. receiver: testbed.NewOTLPDataReceiver(testbed.GetAvailablePort(t)),
  106. resourceSpec: testbed.ResourceSpec{
  107. ExpectedMaxCPU: 80,
  108. ExpectedMaxRAM: 150,
  109. },
  110. },
  111. {
  112. name: "FluentForward-SplunkHEC",
  113. sender: datasenders.NewFluentLogsForwarder(t, testbed.GetAvailablePort(t)),
  114. receiver: datareceivers.NewSplunkHECDataReceiver(testbed.GetAvailablePort(t)),
  115. resourceSpec: testbed.ResourceSpec{
  116. ExpectedMaxCPU: 60,
  117. ExpectedMaxRAM: 150,
  118. },
  119. },
  120. {
  121. name: "tcp-batch-1",
  122. sender: datasenders.NewTCPUDPWriter("tcp", testbed.DefaultHost, testbed.GetAvailablePort(t), 1),
  123. receiver: testbed.NewOTLPDataReceiver(testbed.GetAvailablePort(t)),
  124. resourceSpec: testbed.ResourceSpec{
  125. ExpectedMaxCPU: 80,
  126. ExpectedMaxRAM: 150,
  127. },
  128. },
  129. {
  130. name: "tcp-batch-100",
  131. sender: datasenders.NewTCPUDPWriter("tcp", testbed.DefaultHost, testbed.GetAvailablePort(t), 100),
  132. receiver: testbed.NewOTLPDataReceiver(testbed.GetAvailablePort(t)),
  133. resourceSpec: testbed.ResourceSpec{
  134. ExpectedMaxCPU: 80,
  135. ExpectedMaxRAM: 150,
  136. },
  137. },
  138. }
  139. processors := map[string]string{
  140. "batch": `
  141. batch:
  142. `,
  143. }
  144. for _, test := range tests {
  145. t.Run(test.name, func(t *testing.T) {
  146. Scenario10kItemsPerSecond(
  147. t,
  148. test.sender,
  149. test.receiver,
  150. test.resourceSpec,
  151. performanceResultsSummary,
  152. processors,
  153. test.extensions,
  154. )
  155. })
  156. }
  157. }