<commit_before># Health Checks

This section is still a work in progress.

[agent/checks](https://github.com/hashicorp/consul/tree/main/agent/checks) contains the logic for
performing active [health checking](https://www.consul.io/docs/agent/checks.html).


## Check Registration flows

There are many paths to register a check. Many of these use different struct
types, so to properly validate and convert a check, all of these paths must
be reviewed and tested.

1. API [/v1/catalog/register](https://www.consul.io/api-docs/catalog#register-entity) - the `Checks`
   field on `structs.RegisterRequest`. The entrypoint is `CatalogRegister` in
   [agent/catalog_endpoint.go].
2. API [/v1/agent/check/register](https://www.consul.io/api-docs/agent/check#register-check) - the entrypoint
   is `AgentRegisterCheck` in [agent/agent_endpoint.go]
3. API [/v1/agent/service/register](https://www.consul.io/api-docs/agent/service#register-service) -
   the `Check` or `Checks` fields on `ServiceDefinition`. The entrypoint is `AgentRegisterService`
   in [agent/agent_endpoint.go].
4. Config [Checks](https://www.consul.io/docs/discovery/checks) - the `Checks` and `Check` fields
   on `config.Config` in [agent/config/config.go].
5. Config [Service.Checks](https://www.consul.io/docs/discovery/services) - the
   `Checks` and `Check` fields on `ServiceDefinition` in [agent/config/config.go].
6. CLI [consul services register](https://www.consul.io/commands/services/register) - the
   `Checks` and `Check` fields on `api.AgentServiceRegistration`. The entrypoint is
   `ServicesFromFiles` in [command/services/config.go].


[agent/catalog_endpoint.go]: https://github.com/hashicorp/consul/blob/main/agent/catalog_endpoint.go
[agent/agent_endpoint.go]: https://github.com/hashicorp/consul/blob/main/agent/agent_endpoint.go
[agent/config/config.go]: https://github.com/hashicorp/consul/blob/main/agent/config/config.go
[command/services/config.go]: https://github.com/hashicorp/consul/blob/main/command/services/config.go<commit_msg>Add 7th check registration flow to docs<commit_after># Health Checks

This section is still a work in progress.

[agent/checks](https://github.com/hashicorp/consul/tree/main/agent/checks) contains the logic for
performing active [health checking](https://www.consul.io/docs/agent/checks.html).


## Check Registration flows

There are many paths to register a check. Many of these use different struct
types, so to properly validate and convert a check, all of these paths must
be reviewed and tested.

1. API [/v1/catalog/register](https://www.consul.io/api-docs/catalog#register-entity) - the `Checks`
   field on `structs.RegisterRequest`. The entrypoint is `CatalogRegister` in
   [agent/catalog_endpoint.go].
2. API [/v1/agent/check/register](https://www.consul.io/api-docs/agent/check#register-check) - the entrypoint
   is `AgentRegisterCheck` in [agent/agent_endpoint.go]
3. API [/v1/agent/service/register](https://www.consul.io/api-docs/agent/service#register-service) -
   the `Check` or `Checks` fields on `ServiceDefinition`. The entrypoint is `AgentRegisterService`
   in [agent/agent_endpoint.go].
4. Config [Checks](https://www.consul.io/docs/discovery/checks) - the `Checks` and `Check` fields
   on `config.Config` in [agent/config/config.go].
5. Config [Service.Checks](https://www.consul.io/docs/discovery/services) - the
   `Checks` and `Check` fields on `ServiceDefinition` in [agent/config/config.go].
6. CLI [consul services register](https://www.consul.io/commands/services/register) - the
   `Checks` and `Check` fields on `api.AgentServiceRegistration`. The entrypoint is
   `ServicesFromFiles` in [command/services/config.go].
7. API [/v1/txn](https://www.consul.io/api-docs/txn) - the `Transaction` API allows for registering a check.


[agent/catalog_endpoint.go]: https://github.com/hashicorp/consul/blob/main/agent/catalog_endpoint.go
[agent/agent_endpoint.go]: https://github.com/hashicorp/consul/blob/main/agent/agent_endpoint.go
[agent/config/config.go]: https://github.com/hashicorp/consul/blob/main/agent/config/config.go
[command/services/config.go]: https://github.com/hashicorp/consul/blob/main/command/services/config.go
{'fraction_non_alphanumeric': 0.14115118223071413, 'fraction_numerical': 0.005015524241700501, 'mean_word_length': 4.636608344549125, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 25, 'lorem ipsum': 0, 'www.': 15, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2964134', 'n_tokens_mistral': 1347, 'n_tokens_neox': 1325, 'n_words': 304}