Interface SlaDefinitionRepository

All Superinterfaces:
org.springframework.data.repository.CrudRepository<SlaDefinitionEntity,Long>, org.springframework.data.jpa.repository.JpaRepository<SlaDefinitionEntity,Long>, org.springframework.data.repository.ListCrudRepository<SlaDefinitionEntity,Long>, org.springframework.data.repository.ListPagingAndSortingRepository<SlaDefinitionEntity,Long>, org.springframework.data.repository.PagingAndSortingRepository<SlaDefinitionEntity,Long>, org.springframework.data.repository.query.QueryByExampleExecutor<SlaDefinitionEntity>, org.springframework.data.repository.Repository<SlaDefinitionEntity,Long>

public interface SlaDefinitionRepository extends org.springframework.data.jpa.repository.JpaRepository<SlaDefinitionEntity,Long>
Spring Data JPA repository for SlaDefinitionEntity.

Uses a one-to-one relationship with RegisteredServiceEntity (keyed by service ID). The SLA definition holds the uptime, response-time, and error-rate thresholds that are evaluated by the SLA calculation service.

Author:
Nazar Montytskyi
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    upsert(Long serviceId, double uptimePercent, long maxResponseTimeMs, double maxErrorRatePercent, String description)
     

    Methods inherited from interface org.springframework.data.repository.CrudRepository

    count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, save

    Methods inherited from interface org.springframework.data.jpa.repository.JpaRepository

    deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlush

    Methods inherited from interface org.springframework.data.repository.ListCrudRepository

    findAll, findAllById, saveAll

    Methods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository

    findAll

    Methods inherited from interface org.springframework.data.repository.PagingAndSortingRepository

    findAll

    Methods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor

    count, exists, findAll, findBy, findOne
  • Method Details

    • upsert

      @Modifying @Transactional @Query(value="INSERT INTO sla_definitions\n (service_id, uptime_percent, max_response_time_ms, max_error_rate_percent, description)\nVALUES\n (:serviceId, :uptimePercent, :maxResponseTimeMs, :maxErrorRatePercent, :description)\nON CONFLICT (service_id) DO UPDATE SET\n uptime_percent = EXCLUDED.uptime_percent,\n max_response_time_ms = EXCLUDED.max_response_time_ms,\n max_error_rate_percent = EXCLUDED.max_error_rate_percent,\n description = EXCLUDED.description\n", nativeQuery=true) void upsert(@Param("serviceId") Long serviceId, @Param("uptimePercent") double uptimePercent, @Param("maxResponseTimeMs") long maxResponseTimeMs, @Param("maxErrorRatePercent") double maxErrorRatePercent, @Param("description") String description)