Interface BuildDataStorage
-
- All Known Implementing Classes:
BuildDataStorageImpl
public interface BuildDataStorage
Storage for build statistic values.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
deleteValues(long promotionId, Collection<String> valueTypeKeys)
Delete published statistic values with the specified keys for the given promotionSortedSet<String>
getAgents(BuildChartSettings chartSettings)
Returns agents list for given filter settings.List<String>
getAvailableMetricsForBuildType(String buildTypeExternalId)
Returns collection of available value type keys for specified build configurationBuildValue
getData(String valueTypeKey, BuildValueTransformer buildValueTransformer, long finishedBuildId, String externalBuildTypeId)
Deprecated.BuildValue
getData(String valueTypeKey, BuildValueTransformer buildValueTransformer, SBuild build)
Get individual statistic value for given value type and build (finished or running)List<BuildValue>
getDataSet(String valueTypeKey, BuildChartSettings chartSettings, BuildValueTransformer buildValueTransformer)
Retrieve sorted list of values for given metric, filtered according to given settings.BigDecimal
getValue(String valueTypeKey, long buildId)
Same asgetValue(String, SBuild)
.BigDecimal
getValue(String valueTypeKey, SBuild build)
Returns raw statistic value as it is stored in database for a given value type and a build.Map<Long,BigDecimal>
getValues(String valueTypeKey, Collection<SBuild> builds)
Retrives statistic values for a set of builds and returns map of build id to statistic value.Map<String,BigDecimal>
getValues(BuildPromotion buildPromotion)
All raw values for a given build promotion.Map<String,BigDecimal>
getValues(SBuild build)
All raw values for a given build.Set<String>
getValueTypeKeys(String prefix)
Get all available ValueType keys filtering by prefixSet<String>
getValueTypeKeys(String prefix, String buildTypeExternalId)
Get all available ValueType keys for a build configuration filtering by prefixboolean
hasDataFor(String valueTypeKey, String externalBuildTypeId)
Flags whether any data was stored for given metric & buildTypeId pairboolean
hasDataFor(String valueTypeKey, SBuild build)
Flags whether any data was stored for given metric & build pairvoid
publishValue(String valueTypeKey, long promotionId, BigDecimal value)
Store single build statistic value for a build with specified idvoid
publishValues(long promotionId, Map<String,BigDecimal> statValues)
Publishes several values at once.void
publishValuesNoEvents(Map<Long,Map<String,BigDecimal>> promoId2statisticValues)
Publishes several statistic values at once for multiple promotions, but without sending events.
-
-
-
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 keychartSettings
- build chart settingsbuildValueTransformer
- optional transformer to be applied to each value- Returns:
- list of metric values combined with its build data
-
getData
@Deprecated @Nullable BuildValue getData(@NotNull String valueTypeKey, @Nullable BuildValueTransformer buildValueTransformer, long finishedBuildId, @Nullable String externalBuildTypeId)
Deprecated.Get individual statistic value for given value type and finished build- Parameters:
valueTypeKey
- metric keybuildValueTransformer
- optional transformer to be applied to the valuefinishedBuildId
- identifier of the finished buildexternalBuildTypeId
- external identifier of the build configuration- Returns:
- metric value for given parameters, null if not available
-
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 keybuildValueTransformer
- optional transformer to be applied to the valuebuild
- 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 keyexternalBuildTypeId
- 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 keybuild
- 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 bygetData(String, BuildValueTransformer, jetbrains.buildServer.serverSide.SBuild)
method because of possible transformation applied by BuildValueTransformer.- Parameters:
valueTypeKey
- metric keybuild
- 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
-
getValue
@Nullable BigDecimal getValue(@NotNull String valueTypeKey, long buildId)
Same asgetValue(String, SBuild)
. Since 10.0 returns statistics only for not yet cleaned builds.
-
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 keypromotionId
- 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 promotionvalueTypeKeys
- collection of the keys to be removed from the DB- Since:
- 2023.03
-
-