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

Support Search request slow logs and cluster.routing.allocation.awareness.force.zone.values #211

Merged
merged 1 commit into from
Sep 16, 2024

Conversation

prudhvigodithi
Copy link
Collaborator

@prudhvigodithi prudhvigodithi commented Sep 16, 2024

Description

Issues Resolved

#209 and #202

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@prudhvigodithi
Copy link
Collaborator Author

prudhvigodithi commented Sep 16, 2024

Testing

Default

curl http://localhost:9200/_cluster/settings  -u 'admin:myStrongPassword123@456' | jq '.'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    32  100    32    0     0   9753      0 --:--:-- --:--:-- --:--:-- 10666
{
  "persistent": {},
  "transient": {}
}

With terraform apply

Terraform will perform the following actions:

  # opensearch_cluster_settings.persistent will be created
  + resource "opensearch_cluster_settings" "persistent" {
      + cluster_max_shards_per_node                    = 10
      + cluster_search_request_slowlog_level           = "WARN"
      + cluster_search_request_slowlog_threshold_debug = "2s"
      + cluster_search_request_slowlog_threshold_info  = "5s"
      + cluster_search_request_slowlog_threshold_trace = "100ms"
      + cluster_search_request_slowlog_threshold_warn  = "10s"
      + id                                             = (known after apply)
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

Cluster output with applied Search request slow log settings

curl http://localhost:9200/_cluster/settings  -u 'admin:myStrongPassword123@456' | jq '.'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   265  100   265    0     0  74647      0 --:--:-- --:--:-- --:--:-- 88333
{
  "persistent": {
    "cluster": {
      "search": {
        "request": {
          "slowlog": {
            "level": "WARN",
            "threshold": {
              "warn": "10s",
              "trace": "100ms",
              "debug": "2s",
              "info": "5s"
            }
          }
        }
      },
      "max_shards_per_node": "10"
    },
    "plugins": {
      "index_state_management": {
        "template_migration": {
          "control": "-1"
        }
      }
    }
  },
  "transient": {}
}

.github/workflows/test.yml Show resolved Hide resolved
docs/data-sources/host.md Show resolved Hide resolved
docs/index.md Outdated Show resolved Hide resolved
docs/resources/anomaly_detection.md Show resolved Hide resolved
@prudhvigodithi
Copy link
Collaborator Author

Hey @peterzhuamazon the spaces coming from the CLI tfplugindocs generate https://github.com/hashicorp/terraform-plugin-docs which is used to generate the docs, example https://registry.terraform.io/providers/opensearch-project/opensearch/latest/docs/resources/cluster_settings.

@prudhvigodithi prudhvigodithi changed the title Support Search request slow logs Support Search request slow logs and cluster.routing.allocation.awareness.force.zone.values Sep 16, 2024
@prudhvigodithi
Copy link
Collaborator Author

To support the cluster.routing.allocation.awareness.force.zone.values with the list of string values example :["zoneA", "zoneB"]

curl http://localhost:9200/_cluster/settings  -u 'admin:myStrongPassword123@456' | jq '.'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   150  100   150    0     0  46210      0 --:--:-- --:--:-- --:--:-- 50000
{
  "persistent": {
    "cluster": {
      "routing": {
        "allocation": {
          "awareness": {
            "attributes": "zone",
            "force": {
              "zone": {
                "values": [
                  "zoneA",
                  "zoneB"
                ]
              }
            }
          }
        }
      }
    }
  },
  "transient": {}
}

@prudhvigodithi prudhvigodithi merged commit d86d6a3 into opensearch-project:main Sep 16, 2024
5 checks passed
@prudhvigodithi
Copy link
Collaborator Author

prudhvigodithi commented Sep 16, 2024

Thanks for the review @peterzhuamazon.
Adding @ironf1st @vinylen @getsaurabh02 @rblcoder.

@prudhvigodithi prudhvigodithi self-assigned this Sep 16, 2024
@vinylen
Copy link

vinylen commented Sep 17, 2024

Thank you for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

3 participants