Skip to content

Commit a8b4eed

Browse files
authored
fix(yaml-specs): fix bad indent in prometheus spec (DataDog#21584)
* fix(json-specs): fix bad indent in prometheus spec * fix(json-specs): regenerate instances * fix(json-specs): add changelogs
1 parent 6a0d616 commit a8b4eed

5 files changed

Lines changed: 65 additions & 37 deletions

File tree

prometheus/assets/configuration/spec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,4 +142,4 @@ files:
142142
value:
143143
example: 2000
144144
type: integer
145-
- template: instances/default
145+
- template: instances/default

prometheus/changelog.d/21584.fixed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix support of common instance options and fix indentation of `conf.yaml.example` file.

prometheus/datadog_checks/prometheus/config_models/defaults.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88
# ddev -x validate models -s <INTEGRATION_NAME>
99

1010

11+
def instance_disable_generic_tags():
12+
return False
13+
14+
15+
def instance_empty_default_hostname():
16+
return False
17+
18+
1119
def instance_health_service_check():
1220
return True
1321

@@ -16,6 +24,10 @@ def instance_max_returned_metrics():
1624
return 2000
1725

1826

27+
def instance_min_collection_interval():
28+
return 15
29+
30+
1931
def instance_prometheus_timeout():
2032
return 10
2133

prometheus/datadog_checks/prometheus/config_models/instance.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,28 +37,43 @@ class LabelJoins(BaseModel):
3737
target_metric: Optional[TargetMetric] = None
3838

3939

40+
class MetricPatterns(BaseModel):
41+
model_config = ConfigDict(
42+
arbitrary_types_allowed=True,
43+
frozen=True,
44+
)
45+
exclude: Optional[tuple[str, ...]] = None
46+
include: Optional[tuple[str, ...]] = None
47+
48+
4049
class InstanceConfig(BaseModel):
4150
model_config = ConfigDict(
4251
validate_default=True,
4352
arbitrary_types_allowed=True,
4453
frozen=True,
4554
)
55+
disable_generic_tags: Optional[bool] = None
56+
empty_default_hostname: Optional[bool] = None
4657
exclude_labels: Optional[tuple[str, ...]] = None
4758
health_service_check: Optional[bool] = None
4859
label_joins: Optional[LabelJoins] = None
4960
label_to_hostname: Optional[str] = None
5061
labels_mapper: Optional[MappingProxyType[str, Any]] = None
5162
max_returned_metrics: Optional[int] = None
63+
metric_patterns: Optional[MetricPatterns] = None
5264
metrics: tuple[Union[MappingProxyType[str, str], str], ...]
65+
min_collection_interval: Optional[float] = None
5366
namespace: str
5467
prometheus_metrics_prefix: Optional[str] = None
5568
prometheus_timeout: Optional[int] = None
5669
prometheus_url: str
5770
send_histograms_buckets: Optional[bool] = None
5871
send_monotonic_counter: Optional[bool] = None
72+
service: Optional[str] = None
5973
ssl_ca_cert: Optional[str] = None
6074
ssl_cert: Optional[str] = None
6175
ssl_private_key: Optional[str] = None
76+
tags: Optional[tuple[str, ...]] = None
6277
type_overrides: Optional[MappingProxyType[str, Any]] = None
6378

6479
@model_validator(mode='before')

prometheus/datadog_checks/prometheus/data/conf.yaml.example

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -117,42 +117,42 @@ instances:
117117
#
118118
# max_returned_metrics: 2000
119119

120-
## @param tags - list of strings - optional
121-
## A list of tags to attach to every metric and service check emitted by this instance.
122-
##
123-
## Learn more about tagging at https://docs.datadoghq.com/tagging
124-
#
125-
# tags:
126-
# - <KEY_1>:<VALUE_1>
127-
# - <KEY_2>:<VALUE_2>
128-
129-
## @param service - string - optional
130-
## Attach the tag `service:<SERVICE>` to every metric, event, and service check emitted by this integration.
131-
##
132-
## Overrides any `service` defined in the `init_config` section.
133-
#
134-
# service: <SERVICE>
120+
## @param tags - list of strings - optional
121+
## A list of tags to attach to every metric and service check emitted by this instance.
122+
##
123+
## Learn more about tagging at https://docs.datadoghq.com/tagging
124+
#
125+
# tags:
126+
# - <KEY_1>:<VALUE_1>
127+
# - <KEY_2>:<VALUE_2>
135128

136-
## @param min_collection_interval - number - optional - default: 15
137-
## This changes the collection interval of the check. For more information, see:
138-
## https://docs.datadoghq.com/developers/write_agent_check/#collection-interval
139-
#
140-
# min_collection_interval: 15
129+
## @param service - string - optional
130+
## Attach the tag `service:<SERVICE>` to every metric, event, and service check emitted by this integration.
131+
##
132+
## Overrides any `service` defined in the `init_config` section.
133+
#
134+
# service: <SERVICE>
141135

142-
## @param empty_default_hostname - boolean - optional - default: false
143-
## This forces the check to send metrics with no hostname.
144-
##
145-
## This is useful for cluster-level checks.
146-
#
147-
# empty_default_hostname: false
136+
## @param min_collection_interval - number - optional - default: 15
137+
## This changes the collection interval of the check. For more information, see:
138+
## https://docs.datadoghq.com/developers/write_agent_check/#collection-interval
139+
#
140+
# min_collection_interval: 15
148141

149-
## @param metric_patterns - mapping - optional
150-
## A mapping of metrics to include or exclude, with each entry being a regular expression.
151-
##
152-
## Metrics defined in `exclude` will take precedence in case of overlap.
153-
#
154-
# metric_patterns:
155-
# include:
156-
# - <INCLUDE_REGEX>
157-
# exclude:
158-
# - <EXCLUDE_REGEX>
142+
## @param empty_default_hostname - boolean - optional - default: false
143+
## This forces the check to send metrics with no hostname.
144+
##
145+
## This is useful for cluster-level checks.
146+
#
147+
# empty_default_hostname: false
148+
149+
## @param metric_patterns - mapping - optional
150+
## A mapping of metrics to include or exclude, with each entry being a regular expression.
151+
##
152+
## Metrics defined in `exclude` will take precedence in case of overlap.
153+
#
154+
# metric_patterns:
155+
# include:
156+
# - <INCLUDE_REGEX>
157+
# exclude:
158+
# - <EXCLUDE_REGEX>

0 commit comments

Comments
 (0)