model.go 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. // Copyright The OpenTelemetry Authors
  2. // SPDX-License-Identifier: Apache-2.0
  3. package snowflakereceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/snowflakereceiver"
  4. import "database/sql"
  5. // each query returns columns which serialize into these data structures
  6. // these are consumed by the scraper to create and emit metrics
  7. // billing metrics query
  8. type billingMetric struct {
  9. serviceType sql.NullString
  10. serviceName sql.NullString
  11. totalCloudService float64
  12. totalCredits float64
  13. totalVirtualWarehouseCredits float64
  14. }
  15. // warehouse billing query
  16. type whBillingMetric struct {
  17. warehouseName sql.NullString
  18. totalCloudService float64
  19. totalCredit float64
  20. totalVirtualWarehouse float64
  21. }
  22. // login metrics query
  23. type loginMetric struct {
  24. userName sql.NullString
  25. errorMessage sql.NullString
  26. reportedClientType sql.NullString
  27. isSuccess sql.NullString
  28. loginsTotal int64
  29. }
  30. // high level low dimensionality query
  31. type hlQueryMetric struct {
  32. warehouseName sql.NullString
  33. avgQueryExecuted float64
  34. avgQueryBlocked float64
  35. avgQueryQueuedOverload float64
  36. avgQueryQueuedProvision float64
  37. }
  38. // db metrics query
  39. type dbMetric struct {
  40. attributes dbMetricAttributes
  41. databaseQueryCount int64
  42. avgBytesScanned float64
  43. avgBytesDeleted float64
  44. avgBytesSpilledRemote float64
  45. avgBytesSpilledLocal float64
  46. avgBytesWritten float64
  47. avgCompilationTime float64
  48. avgDataScannedCache float64
  49. avgExecutionTime float64
  50. avgPartitionsScanned float64
  51. avgQueuedOverloadTime float64
  52. avgQueuedProvisioningTime float64
  53. avgQueuedRepairTime float64
  54. avgRowsInserted float64
  55. avgRowsDeleted float64
  56. avgRowsProduced float64
  57. avgRowsUnloaded float64
  58. avgRowsUpdated float64
  59. avgTotalElapsedTime float64
  60. }
  61. type dbMetricAttributes struct {
  62. userName sql.NullString
  63. schemaName sql.NullString
  64. executionStatus sql.NullString
  65. errorMessage sql.NullString
  66. queryType sql.NullString
  67. warehouseName sql.NullString
  68. databaseName sql.NullString
  69. warehouseSize sql.NullString
  70. }
  71. type sessionMetric struct {
  72. userName sql.NullString
  73. distinctSessionID int64
  74. }
  75. type snowpipeMetric struct {
  76. pipeName sql.NullString
  77. creditsUsed float64
  78. bytesInserted int64
  79. filesInserted int64
  80. }
  81. type storageMetric struct {
  82. storageBytes int64
  83. stageBytes int64
  84. failsafeBytes int64
  85. }