Interface BuildDataStorage

  • All Known Implementing Classes:
    BuildDataStorageImpl

    public interface BuildDataStorage
    Storage for build statistic values.
    • Method Detail

      • getAvailableMetricsForBuildType

        @NotNull
        List<String> getAvailableMetricsForBuildType​(@NotNull
                                                     String buildTypeExternalId)
        Returns collection of available value type keys for specified build configuration
        Parameters:
        buildTypeExternalId - external id of build configuration
        Returns:
        see above
      • getDataSet

        @NotNull
        List<BuildValue> getDataSet​(@NotNull
                                    String valueTypeKey,
                                    @NotNull
                                    BuildChartSettings chartSettings,
                                    @Nullable
                                    BuildValueTransformer buildValueTransformer)
        Retrieve sorted list of values for given metric, filtered according to given settings. There will be BuildValue object for each build, even if there is no metric value for the given build.
        Parameters:
        valueTypeKey - metric key
        chartSettings - build chart settings
        buildValueTransformer - optional transformer to be applied to each value
        Returns:
        list of metric values combined with its build data
      • getData

        @Nullable
        BuildValue getData​(@NotNull
                           String valueTypeKey,
                           @Nullable
                           BuildValueTransformer buildValueTransformer,
                           @NotNull
                           SBuild build)
        Get individual statistic value for given value type and build (finished or running)
        Parameters:
        valueTypeKey - metric key
        buildValueTransformer - optional transformer to be applied to the value
        build - finished or running build
        Returns:
        metric value for given parameters, null if not available
        Since:
        8.0
      • getAgents

        @NotNull
        SortedSet<String> getAgents​(@NotNull
                                    BuildChartSettings chartSettings)
        Returns agents list for given filter settings.
        Parameters:
        chartSettings - build chart settings
        Returns:
        agent names
      • hasDataFor

        @Contract("_, null -> false")
        boolean hasDataFor​(@NotNull
                           String valueTypeKey,
                           @Nullable
                           String externalBuildTypeId)
        Flags whether any data was stored for given metric & buildTypeId pair
        Parameters:
        valueTypeKey - metric key
        externalBuildTypeId - build configuration external identifier
        Returns:
        true if there is some data for given metric and given buildTypeId
      • hasDataFor

        boolean hasDataFor​(@NotNull
                           String valueTypeKey,
                           @NotNull
                           SBuild build)
        Flags whether any data was stored for given metric & build pair
        Parameters:
        valueTypeKey - metric key
        build - build to check
        Returns:
        true if there is some data for given metric and given buildTypeId
      • getValue

        @Nullable
        BigDecimal getValue​(@NotNull
                            String valueTypeKey,
                            @NotNull
                            SBuild build)
        Returns raw statistic value as it is stored in database for a given value type and a build. Note that raw value can differ from one returned by getData(String, BuildValueTransformer, jetbrains.buildServer.serverSide.SBuild) method because of possible transformation applied by BuildValueTransformer.
        Parameters:
        valueTypeKey - metric key
        build - the build
        Returns:
        metric value for given parameters, null if not available
        Since:
        10.0
      • getValues

        @NotNull
        Map<Long,​BigDecimal> getValues​(@NotNull
                                             String valueTypeKey,
                                             @NotNull
                                             Collection<SBuild> builds)
        Retrives statistic values for a set of builds and returns map of build id to statistic value.
        Parameters:
        valueTypeKey -
        builds -
        Returns:
        see above
      • getValueTypeKeys

        @NotNull
        Set<String> getValueTypeKeys​(@NotNull
                                     String prefix)

        Get all available ValueType keys filtering by prefix

        Will return all value types when the prefix is empty. getValueTypeKeys(String, String) should be used if build type is known.

        Parameters:
        prefix - Prefix to search keys. Could be empty.
        Returns:
        Set of all available keys starting with provided prefix.
      • getValueTypeKeys

        @NotNull
        Set<String> getValueTypeKeys​(@NotNull
                                     String prefix,
                                     @NotNull
                                     String buildTypeExternalId)

        Get all available ValueType keys for a build configuration filtering by prefix

        Parameters:
        prefix - Prefix to search keys. Could be empty.
        buildTypeExternalId - external ID of a build type
        Returns:
        Set of all available keys starting with provided prefix.
      • getValues

        @NotNull
        Map<String,​BigDecimal> getValues​(@NotNull
                                               SBuild build)
        All raw values for a given build. Key of the map is value type key and value is statistic value.
        Since:
        8.0
      • getValues

        @NotNull
        Map<String,​BigDecimal> getValues​(@NotNull
                                               BuildPromotion buildPromotion)
        All raw values for a given build promotion. Key of the map is value type key and value is statistic value.
        Since:
        2023.03
      • publishValue

        void publishValue​(@NotNull
                          String valueTypeKey,
                          long promotionId,
                          @NotNull
                          BigDecimal value)
        Store single build statistic value for a build with specified id
        Parameters:
        valueTypeKey - statistic value key
        promotionId - id of the build promotion (same as build ID)
        value - value
      • publishValues

        void publishValues​(long promotionId,
                           @NotNull
                           Map<String,​BigDecimal> statValues)
        Publishes several values at once.
        Parameters:
        promotionId - id of the build promotion (same as build ID)
        statValues - map of statistic values to publish
        Since:
        2020.1
      • publishValuesNoEvents

        void publishValuesNoEvents​(@NotNull
                                   Map<Long,​Map<String,​BigDecimal>> promoId2statisticValues)
        Publishes several statistic values at once for multiple promotions, but without sending events.
        Parameters:
        promoId2statisticValues - map of statistic values to publish
        Since:
        2023.3
      • deleteValues

        void deleteValues​(long promotionId,
                          Collection<String> valueTypeKeys)
        Delete published statistic values with the specified keys for the given promotion
        Parameters:
        promotionId - id of the build promotion
        valueTypeKeys - collection of the keys to be removed from the DB
        Since:
        2023.03