testData.ts 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. import { PluginType } from '@grafana/data';
  2. import { GoogleAuthType } from '@grafana/google-sdk';
  3. import CloudMonitoringDatasource from '../datasource';
  4. export const metricDescriptors = [
  5. {
  6. name: 'projects/grafana-prod/metricDescriptors/agent.googleapis.com/agent/api_request_count',
  7. labels: [
  8. {
  9. key: 'state',
  10. description: 'Request state',
  11. },
  12. ],
  13. metricKind: 'CUMULATIVE',
  14. valueType: 'INT64',
  15. unit: '1',
  16. description: 'API request count',
  17. displayName: 'API Request Count',
  18. type: 'agent.googleapis.com/agent/api_request_count',
  19. metadata: {
  20. launchStage: 'GA',
  21. samplePeriod: '60s',
  22. ingestDelay: '0s',
  23. },
  24. },
  25. {
  26. name: 'projects/grafana-prod/metricDescriptors/agent.googleapis.com/agent/log_entry_count',
  27. labels: [
  28. {
  29. key: 'response_code',
  30. description: 'HTTP response code',
  31. },
  32. ],
  33. metricKind: 'CUMULATIVE',
  34. valueType: 'INT64',
  35. unit: '1',
  36. description: 'Count of log entry writes',
  37. displayName: 'Log Entry Count',
  38. type: 'agent.googleapis.com/agent/log_entry_count',
  39. metadata: {
  40. launchStage: 'GA',
  41. samplePeriod: '60s',
  42. ingestDelay: '0s',
  43. },
  44. },
  45. ];
  46. export const newMockDatasource = () =>
  47. new CloudMonitoringDatasource({
  48. id: 1,
  49. uid: 'cm-id',
  50. type: 'cloud-monitoring-datasource',
  51. name: 'Cloud Monitoring Data Source',
  52. jsonData: {
  53. authenticationType: GoogleAuthType.JWT,
  54. },
  55. access: 'proxy',
  56. meta: {
  57. id: 'cloud-monitoring-datasource',
  58. name: 'Cloud Monitoring Data Source',
  59. type: PluginType.datasource,
  60. module: '',
  61. baseUrl: '',
  62. info: {
  63. description: '',
  64. screenshots: [],
  65. updated: '',
  66. version: '',
  67. logos: {
  68. small: '',
  69. large: '',
  70. },
  71. author: {
  72. name: '',
  73. },
  74. links: [],
  75. },
  76. },
  77. });