Prometheus.service.ts 960 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import BaseModel from './BaseModel';
  2. export class PrometheusService extends BaseModel {
  3. static SET_PROMETHEUS_URL = '/prometheus/setPrometheus';
  4. static GET_MILVUS_HEALTHY_DATA_URL = '/prometheus/getMilvusHealthyData';
  5. constructor(props: {}) {
  6. super(props);
  7. Object.assign(this, props);
  8. }
  9. static setPrometheus({
  10. prometheusAddress,
  11. prometheusInstance,
  12. prometheusNamespace,
  13. }: {
  14. prometheusAddress: string;
  15. prometheusInstance: string;
  16. prometheusNamespace: string;
  17. }) {
  18. return super.search({
  19. path: PrometheusService.SET_PROMETHEUS_URL,
  20. params: { prometheusAddress, prometheusInstance, prometheusNamespace },
  21. timeout: 1000,
  22. });
  23. }
  24. static getHealthyData({
  25. start,
  26. end,
  27. step,
  28. }: {
  29. start: number;
  30. end: number;
  31. step: number;
  32. }) {
  33. return super.search({
  34. path: PrometheusService.GET_MILVUS_HEALTHY_DATA_URL,
  35. params: { start, end, step },
  36. });
  37. }
  38. }