317brian commented on code in PR #14623: URL: https://github.com/apache/druid/pull/14623#discussion_r1269735656
########## docs/api-reference/retention-rules-api.md: ########## @@ -25,45 +25,464 @@ sidebar_label: Retention rules This document describes the API endpoints for managing retention rules in Apache Druid. -## Retention rules +Druid uses retention rules to determine what data is retained in the cluster. Druid supports load, drop, and broadcast rules. See [using rules to drop and retain data](../operations/rule-configuration.md) for more information. -Note that all _interval_ URL parameters are ISO 8601 strings delimited by a `_` instead of a `/` as in `2016-06-27_2016-06-28`. +In this document, `http://SERVICE_IP:SERVICE_PORT` is a placeholder for the server address of deployment and the service port. For example, on the quickstart configuration, replace `http://ROUTER_IP:ROUTER_PORT` with `http://localhost:8888`. Review Comment: I don't really understand the need for the double placeholder explanation when the router one is already a placeholder? What does it do that the following doesn't? `http://ROUTER_IP:ROUTER_PORT` is a place holder for your Router service address and port. Replace it with the information for your deployment. For example, use `http://localhost:8888` for quickstart deployments. ########## docs/api-reference/retention-rules-api.md: ########## @@ -25,45 +25,464 @@ sidebar_label: Retention rules This document describes the API endpoints for managing retention rules in Apache Druid. -## Retention rules +Druid uses retention rules to determine what data is retained in the cluster. Druid supports load, drop, and broadcast rules. See [using rules to drop and retain data](../operations/rule-configuration.md) for more information. -Note that all _interval_ URL parameters are ISO 8601 strings delimited by a `_` instead of a `/` as in `2016-06-27_2016-06-28`. +In this document, `http://SERVICE_IP:SERVICE_PORT` is a placeholder for the server address of deployment and the service port. For example, on the quickstart configuration, replace `http://ROUTER_IP:ROUTER_PORT` with `http://localhost:8888`. -`GET /druid/coordinator/v1/rules` +## Update retention rules for a datasource -Returns all rules as JSON objects for all datasources in the cluster including the default datasource. +Update one or more retention rules for a datasource. Retention rules can be submitted as an array of rule objects in the request body and overwrite any existing rules for the datasource. Rules are read in the order in which they appear, see [rule structure](../operations/rule-configuration.md) for more information. -`GET /druid/coordinator/v1/rules/{dataSourceName}` +Note that this endpoint returns an `HTTP 200 Success` code message even if the `datasource` does not exist. -Returns all rules for a specified datasource. +### URL +<code class="postAPI">POST</code> `/druid/coordinator/v1/rules/{datasource}` -`GET /druid/coordinator/v1/rules/{dataSourceName}?full` +### Header parameters -Returns all rules for a specified datasource and includes default datasource. +The endpoint supports a set of optional header parameters to populate the `author` and `comment` fields in the `auditInfo` property for audit history. -`GET /druid/coordinator/v1/rules/history?interval=<interval>` +* `X-Druid-Author` (optional) + * Type: String + * A string representing the author making the configuration change. +* `X-Druid-Comment` (optional) + * Type: String + * A string describing the update. -Returns audit history of rules for all datasources. Default value of interval can be specified by setting `druid.audit.manager.auditHistoryMillis` (1 week if not configured) in Coordinator `runtime.properties`. +### Responses -`GET /druid/coordinator/v1/rules/history?count=<n>` +<!--DOCUSAURUS_CODE_TABS--> -Returns last `n` entries of audit history of rules for all datasources. +<!--200 SUCCESS--> +<br/> +*Successfully updated retention rules for specified datasource* -`GET /druid/coordinator/v1/rules/{dataSourceName}/history?interval=<interval>` +<!--END_DOCUSAURUS_CODE_TABS--> -Returns audit history of rules for a specified datasource. Default value of interval can be specified by setting `druid.audit.manager.auditHistoryMillis` (1 week if not configured) in Coordinator `runtime.properties`. +--- + +### Sample request + +The following example updates the retention rules for a datasource with specified ID `kttm1`. Review Comment: Do we actually call it an ID? I thought it was a name? Most of the IDs we talk about in Druid are of the autogenerated sort I think, so it'd be nice to have that consistency unless it is actually called ID. Same q for all the other instnaces of this. ########## docs/api-reference/retention-rules-api.md: ########## @@ -25,45 +25,464 @@ sidebar_label: Retention rules This document describes the API endpoints for managing retention rules in Apache Druid. -## Retention rules +Druid uses retention rules to determine what data is retained in the cluster. Druid supports load, drop, and broadcast rules. See [using rules to drop and retain data](../operations/rule-configuration.md) for more information. -Note that all _interval_ URL parameters are ISO 8601 strings delimited by a `_` instead of a `/` as in `2016-06-27_2016-06-28`. +In this document, `http://SERVICE_IP:SERVICE_PORT` is a placeholder for the server address of deployment and the service port. For example, on the quickstart configuration, replace `http://ROUTER_IP:ROUTER_PORT` with `http://localhost:8888`. -`GET /druid/coordinator/v1/rules` +## Update retention rules for a datasource -Returns all rules as JSON objects for all datasources in the cluster including the default datasource. +Update one or more retention rules for a datasource. Retention rules can be submitted as an array of rule objects in the request body and overwrite any existing rules for the datasource. Rules are read in the order in which they appear, see [rule structure](../operations/rule-configuration.md) for more information. -`GET /druid/coordinator/v1/rules/{dataSourceName}` +Note that this endpoint returns an `HTTP 200 Success` code message even if the `datasource` does not exist. Review Comment: Why is this occurence of datasource in code font? ########## docs/api-reference/retention-rules-api.md: ########## @@ -25,45 +25,464 @@ sidebar_label: Retention rules This document describes the API endpoints for managing retention rules in Apache Druid. Review Comment: Is there a link to this on the rule configuration page? If not, we should add it and maybe a line that says you can configure retention rules from the UI or API. ########## docs/api-reference/retention-rules-api.md: ########## @@ -25,45 +25,464 @@ sidebar_label: Retention rules This document describes the API endpoints for managing retention rules in Apache Druid. -## Retention rules +Druid uses retention rules to determine what data is retained in the cluster. Druid supports load, drop, and broadcast rules. See [using rules to drop and retain data](../operations/rule-configuration.md) for more information. -Note that all _interval_ URL parameters are ISO 8601 strings delimited by a `_` instead of a `/` as in `2016-06-27_2016-06-28`. +In this document, `http://SERVICE_IP:SERVICE_PORT` is a placeholder for the server address of deployment and the service port. For example, on the quickstart configuration, replace `http://ROUTER_IP:ROUTER_PORT` with `http://localhost:8888`. -`GET /druid/coordinator/v1/rules` +## Update retention rules for a datasource -Returns all rules as JSON objects for all datasources in the cluster including the default datasource. +Update one or more retention rules for a datasource. Retention rules can be submitted as an array of rule objects in the request body and overwrite any existing rules for the datasource. Rules are read in the order in which they appear, see [rule structure](../operations/rule-configuration.md) for more information. -`GET /druid/coordinator/v1/rules/{dataSourceName}` +Note that this endpoint returns an `HTTP 200 Success` code message even if the `datasource` does not exist. -Returns all rules for a specified datasource. +### URL +<code class="postAPI">POST</code> `/druid/coordinator/v1/rules/{datasource}` -`GET /druid/coordinator/v1/rules/{dataSourceName}?full` +### Header parameters -Returns all rules for a specified datasource and includes default datasource. +The endpoint supports a set of optional header parameters to populate the `author` and `comment` fields in the `auditInfo` property for audit history. -`GET /druid/coordinator/v1/rules/history?interval=<interval>` +* `X-Druid-Author` (optional) + * Type: String + * A string representing the author making the configuration change. +* `X-Druid-Comment` (optional) + * Type: String + * A string describing the update. -Returns audit history of rules for all datasources. Default value of interval can be specified by setting `druid.audit.manager.auditHistoryMillis` (1 week if not configured) in Coordinator `runtime.properties`. +### Responses -`GET /druid/coordinator/v1/rules/history?count=<n>` +<!--DOCUSAURUS_CODE_TABS--> -Returns last `n` entries of audit history of rules for all datasources. +<!--200 SUCCESS--> +<br/> +*Successfully updated retention rules for specified datasource* -`GET /druid/coordinator/v1/rules/{dataSourceName}/history?interval=<interval>` +<!--END_DOCUSAURUS_CODE_TABS--> -Returns audit history of rules for a specified datasource. Default value of interval can be specified by setting `druid.audit.manager.auditHistoryMillis` (1 week if not configured) in Coordinator `runtime.properties`. +--- + +### Sample request + +The following example updates the retention rules for a datasource with specified ID `kttm1`. + +<!--DOCUSAURUS_CODE_TABS--> + +<!--cURL--> +```shell +curl "http://ROUTER_IP:ROUTER_PORT/druid/coordinator/v1/rules/kttm1" \ +--header "X-Druid-Author: doc intern" \ +--header "X-Druid-Comment: submitted via api" \ +--header "Content-Type: application/json" \ +--data "[ + { + \"type\": \"broadcastForever\" + }, + { + \"type\": \"loadForever\", + \"tieredReplicants\": { + \"_default_tier\": 2 + } + }, + { + \"type\": \"dropByPeriod\", + \"period\": \"P1M\" + } +]" +``` +<!--HTTP--> +```HTTP +POST /druid/coordinator/v1/rules/kttm1 HTTP/1.1 +Host: http://ROUTER_IP:ROUTER_PORT +X-Druid-Author: doc intern +X-Druid-Comment: submitted via api +Content-Type: application/json +Content-Length: 192 + +[ + { + "type": "broadcastForever" + }, + { + "type": "loadForever", + "tieredReplicants": { + "_default_tier": 2 + } + }, + { + "type": "dropByPeriod", + "period": "P1M" + } +] +``` +<!--END_DOCUSAURUS_CODE_TABS--> + +### Sample response + +A successful request returns an HTTP `200 OK` and an empty response body. + +## Update default retention rules for all datasources + +Update one or more default retention rules for all datasources. Retention rules can be submitted as an array of rule objects in the request body and overwrite any existing rules for the datasource. To remove default retention rules for all datasources, submit an empty rule array in the request body. Rules are read in the order in which they appear, see [rule structure](../operations/rule-configuration.md) for more information. + +### URL + +<code class="postAPI">POST</code> `/druid/coordinator/v1/rules/_default` + +### Header parameters + +The endpoint supports a set of optional header parameters to populate the `author` and `comment` fields in the `auditInfo` property for audit history. + +* `X-Druid-Author` (optional) + * Type: String + * A string representing the author making the configuration change. +* `X-Druid-Comment` (optional) + * Type: String + * A string describing the update. + +### Responses + +<!--DOCUSAURUS_CODE_TABS--> + +<!--200 SUCCESS--> +<br/> +*Successfully updated default retention rules* +<!--500 SERVER ERROR--> +<br/> +*Error with request body* + +<!--END_DOCUSAURUS_CODE_TABS--> + +--- + +### Sample request +The following example updates the default retention rule for all datasources with two new rules, `dropByPeriod` and `broadcastByPeriod`. + +<!--DOCUSAURUS_CODE_TABS--> + +<!--cURL--> +```shell +curl "http://ROUTER_IP:ROUTER_PORT/druid/coordinator/v1/rules/_default" \ +--header "Content-Type: application/json" \ +--data "[ + { + \"type\": \"dropByPeriod\", + \"period\": \"P1M\", + \"includeFuture\": true + }, + { + \"type\": \"broadcastByPeriod\", + \"period\": \"P1M\", + \"includeFuture\": true + } +]" +``` +<!--HTTP--> +```HTTP +POST /druid/coordinator/v1/rules/_default HTTP/1.1 +Host: http://ROUTER_IP:ROUTER_PORT +Content-Type: application/json +Content-Length: 207 + +[ + { + "type": "dropByPeriod", + "period": "P1M", + "includeFuture": true + }, + { + "type": "broadcastByPeriod", + "period": "P1M", + "includeFuture": true + } +] +``` +<!--END_DOCUSAURUS_CODE_TABS--> + +### Sample response + +A successful request returns an HTTP `200 OK` and an empty response body. + + +## Get an array of all retention rules + +Retrieves all current retention rules in the cluster including the default retention rule. Returns an array of objects for each datasource and their associated retention rule. + +### URL + +<code class="getAPI">GET</code> `/druid/coordinator/v1/rules` + +### Responses + +<!--DOCUSAURUS_CODE_TABS--> + +<!--200 SUCCESS--> +<br/> +*Successfully retrieved retention rules* + +<!--END_DOCUSAURUS_CODE_TABS--> + +--- + +### Sample request + +<!--DOCUSAURUS_CODE_TABS--> + +<!--cURL--> +```shell +curl "http://ROUTER_IP:ROUTER_PORT/druid/coordinator/v1/rules" +``` +<!--HTTP--> +```HTTP +GET /druid/coordinator/v1/rules HTTP/1.1 +Host: http://ROUTER_IP:ROUTER_PORT +``` +<!--END_DOCUSAURUS_CODE_TABS--> + +### Sample response + +<details> + <summary>Click to show sample response</summary> + + ```json +{ + "_default": [ + { + "tieredReplicants": { + "_default_tier": 2 + }, + "type": "loadForever" + } + ], + "social_media": [ + { + "interval": "2023-01-01T00:00:00.000Z/2023-02-01T00:00:00.000Z", + "type": "dropByInterval" + } + ], + "wikipedia_api": [], +} + ``` +</details> + +## Get an array of retention rules for a datasource + +Retrieves an array of rule objects for a single datasource. If there are no retention rules, it returns an empty array. + +Note that this endpoint returns an `HTTP 200 Success` code message even if the `datasource` does not exist. Review Comment: Same comment above about this probably not needing to be in code font. ########## docs/api-reference/retention-rules-api.md: ########## @@ -25,45 +25,464 @@ sidebar_label: Retention rules This document describes the API endpoints for managing retention rules in Apache Druid. -## Retention rules +Druid uses retention rules to determine what data is retained in the cluster. Druid supports load, drop, and broadcast rules. See [using rules to drop and retain data](../operations/rule-configuration.md) for more information. -Note that all _interval_ URL parameters are ISO 8601 strings delimited by a `_` instead of a `/` as in `2016-06-27_2016-06-28`. +In this document, `http://SERVICE_IP:SERVICE_PORT` is a placeholder for the server address of deployment and the service port. For example, on the quickstart configuration, replace `http://ROUTER_IP:ROUTER_PORT` with `http://localhost:8888`. -`GET /druid/coordinator/v1/rules` +## Update retention rules for a datasource -Returns all rules as JSON objects for all datasources in the cluster including the default datasource. +Update one or more retention rules for a datasource. Retention rules can be submitted as an array of rule objects in the request body and overwrite any existing rules for the datasource. Rules are read in the order in which they appear, see [rule structure](../operations/rule-configuration.md) for more information. -`GET /druid/coordinator/v1/rules/{dataSourceName}` +Note that this endpoint returns an `HTTP 200 Success` code message even if the `datasource` does not exist. -Returns all rules for a specified datasource. +### URL +<code class="postAPI">POST</code> `/druid/coordinator/v1/rules/{datasource}` -`GET /druid/coordinator/v1/rules/{dataSourceName}?full` +### Header parameters -Returns all rules for a specified datasource and includes default datasource. +The endpoint supports a set of optional header parameters to populate the `author` and `comment` fields in the `auditInfo` property for audit history. -`GET /druid/coordinator/v1/rules/history?interval=<interval>` +* `X-Druid-Author` (optional) + * Type: String + * A string representing the author making the configuration change. +* `X-Druid-Comment` (optional) + * Type: String + * A string describing the update. -Returns audit history of rules for all datasources. Default value of interval can be specified by setting `druid.audit.manager.auditHistoryMillis` (1 week if not configured) in Coordinator `runtime.properties`. +### Responses -`GET /druid/coordinator/v1/rules/history?count=<n>` +<!--DOCUSAURUS_CODE_TABS--> -Returns last `n` entries of audit history of rules for all datasources. +<!--200 SUCCESS--> +<br/> +*Successfully updated retention rules for specified datasource* -`GET /druid/coordinator/v1/rules/{dataSourceName}/history?interval=<interval>` +<!--END_DOCUSAURUS_CODE_TABS--> -Returns audit history of rules for a specified datasource. Default value of interval can be specified by setting `druid.audit.manager.auditHistoryMillis` (1 week if not configured) in Coordinator `runtime.properties`. +--- + +### Sample request + +The following example updates the retention rules for a datasource with specified ID `kttm1`. + +<!--DOCUSAURUS_CODE_TABS--> + +<!--cURL--> +```shell +curl "http://ROUTER_IP:ROUTER_PORT/druid/coordinator/v1/rules/kttm1" \ +--header "X-Druid-Author: doc intern" \ +--header "X-Druid-Comment: submitted via api" \ +--header "Content-Type: application/json" \ +--data "[ + { + \"type\": \"broadcastForever\" + }, + { + \"type\": \"loadForever\", + \"tieredReplicants\": { + \"_default_tier\": 2 + } + }, + { + \"type\": \"dropByPeriod\", + \"period\": \"P1M\" + } +]" +``` +<!--HTTP--> +```HTTP +POST /druid/coordinator/v1/rules/kttm1 HTTP/1.1 +Host: http://ROUTER_IP:ROUTER_PORT +X-Druid-Author: doc intern +X-Druid-Comment: submitted via api +Content-Type: application/json +Content-Length: 192 + +[ + { + "type": "broadcastForever" + }, + { + "type": "loadForever", + "tieredReplicants": { + "_default_tier": 2 + } + }, + { + "type": "dropByPeriod", + "period": "P1M" + } +] +``` +<!--END_DOCUSAURUS_CODE_TABS--> + +### Sample response + +A successful request returns an HTTP `200 OK` and an empty response body. + +## Update default retention rules for all datasources + +Update one or more default retention rules for all datasources. Retention rules can be submitted as an array of rule objects in the request body and overwrite any existing rules for the datasource. To remove default retention rules for all datasources, submit an empty rule array in the request body. Rules are read in the order in which they appear, see [rule structure](../operations/rule-configuration.md) for more information. + +### URL + +<code class="postAPI">POST</code> `/druid/coordinator/v1/rules/_default` + +### Header parameters + +The endpoint supports a set of optional header parameters to populate the `author` and `comment` fields in the `auditInfo` property for audit history. + +* `X-Druid-Author` (optional) + * Type: String + * A string representing the author making the configuration change. +* `X-Druid-Comment` (optional) + * Type: String + * A string describing the update. + +### Responses + +<!--DOCUSAURUS_CODE_TABS--> + +<!--200 SUCCESS--> +<br/> +*Successfully updated default retention rules* +<!--500 SERVER ERROR--> +<br/> +*Error with request body* + +<!--END_DOCUSAURUS_CODE_TABS--> + +--- + +### Sample request +The following example updates the default retention rule for all datasources with two new rules, `dropByPeriod` and `broadcastByPeriod`. + +<!--DOCUSAURUS_CODE_TABS--> + +<!--cURL--> +```shell +curl "http://ROUTER_IP:ROUTER_PORT/druid/coordinator/v1/rules/_default" \ +--header "Content-Type: application/json" \ +--data "[ + { + \"type\": \"dropByPeriod\", + \"period\": \"P1M\", + \"includeFuture\": true + }, + { + \"type\": \"broadcastByPeriod\", + \"period\": \"P1M\", + \"includeFuture\": true + } +]" +``` +<!--HTTP--> +```HTTP +POST /druid/coordinator/v1/rules/_default HTTP/1.1 +Host: http://ROUTER_IP:ROUTER_PORT +Content-Type: application/json +Content-Length: 207 + +[ + { + "type": "dropByPeriod", + "period": "P1M", + "includeFuture": true + }, + { + "type": "broadcastByPeriod", + "period": "P1M", + "includeFuture": true + } +] +``` +<!--END_DOCUSAURUS_CODE_TABS--> + +### Sample response + +A successful request returns an HTTP `200 OK` and an empty response body. + + +## Get an array of all retention rules + +Retrieves all current retention rules in the cluster including the default retention rule. Returns an array of objects for each datasource and their associated retention rule. + +### URL + +<code class="getAPI">GET</code> `/druid/coordinator/v1/rules` + +### Responses + +<!--DOCUSAURUS_CODE_TABS--> + +<!--200 SUCCESS--> +<br/> +*Successfully retrieved retention rules* + +<!--END_DOCUSAURUS_CODE_TABS--> + +--- + +### Sample request + +<!--DOCUSAURUS_CODE_TABS--> + +<!--cURL--> +```shell +curl "http://ROUTER_IP:ROUTER_PORT/druid/coordinator/v1/rules" +``` +<!--HTTP--> +```HTTP +GET /druid/coordinator/v1/rules HTTP/1.1 +Host: http://ROUTER_IP:ROUTER_PORT +``` +<!--END_DOCUSAURUS_CODE_TABS--> + +### Sample response + +<details> + <summary>Click to show sample response</summary> + + ```json +{ + "_default": [ + { + "tieredReplicants": { + "_default_tier": 2 + }, + "type": "loadForever" + } + ], + "social_media": [ + { + "interval": "2023-01-01T00:00:00.000Z/2023-02-01T00:00:00.000Z", + "type": "dropByInterval" + } + ], + "wikipedia_api": [], +} + ``` +</details> + +## Get an array of retention rules for a datasource + +Retrieves an array of rule objects for a single datasource. If there are no retention rules, it returns an empty array. + +Note that this endpoint returns an `HTTP 200 Success` code message even if the `datasource` does not exist. + +### URL + +<code class="getAPI">GET</code> `/druid/coordinator/v1/rules/{dataSource}` + +### Query parameters +* `full` (optional) + * Include the default retention rule for the datasource in the response. + +### Responses + +<!--DOCUSAURUS_CODE_TABS--> + +<!--200 SUCCESS--> +<br/> +*Successfully retrieved retention rules* + +<!--END_DOCUSAURUS_CODE_TABS--> + +--- + +### Sample request + +The following example retrieves the custom retention rules and default retention rules for datasource with specified ID `social_media`. + +<!--DOCUSAURUS_CODE_TABS--> + +<!--cURL--> +```shell +curl "http://ROUTER_IP:ROUTER_PORT/druid/coordinator/v1/rules/social_media?full=null" +``` +<!--HTTP--> +```HTTP +GET /druid/coordinator/v1/rules/social_media?full=null HTTP/1.1 +Host: http://ROUTER_IP:ROUTER_PORT +``` +<!--END_DOCUSAURUS_CODE_TABS--> + +### Sample response + +<details> + <summary>Click to show sample response</summary> + + ```json +[ + { + "interval": "2020-01-01T00:00:00.000Z/2022-02-01T00:00:00.000Z", + "type": "dropByInterval" + }, + { + "interval": "2010-01-01T00:00:00.000Z/2020-01-01T00:00:00.000Z", + "tieredReplicants": { + "_default_tier": 2 + }, + "type": "loadByInterval" + }, + { + "tieredReplicants": { + "_default_tier": 2 + }, + "type": "loadForever" + } +] + ``` +</details> + +## Get audit history for all datasources + +Retrieves the audit history of rules for all datasources over an interval of time. The default value of `interval` can be specified by setting `druid.audit.manager.auditHistoryMillis` (1 week if not configured) in Coordinator `runtime.properties`. Review Comment: Id'd rephrase this since the naming/file structure is a little unintuitive for Druid since all the runtime properties are just called `runtime.properties` regardless of service besides common and you have to check the directory - in the runtime properties for the Coordinator - in the `runtime.properties` file for the Coordinator -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
