search_result.go 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. // Copyright The OpenTelemetry Authors
  2. // SPDX-License-Identifier: Apache-2.0
  3. package splunkenterprisereceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/splunkenterprisereceiver"
  4. // metric name and its associated search as a key value pair
  5. var searchDict = map[string]string{
  6. `SplunkLicenseIndexUsageSearch`: `search=search index=_internal source=*license_usage.log type="Usage"| fields idx, b| eval indexname = if(len(idx)=0 OR isnull(idx),"(UNKNOWN)",idx)| stats sum(b) as b by indexname| eval By=round(b, 9)| fields indexname, By`,
  7. }
  8. var apiDict = map[string]string{
  9. `SplunkIndexerThroughput`: `/services/server/introspection/indexer?output_mode=json`,
  10. `SplunkDataIndexesExtended`: `/services/data/indexes-extended?output_mode=json&count=-1`,
  11. `SplunkIntrospectionQueues`: `/services/server/introspection/queues?output_mode=json&count=-1`,
  12. }
  13. type searchResponse struct {
  14. search string
  15. Jobid *string `xml:"sid"`
  16. Return int
  17. Fields []*field `xml:"result>field"`
  18. }
  19. type field struct {
  20. FieldName string `xml:"k,attr"`
  21. Value string `xml:"value>text"`
  22. }
  23. // '/services/server/introspection/indexer'
  24. type indexThroughput struct {
  25. Entries []idxTEntry `json:"entry"`
  26. }
  27. type idxTEntry struct {
  28. Content idxTContent `json:"content"`
  29. }
  30. type idxTContent struct {
  31. Status string `json:"status"`
  32. AvgKb float64 `json:"average_KBps"`
  33. }
  34. // '/services/data/indexes-extended'
  35. type IndexesExtended struct {
  36. Entries []IdxEEntry `json:"entry"`
  37. }
  38. type IdxEEntry struct {
  39. Name string `json:"name"`
  40. Content IdxEContent `json:"content"`
  41. }
  42. type IdxEContent struct {
  43. TotalBucketCount string `json:"total_bucket_count"`
  44. TotalEventCount int `json:"totalEventCount"`
  45. TotalSize string `json:"total_size"`
  46. TotalRawSize string `json:"total_raw_size"`
  47. BucketDirs IdxEBucketDirs `json:"bucket_dirs"`
  48. }
  49. type IdxEBucketDirs struct {
  50. Cold IdxEBucketDirsDetails `json:"cold"`
  51. Home IdxEBucketDirsDetails `json:"home"`
  52. Thawed IdxEBucketDirsDetails `json:"thawed"`
  53. }
  54. type IdxEBucketDirsDetails struct {
  55. Capacity string `json:"capacity"`
  56. EventCount string `json:"event_count"`
  57. EventMaxTime string `json:"event_max_time"`
  58. EventMinTime string `json:"event_min_time"`
  59. HotBucketCount string `json:"hot_bucket_count"`
  60. WarmBucketCount string `json:"warm_bucket_count"`
  61. WarmBucketSize string `json:"warm_bucket_size"`
  62. }
  63. // '/services/server/introspection/queues'
  64. type IntrospectionQueues struct {
  65. Entries []IntrQEntry `json:"entry"`
  66. }
  67. type IntrQEntry struct {
  68. Name string `json:"name"`
  69. Content IdxQContent `json:"content"`
  70. }
  71. type IdxQContent struct {
  72. CurrentSize int `json:"current_size"`
  73. CurrentSizeBytes int `json:"current_size_bytes"`
  74. LargestSize int `json:"largest_size"`
  75. MaxSizeBytes int `json:"max_size_bytes"`
  76. }