@@ -153,7 +153,6 @@ void closeClient() throws IOException {
153153 }
154154 }
155155
156- // --- Index Initialization ---
157156
158157 @ Test
159158 @ DisabledIf (value = "isES6" , disabledReason = "TSDB is not supported for ES 6" )
@@ -169,7 +168,6 @@ void testInstantiateSinkTsdbDefault() throws IOException {
169168 final Response response = client .performRequest (request );
170169 assertThat (response .getStatusLine ().getStatusCode (), equalTo (SC_OK ));
171170
172- // Query mappings via alias (TSDB uses NoIsmPolicyManagement so index name may not follow -000001 pattern)
173171 final String extraURI = DeclaredOpenSearchVersion .OPENDISTRO_0_10 .compareTo (
174172 OpenSearchIntegrationHelper .getVersion ()) >= 0 ? INCLUDE_TYPE_NAME_FALSE_URI : "" ;
175173 final Request mappingRequest = new Request (HttpMethod .GET , indexAlias + "/_mappings" + extraURI );
@@ -182,19 +180,15 @@ void testInstantiateSinkTsdbDefault() throws IOException {
182180 final Map <String , Object > mappings = (Map <String , Object >) ((Map <String , Object >) mappingResult .get (actualIndex )).get ("mappings" );
183181 assertThat (mappings , notNullValue ());
184182
185- // Verify TSDB-specific mapping fields
186183 @ SuppressWarnings ("unchecked" )
187184 final Map <String , Object > properties = (Map <String , Object >) mappings .get ("properties" );
188185 assertThat (properties , notNullValue ());
189186 assertThat (properties .containsKey ("labels" ), equalTo (true ));
190187 assertThat (properties .containsKey ("timestamp" ), equalTo (true ));
191188 assertThat (properties .containsKey ("value" ), equalTo (true ));
192189
193- // TSDB uses NoIsmPolicyManagement — no ISM policy should be attached
194- // (unlike metric-analytics which has ISM)
195190 }
196191
197- // --- Gauge Output ---
198192
199193 @ Test
200194 @ DisabledIf (value = "isES6" , disabledReason = "TSDB is not supported for ES 6" )
@@ -222,15 +216,13 @@ void testOutputGauge() throws IOException, InterruptedException {
222216 assertThat (((Number ) doc .get ("value" )).doubleValue (), closeTo (72.5 , 0.001 ));
223217 assertThat (doc .get ("timestamp" ), notNullValue ());
224218
225- // Verify metrics
226219 final List <Measurement > bulkRequestErrors = MetricsTestUtil .getMeasurementList (
227220 new StringJoiner (MetricNames .DELIMITER ).add (PIPELINE_NAME ).add (PLUGIN_NAME )
228221 .add (OpenSearchSink .BULKREQUEST_ERRORS ).toString ());
229222 assertThat (bulkRequestErrors .size (), equalTo (1 ));
230223 Assert .assertEquals (0.0 , bulkRequestErrors .get (0 ).getValue (), 0 );
231224 }
232225
233- // --- Sum (Counter) Output ---
234226
235227 @ Test
236228 @ DisabledIf (value = "isES6" , disabledReason = "TSDB is not supported for ES 6" )
@@ -255,19 +247,16 @@ void testOutputMonotonicSum() throws IOException, InterruptedException {
255247 assertThat (sources , hasSize (1 ));
256248
257249 final Map <String , Object > doc = sources .get (0 );
258- // Monotonic sum should have _total suffix
259250 assertThat (doc .get ("labels" ), equalTo ("__name__ http_requests_total method GET" ));
260251 assertThat (((Number ) doc .get ("value" )).doubleValue (), closeTo (100.0 , 0.001 ));
261252
262- // Verify metrics
263253 final List <Measurement > bulkRequestErrors = MetricsTestUtil .getMeasurementList (
264254 new StringJoiner (MetricNames .DELIMITER ).add (PIPELINE_NAME ).add (PLUGIN_NAME )
265255 .add (OpenSearchSink .BULKREQUEST_ERRORS ).toString ());
266256 assertThat (bulkRequestErrors .size (), equalTo (1 ));
267257 Assert .assertEquals (0.0 , bulkRequestErrors .get (0 ).getValue (), 0 );
268258 }
269259
270- // --- Histogram Expansion ---
271260
272261 @ Test
273262 @ DisabledIf (value = "isES6" , disabledReason = "TSDB is not supported for ES 6" )
@@ -291,20 +280,16 @@ void testOutputHistogramExpansion() throws IOException, InterruptedException {
291280
292281 final String indexAlias = IndexConstants .TYPE_TO_DEFAULT_ALIAS .get (IndexType .TSDB );
293282 final List <Map <String , Object >> sources = getSearchResponseDocSources (indexAlias );
294- // 4 bucket docs + 1 _count + 1 _sum = 6
295283 assertThat (sources , hasSize (6 ));
296284
297- // Collect labels for verification
298285 final List <String > labels = sources .stream ()
299286 .map (s -> (String ) s .get ("labels" ))
300287 .collect (Collectors .toList ());
301288
302- // Verify bucket docs exist with cumulative counts
303289 assertThat (labels .stream ().filter (l -> l .contains ("request_duration_bucket" )).count (), equalTo (4L ));
304290 assertThat (labels .stream ().filter (l -> l .contains ("request_duration_count" )).count (), equalTo (1L ));
305291 assertThat (labels .stream ().filter (l -> l .contains ("request_duration_sum" )).count (), equalTo (1L ));
306292
307- // Verify cumulative bucket values
308293 final Map <String , Double > labelToValue = sources .stream ()
309294 .collect (Collectors .toMap (s -> (String ) s .get ("labels" ), s -> ((Number ) s .get ("value" )).doubleValue ()));
310295
@@ -315,22 +300,19 @@ void testOutputHistogramExpansion() throws IOException, InterruptedException {
315300 assertThat (labelToValue .get ("__name__ request_duration_count method GET" ), closeTo (20.0 , 0.001 ));
316301 assertThat (labelToValue .get ("__name__ request_duration_sum method GET" ), closeTo (5.5 , 0.001 ));
317302
318- // Verify document success count matches expanded document count
319303 final List <Measurement > documentsSuccess = MetricsTestUtil .getMeasurementList (
320304 new StringJoiner (MetricNames .DELIMITER ).add (PIPELINE_NAME ).add (PLUGIN_NAME )
321305 .add (BulkRetryStrategy .DOCUMENTS_SUCCESS ).toString ());
322306 assertThat (documentsSuccess .size (), equalTo (1 ));
323307 assertThat (documentsSuccess .get (0 ).getValue (), closeTo (6.0 , 0 ));
324308
325- // Verify no errors
326309 final List <Measurement > bulkRequestErrors = MetricsTestUtil .getMeasurementList (
327310 new StringJoiner (MetricNames .DELIMITER ).add (PIPELINE_NAME ).add (PLUGIN_NAME )
328311 .add (OpenSearchSink .BULKREQUEST_ERRORS ).toString ());
329312 assertThat (bulkRequestErrors .size (), equalTo (1 ));
330313 Assert .assertEquals (0.0 , bulkRequestErrors .get (0 ).getValue (), 0 );
331314 }
332315
333- // --- Summary Expansion ---
334316
335317 @ Test
336318 @ DisabledIf (value = "isES6" , disabledReason = "TSDB is not supported for ES 6" )
@@ -358,7 +340,6 @@ void testOutputSummaryExpansion() throws IOException, InterruptedException {
358340
359341 final String indexAlias = IndexConstants .TYPE_TO_DEFAULT_ALIAS .get (IndexType .TSDB );
360342 final List <Map <String , Object >> sources = getSearchResponseDocSources (indexAlias );
361- // 2 quantile docs + 1 _count + 1 _sum = 4
362343 assertThat (sources , hasSize (4 ));
363344
364345 final Map <String , Double > labelToValue = sources .stream ()
@@ -369,15 +350,13 @@ void testOutputSummaryExpansion() throws IOException, InterruptedException {
369350 assertThat (labelToValue .get ("__name__ rpc_latency_count service api" ), closeTo (1000.0 , 0.001 ));
370351 assertThat (labelToValue .get ("__name__ rpc_latency_sum service api" ), closeTo (300.5 , 0.001 ));
371352
372- // Verify metrics
373353 final List <Measurement > bulkRequestErrors = MetricsTestUtil .getMeasurementList (
374354 new StringJoiner (MetricNames .DELIMITER ).add (PIPELINE_NAME ).add (PLUGIN_NAME )
375355 .add (OpenSearchSink .BULKREQUEST_ERRORS ).toString ());
376356 assertThat (bulkRequestErrors .size (), equalTo (1 ));
377357 Assert .assertEquals (0.0 , bulkRequestErrors .get (0 ).getValue (), 0 );
378358 }
379359
380- // --- Multiple Metrics in Single Batch ---
381360
382361 @ Test
383362 @ DisabledIf (value = "isES6" , disabledReason = "TSDB is not supported for ES 6" )
@@ -408,18 +387,15 @@ void testOutputMixedMetricTypes() throws IOException, InterruptedException {
408387
409388 final String indexAlias = IndexConstants .TYPE_TO_DEFAULT_ALIAS .get (IndexType .TSDB );
410389 final List <Map <String , Object >> sources = getSearchResponseDocSources (indexAlias );
411- // 1 gauge + 1 sum = 2 documents
412390 assertThat (sources , hasSize (2 ));
413391
414- // Verify metrics
415392 final List <Measurement > bulkRequestErrors = MetricsTestUtil .getMeasurementList (
416393 new StringJoiner (MetricNames .DELIMITER ).add (PIPELINE_NAME ).add (PLUGIN_NAME )
417394 .add (OpenSearchSink .BULKREQUEST_ERRORS ).toString ());
418395 assertThat (bulkRequestErrors .size (), equalTo (1 ));
419396 Assert .assertEquals (0.0 , bulkRequestErrors .get (0 ).getValue (), 0 );
420397 }
421398
422- // --- Re-instantiation (no duplicate index) ---
423399
424400 @ Test
425401 @ DisabledIf (value = "isES6" , disabledReason = "TSDB is not supported for ES 6" )
@@ -433,15 +409,13 @@ void testReinstantiateSinkDoesNotCreateDuplicateIndex() throws IOException {
433409 Response response = client .performRequest (request );
434410 assertThat (response .getStatusLine ().getStatusCode (), equalTo (SC_OK ));
435411
436- // Reinstantiate sink — should not fail
437412 createObjectUnderTest (config , true );
438413
439414 request = new Request (HttpMethod .HEAD , indexAlias );
440415 response = client .performRequest (request );
441416 assertThat (response .getStatusLine ().getStatusCode (), equalTo (SC_OK ));
442417 }
443418
444- // --- Helper methods ---
445419
446420 private OpenSearchSink createObjectUnderTest (final OpenSearchSinkConfig openSearchSinkConfig , final boolean doInitialize ) {
447421 final SinkContext sinkContext = mock (SinkContext .class );
0 commit comments