@@ -466,13 +466,15 @@ private static async Task<HashSet<Identity>> DeleteDataPointsIgnoreErrorsChunk(
466466 /// <param name="chunkSize">Number of timeseries per request</param>
467467 /// <param name="throttleSize">Maximum number of parallel requests</param>
468468 /// <param name="token">Cancellation token</param>
469+ /// <param name="ignoreBadDataPoints">Ignore bad status datapoints, true by default</param>
469470 /// <returns>Dictionary from externalId to last timestamp, only contains existing timeseries</returns>
470471 public static async Task < IDictionary < Identity , DateTime > > GetLatestTimestamps (
471472 this DataPointsResource dataPoints ,
472473 IEnumerable < ( Identity id , DateTime before ) > ids ,
473474 int chunkSize ,
474475 int throttleSize ,
475- CancellationToken token )
476+ CancellationToken token ,
477+ bool ignoreBadDataPoints = true )
476478 {
477479 var ret = new ConcurrentDictionary < Identity , DateTime > ( ) ;
478480 var idSet = new HashSet < Identity > ( ids . Select ( id => id . id ) ) ;
@@ -497,6 +499,7 @@ public static async Task<IDictionary<Identity, DateTime>> GetLatestTimestamps(
497499 {
498500 idt . Before = pair . before . ToUnixTimeMilliseconds ( ) . ToString ( ) ;
499501 }
502+ idt . IgnoreBadDataPoints = ignoreBadDataPoints ;
500503 return idt ;
501504 } )
502505 . ChunkBy ( chunkSize )
@@ -558,21 +561,23 @@ await generators
558561 /// <param name="chunkSize">Number of timeseries per request</param>
559562 /// <param name="throttleSize">Maximum number of parallel requests</param>
560563 /// <param name="token">Cancellation token</param>
564+ /// <param name="ignoreBadDataPoints">Ignore bad status datapoints, true by default</param>
561565 /// <returns>Dictionary from externalId to first timestamp, only contains existing timeseries</returns>
562566 public static async Task < IDictionary < Identity , DateTime > > GetEarliestTimestamps (
563567 this DataPointsResource dataPoints ,
564568 IEnumerable < ( Identity id , DateTime after ) > ids ,
565569 int chunkSize ,
566570 int throttleSize ,
567- CancellationToken token )
571+ CancellationToken token ,
572+ bool ignoreBadDataPoints = true )
568573 {
569574 var ret = new ConcurrentDictionary < Identity , DateTime > ( ) ;
570575 var idSet = new HashSet < Identity > ( ids . Select ( id => id . id ) ) ;
571576
572577 var chunks = ids
573578 . Select ( ( pair ) =>
574579 {
575- var query = new DataPointsQueryItem ( ) ;
580+ var query = new DataPointsQueryItem ( ) { IgnoreBadDataPoints = ignoreBadDataPoints } ;
576581 if ( pair . id . Id . HasValue )
577582 {
578583 query . Id = pair . id . Id . Value ;
@@ -660,6 +665,7 @@ await generators
660665 /// <param name="latest">If true, fetch latest timestamps</param>
661666 /// <param name="earliest">If true, fetch earliest timestamps</param>
662667 /// <param name="token">Cancellation token</param>
668+ /// <param name="ignoreBadDataPoints">Ignore bad status datapoints, true by default</param>
663669 /// <returns></returns>
664670 public static async Task < IDictionary < Identity , TimeRange > > GetExtractedRanges (
665671 this DataPointsResource dataPoints ,
@@ -669,7 +675,8 @@ public static async Task<IDictionary<Identity, TimeRange>> GetExtractedRanges(
669675 int throttleSize ,
670676 bool latest ,
671677 bool earliest ,
672- CancellationToken token )
678+ CancellationToken token ,
679+ bool ignoreBadDataPoints = true )
673680 {
674681 if ( ids == null )
675682 {
@@ -684,12 +691,12 @@ public static async Task<IDictionary<Identity, TimeRange>> GetExtractedRanges(
684691 if ( latest )
685692 {
686693 tasks . Add ( dataPoints . GetLatestTimestamps ( ids . Select ( pair => ( pair . id , pair . limit ? . Last ?? DateTime . MaxValue ) ) ,
687- chunkSizeLatest , throttleSize , token ) ) ;
694+ chunkSizeLatest , throttleSize , token , ignoreBadDataPoints ) ) ;
688695 }
689696 if ( earliest )
690697 {
691698 tasks . Add ( dataPoints . GetEarliestTimestamps ( ids . Select ( pair => ( pair . id , pair . limit ? . First ?? CogniteTime . DateTimeEpoch ) ) ,
692- chunkSizeEarliest , throttleSize , token ) ) ;
699+ chunkSizeEarliest , throttleSize , token , ignoreBadDataPoints ) ) ;
693700 }
694701 var results = await Task . WhenAll ( tasks ) . ConfigureAwait ( false ) ;
695702 if ( latest )
0 commit comments