Skip to content

Commit

Permalink
Add runtime configuration validation (#8926)
Browse files Browse the repository at this point in the history
* Sync config models

* re-sync

* re-sync

* fix

* fix
  • Loading branch information
ofek authored Nov 12, 2021
1 parent 10cfda7 commit 3276221
Show file tree
Hide file tree
Showing 7 changed files with 478 additions and 6 deletions.
3 changes: 3 additions & 0 deletions hazelcast/assets/configuration/spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ files:
options:
- template: init_config/jmx
overrides:
is_jmx.required: false
is_jmx.value.example: false
- template: init_config/http
- template: instances
Expand All @@ -29,8 +30,10 @@ files:
In Transition: WARNING
- template: instances/jmx
overrides:
host.required: false
host.display_priority: 10
host.description: Hazelcast or Hazelcast Management Center server with which to connect.
port.required: false
port.display_priority: 9
port.description: Hazelcast or Hazelcast Management Center port with which to connect.
port.value.example: 1099
Expand Down
18 changes: 18 additions & 0 deletions hazelcast/datadog_checks/hazelcast/config_models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# (C) Datadog, Inc. 2021-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from .instance import InstanceConfig
from .shared import SharedConfig


class ConfigMixin:
_config_model_instance: InstanceConfig
_config_model_shared: SharedConfig

@property
def config(self) -> InstanceConfig:
return self._config_model_instance

@property
def shared_config(self) -> SharedConfig:
return self._config_model_shared
272 changes: 272 additions & 0 deletions hazelcast/datadog_checks/hazelcast/config_models/defaults.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,272 @@
# (C) Datadog, Inc. 2021-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from datadog_checks.base.utils.models.fields import get_default_field_value


def shared_collect_default_metrics(field, value):
return False


def shared_conf(field, value):
return get_default_field_value(field, value)


def shared_is_jmx(field, value):
return False


def shared_new_gc_metrics(field, value):
return False


def shared_proxy(field, value):
return get_default_field_value(field, value)


def shared_service(field, value):
return get_default_field_value(field, value)


def shared_service_check_prefix(field, value):
return get_default_field_value(field, value)


def shared_skip_proxy(field, value):
return False


def shared_timeout(field, value):
return 10


def instance_allow_redirects(field, value):
return True


def instance_auth_token(field, value):
return get_default_field_value(field, value)


def instance_auth_type(field, value):
return 'basic'


def instance_aws_host(field, value):
return get_default_field_value(field, value)


def instance_aws_region(field, value):
return get_default_field_value(field, value)


def instance_aws_service(field, value):
return get_default_field_value(field, value)


def instance_collect_default_jvm_metrics(field, value):
return True


def instance_connect_timeout(field, value):
return get_default_field_value(field, value)


def instance_disable_generic_tags(field, value):
return False


def instance_empty_default_hostname(field, value):
return False


def instance_extra_headers(field, value):
return get_default_field_value(field, value)


def instance_headers(field, value):
return get_default_field_value(field, value)


def instance_host(field, value):
return get_default_field_value(field, value)


def instance_is_jmx(field, value):
return False


def instance_java_bin_path(field, value):
return get_default_field_value(field, value)


def instance_java_options(field, value):
return get_default_field_value(field, value)


def instance_jmx_url(field, value):
return get_default_field_value(field, value)


def instance_kerberos_auth(field, value):
return 'disabled'


def instance_kerberos_cache(field, value):
return get_default_field_value(field, value)


def instance_kerberos_delegate(field, value):
return False


def instance_kerberos_force_initiate(field, value):
return False


def instance_kerberos_hostname(field, value):
return get_default_field_value(field, value)


def instance_kerberos_keytab(field, value):
return get_default_field_value(field, value)


def instance_kerberos_principal(field, value):
return get_default_field_value(field, value)


def instance_key_store_password(field, value):
return get_default_field_value(field, value)


def instance_key_store_path(field, value):
return get_default_field_value(field, value)


def instance_log_requests(field, value):
return False


def instance_mc_cluster_states(field, value):
return get_default_field_value(field, value)


def instance_mc_health_check_endpoint(field, value):
return get_default_field_value(field, value)


def instance_min_collection_interval(field, value):
return 15


def instance_name(field, value):
return get_default_field_value(field, value)


def instance_ntlm_domain(field, value):
return get_default_field_value(field, value)


def instance_password(field, value):
return get_default_field_value(field, value)


def instance_persist_connections(field, value):
return False


def instance_port(field, value):
return 1099


def instance_process_name_regex(field, value):
return get_default_field_value(field, value)


def instance_proxy(field, value):
return get_default_field_value(field, value)


def instance_read_timeout(field, value):
return get_default_field_value(field, value)


def instance_request_size(field, value):
return 16


def instance_rmi_client_timeout(field, value):
return 15000


def instance_rmi_connection_timeout(field, value):
return 20000


def instance_rmi_registry_ssl(field, value):
return False


def instance_service(field, value):
return get_default_field_value(field, value)


def instance_skip_proxy(field, value):
return False


def instance_tags(field, value):
return get_default_field_value(field, value)


def instance_timeout(field, value):
return 10


def instance_tls_ca_cert(field, value):
return get_default_field_value(field, value)


def instance_tls_cert(field, value):
return get_default_field_value(field, value)


def instance_tls_ignore_warning(field, value):
return False


def instance_tls_private_key(field, value):
return get_default_field_value(field, value)


def instance_tls_use_host_header(field, value):
return False


def instance_tls_verify(field, value):
return True


def instance_tools_jar_path(field, value):
return get_default_field_value(field, value)


def instance_trust_store_password(field, value):
return get_default_field_value(field, value)


def instance_trust_store_path(field, value):
return get_default_field_value(field, value)


def instance_use_legacy_auth_encoding(field, value):
return True


def instance_user(field, value):
return get_default_field_value(field, value)


def instance_username(field, value):
return get_default_field_value(field, value)
Loading

0 comments on commit 3276221

Please sign in to comment.