Skip to content

Commit

Permalink
Fix collect_aggregates_only option type (#9473)
Browse files Browse the repository at this point in the history
* Fix collect_aggregates_only option type

* Use anyOf

* Sync spec and models

* Sync models
  • Loading branch information
coignetp authored and ofek committed Jun 7, 2021
1 parent 57a4b0a commit d356312
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion haproxy/assets/configuration/spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ files:
NOTE: This only takes effect when `use_prometheus` is set to `false`.
- name: collect_aggregates_only
value:
anyOf:
- type: boolean
- type: string
example: true
type: boolean
description: |
This parameter instructs the check to collect metrics only from the aggregate frontend/backend
status lines from the stats output instead of for each backend. With this parameter set to false the agent
Expand Down
2 changes: 1 addition & 1 deletion haproxy/datadog_checks/haproxy/config_models/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def instance_collate_status_tags_per_host(field, value):


def instance_collect_aggregates_only(field, value):
return True
return get_default_field_value(field, value)


def instance_collect_status_metrics(field, value):
Expand Down
2 changes: 1 addition & 1 deletion haproxy/datadog_checks/haproxy/config_models/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class Config:
bearer_token_auth: Optional[bool]
bearer_token_path: Optional[str]
collate_status_tags_per_host: Optional[bool]
collect_aggregates_only: Optional[bool]
collect_aggregates_only: Optional[Union[bool, str]]
collect_status_metrics: Optional[bool]
collect_status_metrics_by_host: Optional[bool]
connect_timeout: Optional[float]
Expand Down
2 changes: 1 addition & 1 deletion haproxy/datadog_checks/haproxy/data/conf.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ instances:
#
# status_check: false

## @param collect_aggregates_only - boolean - optional - default: true
## @param collect_aggregates_only - boolean or string - optional - default: true
## This parameter instructs the check to collect metrics only from the aggregate frontend/backend
## status lines from the stats output instead of for each backend. With this parameter set to false the agent
## collects data for each backend but ignores the aggregated data for backends. Because some metrics are only
Expand Down

0 comments on commit d356312

Please sign in to comment.