Skip to content

Commit

Permalink
W-13680300: fix empty response
Browse files Browse the repository at this point in the history
  • Loading branch information
pmoineausf committed Sep 8, 2023
1 parent 09fa531 commit 7f16783
Showing 1 changed file with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,27 +164,32 @@ else if ( protobuf )
for ( Series series : seriesList )
{

MetricsResponse.Series.Builder metricsSeriesBuilder = MetricsResponse.Series.newBuilder()
.setName( series.name ).setStart( (int) series.start ).setEnd( (int) series.end );
boolean valuesAdded = false;
MetricsResponse.Series.Builder metricsSeriesBuilder =
MetricsResponse.Series.newBuilder().setName( series.name ).setStart( (int) series.start )
.setEnd( (int) series.end ).setStep( (int) series.step );
for ( Double value : series.values )
{
LOG.info( String.format( "carbonapi request: found value [%s]",
( value == null ? "null" : (double) value ) ) );
if ( value != null )
{
metricsSeriesBuilder =
metricsSeriesBuilder.setStep( (int) series.step ).addValues( value ).addIsAbsent( false );
valuesAdded = true;
metricsSeriesBuilder = metricsSeriesBuilder.addValues( value ).addIsAbsent( false );
}
}

MetricsResponse.Series metricsSeries = metricsSeriesBuilder.build();
metricsSeriesList.add( metricsSeries );
if ( valuesAdded )
{
MetricsResponse.Series metricsSeries = metricsSeriesBuilder.build();
metricsSeriesList.add( metricsSeries );
}
}

MetricsResponse.SeriesList response =
MetricsResponse.SeriesList.newBuilder().addAllSeriesList( metricsSeriesList ).build();

LOG.info( "carbonapi request: done formatting response " + response);
LOG.info( "carbonapi request: done formatting response " + response );

try
{
Expand Down

0 comments on commit 7f16783

Please sign in to comment.