Show / Hide Table of Contents

Class FailureThresholdManager<T, T2>

Simple threshold manager, tracks failed jobs and executes callback if budget is exhausted. The callback is executed on every failure reported, as long as the failure budget is not expanded, or failed items removed from the internal collection using the Success method.

Inheritance
object
FailureThresholdManager<T, T2>
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Cognite.Extractor.Common
Assembly: Cognite.Common.dll
Syntax
public class FailureThresholdManager<T, T2> where T : IComparable
Type Parameters
Name Description
T
T2

Constructors

| Edit this page View Source

FailureThresholdManager(double, long, Action<IReadOnlyDictionary<T, T2>>)

Constructor

Declaration
public FailureThresholdManager(double thresholdPercentage, long totalJobCount, Action<IReadOnlyDictionary<T, T2>> callback)
Parameters
Type Name Description
double thresholdPercentage

Threshold for failed jobs, %**,*

long totalJobCount

Total number of jobs

Action<IReadOnlyDictionary<T, T2>> callback

Callback method for when the threshold is exceeded

Properties

| Edit this page View Source

FailedJobs

Get failed jobs

Declaration
public IReadOnlyDictionary<T, T2> FailedJobs { get; }
Property Value
Type Description
IReadOnlyDictionary<T, T2>
| Edit this page View Source

RemainingBudget

Remaining budget for failed jobs

Declaration
public long RemainingBudget { get; }
Property Value
Type Description
long
| Edit this page View Source

ThresholdPercentage

Threshold for failed jobs, %**,*

Declaration
public double ThresholdPercentage { get; }
Property Value
Type Description
double
| Edit this page View Source

TotalJobCount

Total number of jobs

Declaration
public long TotalJobCount { get; }
Property Value
Type Description
long

Methods

| Edit this page View Source

Failed(T, T2)

Adds job to failed items, checks if the failure budget has been exhausted. The value is overwritten in the case the job had previously failed.

Declaration
public void Failed(T job, T2 value)
Parameters
Type Name Description
T job

Job Id

T2 value

Custom value for the failed job

| Edit this page View Source

Success(T)

Removes job from failed items. This method does not check the threshold, no callback will happen.

Declaration
public bool Success(T job)
Parameters
Type Name Description
T job

Job Id

Returns
Type Description
bool

Removal operation success status

| Edit this page View Source

UpdateBudget(double, long, bool)

Updates parameters for calculating the failure budget

Declaration
public void UpdateBudget(double thresholdPercentage, long totalJobCount, bool validate = true)
Parameters
Type Name Description
double thresholdPercentage

Threshold for failed jobs, %**,*

long totalJobCount

Total number of jobs

bool validate

Check if the updated failure budget is already exhausted

Extension Methods

DataModelUtils.GetOrCreateResourcesAsync<T, T2>(T2, IEnumerable<InstanceIdentifier>, Func<IEnumerable<InstanceIdentifier>, IEnumerable<SourcedNodeWrite<T>>>, Func<IEnumerable<SourcedNodeWrite<T>>, SanitationMode, (IEnumerable<SourcedNodeWrite<T>>, IEnumerable<CogniteError<SourcedNodeWrite<T>>>)>, int, int, RetryMode, SanitationMode, CancellationToken)
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX