Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Pydantic model code generator #14779

Merged
merged 2 commits into from
Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,35 +61,14 @@ class Config:
include: Optional[Sequence[str]]


class Counter1(BaseModel):
class Config:
extra = Extra.allow
allow_mutation = False

aggregate: Optional[Union[bool, Literal['only']]]
average: Optional[bool]
metric_name: Optional[str]
name: Optional[str]
type: Optional[str]


class InstanceCounts1(BaseModel):
class Config:
allow_mutation = False

monitored: Optional[str]
total: Optional[str]
unique: Optional[str]


class Metrics(BaseModel):
class Config:
allow_mutation = False

counters: Sequence[Mapping[str, Union[str, Counter1]]]
counters: Sequence[Mapping[str, Union[str, Counter]]]
exclude: Optional[Sequence[str]]
include: Optional[Sequence[str]]
instance_counts: Optional[InstanceCounts1]
instance_counts: Optional[InstanceCounts]
name: str
tag_name: Optional[str]
use_localized_counters: Optional[bool]
Expand Down
25 changes: 2 additions & 23 deletions aspdotnet/datadog_checks/aspdotnet/config_models/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,35 +61,14 @@ class Config:
include: Optional[Sequence[str]]


class Counter1(BaseModel):
class Config:
extra = Extra.allow
allow_mutation = False

aggregate: Optional[Union[bool, Literal['only']]]
average: Optional[bool]
metric_name: Optional[str]
name: Optional[str]
type: Optional[str]


class InstanceCounts1(BaseModel):
class Config:
allow_mutation = False

monitored: Optional[str]
total: Optional[str]
unique: Optional[str]


class Metrics(BaseModel):
class Config:
allow_mutation = False

counters: Sequence[Mapping[str, Union[str, Counter1]]]
counters: Sequence[Mapping[str, Union[str, Counter]]]
exclude: Optional[Sequence[str]]
include: Optional[Sequence[str]]
instance_counts: Optional[InstanceCounts1]
instance_counts: Optional[InstanceCounts]
name: str
tag_name: Optional[str]
use_localized_counters: Optional[bool]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from datadog_checks.dev.tooling.configuration.consumers.model.model_info import ModelInfo
from datadog_checks.dev.tooling.configuration.consumers.openapi_document import build_openapi_document

PYTHON_VERSION = PythonVersion.PY_38
PYTHON_VERSION = PythonVersion.PY_39
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's time to bump this one then right?

requires-python = ">=3.8"


