Skip to content

Commit

Permalink
feat: configure extra headers in metrics request (#1000)
Browse files Browse the repository at this point in the history
  • Loading branch information
malteo authored Feb 28, 2024
1 parent 1ef7897 commit 461c45b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,32 @@

import javax.validation.constraints.NotNull;

@ApiModel( description = "A key/value pair" )
@ApiModel( description = "A name/value pair" )
public class EntryDTO implements DTO
{
@NotNull
private String key;
private String name;

private String value;

public EntryDTO()
{
}

public EntryDTO( String key, String value )
public EntryDTO( String name, String value )
{
this.key = key;
this.name = name;
this.value = value;
}

public String getKey()
public String getName()
{
return key;
return name;
}

public void setKey( String key )
public void setName( String name )
{
this.key = key;
this.name = name;
}

public String getValue()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2090,10 +2090,9 @@ public static class ConfigurationEnvironment implements DTO
@ApiModelProperty( "The minimum date for statistics calculation" )
private Date startStatisticsCalculationFrom = new Date( 0L );

@ApiModelProperty( "The available polling frequencies for metrics" )
@NotNull
@ApiModelProperty( "Send these extra headers to the HTTP request to obtain application metrics" )
@Valid
private List<EntryDTO> metricFrequencyValues;
private List<EntryDTO> metricRequestExtraHeaders = new ArrayList<>();

@ApiModelProperty( "The cloud provider names enabled for this environment" )
private List<String> enabledCloudProviders;
Expand Down Expand Up @@ -2380,14 +2379,19 @@ public void setStartStatisticsCalculationFrom( Date startStatisticsCalculationFr
this.startStatisticsCalculationFrom = startStatisticsCalculationFrom;
}

public List<EntryDTO> getMetricFrequencyValues()
public List<EntryDTO> getMetricRequestExtraHeaders()
{
return metricRequestExtraHeaders;
}

public void setMetricRequestExtraHeaders( List<EntryDTO> metricRequestExtraHeaders )
{
return metricFrequencyValues;
this.metricRequestExtraHeaders = metricRequestExtraHeaders;
}

public void setMetricFrequencyValues( List<EntryDTO> metricFrequencyValues )
public void setMetricRequestExtraHeader( String name, String value )
{
this.metricFrequencyValues = metricFrequencyValues;
this.metricRequestExtraHeaders = List.of( new EntryDTO( name, value ) );
}

public List<String> getEnabledCloudProviders()
Expand Down

0 comments on commit 461c45b

Please sign in to comment.