VALIDATORS_DOCUMENTATION = '''# Here you can include additional config validators or transformers
#
Expand Down
2 changes: 1 addition & 1 deletion datadog_checks_dev/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ cli = [
"click~=8.1",
"codespell",
"colorama",
"datamodel-code-generator~=0.12.0",
"datamodel-code-generator~=0.20.0",
"hatch>=1.5.0",
"in-toto==1.0.1",
"jsonschema",
Expand Down
4 changes: 2 additions & 2 deletions ddev/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ build-backend = "hatchling.build"
name = "ddev"
description = "The Datadog Agent integration developer tool"
readme = "README.md"
requires-python = ">=3.8"
requires-python = ">=3.9"
license = "BSD-3-Clause"
keywords = [
"datadog",
Expand Down Expand Up @@ -95,4 +95,4 @@ ban-relative-imports = "all"

[tool.ruff.per-file-ignores]
#Tests can use assertions and relative imports
"**/tests/**/*" = ["I252"]
"**/tests/**/*" = ["I252"]
25 changes: 2 additions & 23 deletions dotnetclr/datadog_checks/dotnetclr/config_models/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,35 +61,14 @@ class Config:
include: Optional[Sequence[str]]


class Counter1(BaseModel):
class Config:
extra = Extra.allow
allow_mutation = False

aggregate: Optional[Union[bool, Literal['only']]]
average: Optional[bool]
metric_name: Optional[str]
name: Optional[str]
type: Optional[str]


class InstanceCounts1(BaseModel):
class Config:
allow_mutation = False

monitored: Optional[str]
total: Optional[str]
unique: Optional[str]


class Metrics(BaseModel):
class Config:
allow_mutation = False

counters: Sequence[Mapping[str, Union[str, Counter1]]]
counters: Sequence[Mapping[str, Union[str, Counter]]]
exclude: Optional[Sequence[str]]
include: Optional[Sequence[str]]
instance_counts: Optional[InstanceCounts1]
instance_counts: Optional[InstanceCounts]
name: str
tag_name: Optional[str]
use_localized_counters: Optional[bool]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,35 +61,14 @@ class Config:
include: Optional[Sequence[str]]


class Counter1(BaseModel):
class Config:
extra = Extra.allow
allow_mutation = False

aggregate: Optional[Union[bool, Literal['only']]]
average: Optional[bool]
metric_name: Optional[str]
name: Optional[str]
type: Optional[str]


class InstanceCounts1(BaseModel):
class Config:
allow_mutation = False

monitored: Optional[str]
total: Optional[str]
unique: Optional[str]


class Metrics(BaseModel):
class Config:
allow_mutation = False

counters: Sequence[Mapping[str, Union[str, Counter1]]]
counters: Sequence[Mapping[str, Union[str, Counter]]]
exclude: Optional[Sequence[str]]
include: Optional[Sequence[str]]
instance_counts: Optional[InstanceCounts1]
instance_counts: Optional[InstanceCounts]
name: str
tag_name: Optional[str]
use_localized_counters: Optional[bool]
Expand Down
25 changes: 2 additions & 23 deletions hyperv/datadog_checks/hyperv/config_models/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,35 +61,14 @@ class Config:
include: Optional[Sequence[str]]


class Counter1(BaseModel):
class Config:
extra = Extra.allow
allow_mutation = False

aggregate: Optional[Union[bool, Literal['only']]]
average: Optional[bool]
metric_name: Optional[str]
name: Optional[str]
type: Optional[str]


class InstanceCounts1(BaseModel):
class Config:
allow_mutation = False

monitored: Optional[str]
total: Optional[str]
unique: Optional[str]


class Metrics(BaseModel):
class Config:
allow_mutation = False

counters: Sequence[Mapping[str, Union[str, Counter1]]]
counters: Sequence[Mapping[str, Union[str, Counter]]]
exclude: Optional[Sequence[str]]
include: Optional[Sequence[str]]
instance_counts: Optional[InstanceCounts1]
instance_counts: Optional[InstanceCounts]
name: str
tag_name: Optional[str]
use_localized_counters: Optional[bool]
Expand Down
25 changes: 2 additions & 23 deletions iis/datadog_checks/iis/config_models/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,35 +69,14 @@ class Config:
include: Optional[Sequence[str]]


class Counter1(BaseModel):
class Config:
extra = Extra.allow
allow_mutation = False

aggregate: Optional[Union[bool, Literal['only']]]
average: Optional[bool]
metric_name: Optional[str]
name: Optional[str]
type: Optional[str]


class InstanceCounts1(BaseModel):
class Config:
allow_mutation = False

monitored: Optional[str]
total: Optional[str]
unique: Optional[str]


class Metrics(BaseModel):
class Config:
allow_mutation = False

counters: Sequence[Mapping[str, Union[str, Counter1]]]
counters: Sequence[Mapping[str, Union[str, Counter]]]
exclude: Optional[Sequence[str]]
include: Optional[Sequence[str]]
instance_counts: Optional[InstanceCounts1]
instance_counts: Optional[InstanceCounts]
name: str
tag_name: Optional[str]
use_localized_counters: Optional[bool]
Expand Down
60 changes: 46 additions & 14 deletions kubelet/assets/configuration/spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,54 @@ files:
description: |
1.7.6+ clusters expose container metrics in the prometheus format.
This is the default setting. See next section for legacy clusters.

URL of the cadvisor metrics prometheus endpoint.
Pass an empty string, or set the cadvisor_port option to disable cadvisor metrics collection.
example: http://10.8.0.1:10255/metrics/cadvisor
value:
type: string
example: http://10.8.0.1:10255/metrics/cadvisor
- name: kubelet_metrics_endpoint
description: |
URL of the kubelet metrics prometheus endpoint
Pass an empty string to disable kubelet metrics collection.
example: http://10.8.0.1:10255/metrics
value:
type: string
example: http://10.8.0.1:10255/metrics
- name: probes_metrics_endpoint
description: |
URL of the probe metrics prometheus endpoint
Pass an empty string to disable probe metrics collection.
example: http://10.8.0.1:10255/metrics/probes
value:
type: string
example: http://10.8.0.1:10255/metrics/probes
- name: cadvisor_port
description: |
Metric collection for legacy (< 1.7.6) clusters via the kubelet's cadvisor port.
This port is closed by default on k8s 1.7+ and OpenShift, enable it
via the `--cadvisor-port=4194` kubelet option.

Port to connect to, uncomment and set accordingly to enable collection.
example: 4194
value:
type: integer
example: 4194
- name: enabled_rates
description: |
Allow list of rate type metrics to collect from cadvisor.
example:
value:
type: array
items:
type: string
example:
- cpu.*
- network.*
- name: enabled_gauges
description: |
Allow list of gauge type metrics to collect from cadvisor.
example:
value:
type: array
items:
type: string
example:
- filesystem.*
- template: instances/openmetrics_legacy
overrides:
Expand Down Expand Up @@ -71,38 +87,54 @@ files:
description: |
1.7.6+ clusters expose container metrics in the prometheus format.
This is the default setting. See next section for legacy clusters.

URL of the cadvisor metrics prometheus endpoint.
Pass an empty string, or set the cadvisor_port option to disable cadvisor metrics collection.
example: http://10.8.0.1:10255/metrics/cadvisor
value:
type: string
example: http://10.8.0.1:10255/metrics/cadvisor
- name: kubelet_metrics_endpoint
description: |
URL of the kubelet metrics prometheus endpoint
Pass an empty string to disable kubelet metrics collection.
example: http://10.8.0.1:10255/metrics
value:
type: string
example: http://10.8.0.1:10255/metrics
- name: probes_metrics_endpoint
description: |
URL of the probe metrics prometheus endpoint
Pass an empty string to disable probe metrics collection.
example: http://10.8.0.1:10255/metrics/probes
value:
type: string
example: http://10.8.0.1:10255/metrics/probes
- name: cadvisor_port
description: |
Metric collection for legacy (< 1.7.6) clusters via the kubelet's cadvisor port.
This port is closed by default on k8s 1.7+ and OpenShift, enable it
via the `--cadvisor-port=4194` kubelet option.

Port to connect to, uncomment and set accordingly to enable collection.
example: 4194
value:
type: integer
example: 4194
- name: enabled_rates
description: |
Allow list of rate type metrics to collect from cadvisor.
example:
value:
type: array
items:
type: string
example:
- cpu.*
- network.*
- name: enabled_gauges
description: |
Allow list of gauge type metrics to collect from cadvisor.
example:
value:
type: array
items:
type: string
example:
- filesystem.*
- template: instances/openmetrics_legacy
overrides:
Expand Down
Loading
Loading