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

[BUG] what does circuitbreaker configuration have to do with JS client? #823

Closed
dblock opened this issue Jul 20, 2022 · 13 comments
Closed
Assignees
Labels
2 - In progress Issue/PR: The issue or PR is in progress. v2.0.0 v2.1.0
Milestone

Comments

@dblock
Copy link
Member

dblock commented Jul 20, 2022

What is the bug?

Reading https://opensearch.org/docs/latest/clients/javascript/#circuit-breaker I don't quite understand how it relates to the JS client.

What is the expected behavior?

Didn't expect to find this section here, or expected it to explain what it has to do with the JS client.

@dblock dblock added bug Technical problem with the doc site or broken link untriaged labels Jul 20, 2022
@Naarcha-AWS
Copy link
Collaborator

@dblock: Where would you have expected to find this documentation?

@dblock
Copy link
Member Author

dblock commented Jul 21, 2022

@Naarcha-AWS under cluster settings? I am totally confused of what a cluster setting has to do with the javascript client, what am I missing?

@robdasilva
Copy link
Contributor

robdasilva commented Jul 21, 2022

@Naarcha-AWS From what this setting affects in regards to the current organization of the documentation, I would have expected this piece of information somewhere in this document: https://github.com/opensearch-project/documentation-website/blob/main/_opensearch/cluster.md

@robdasilva
Copy link
Contributor

robdasilva commented Jul 21, 2022

@dblock @Naarcha-AWS Also the section seems to be (at least) partially incorrect, as the POST verb seems to not be allowed on _cluster/settings:

{"Message":"Your request: '/_cluster/settings' is not allowed for verb: POST"}

Should be PUT if I am not mistaken. Am I overlooking something?

@robdasilva
Copy link
Contributor

Was confused there for a second, since the section mentions the cluster settings, but actually describes a client transport option: https://github.com/opensearch-project/opensearch-js/blob/main/lib/Transport.js#L88

It's intention is described in a comment where this option is used: https://github.com/opensearch-project/opensearch-js/blob/main/lib/Transport.js#L332-L338

There are also circuit breakers on e.g. field data or request level, that might be able to be configured in the _cluster/settings but these are unrelated to the client options and have a different shape.

This leads me to believe that the section is incorrect and should be updated:

  1. As I mentioned in the comment above, the request verb POST from the example should be PUT.
  2. A request against _cluster/settings would require a different payload than the one in the example.
  3. The client transport can be configured during client instantiation with the respective option (which seems to be what the section was originally intended to describe):
    const client = new Client({
      ...,
      memoryCircuitBreaker: {
        enabled: true,
        maxPercentage: 0.8
      },
      ...,
    })
    

@Naarcha-AWS
Copy link
Collaborator

@robdasilva: That makes sense. Thank you for the explanation. From a user perspective, would this mean that the user would need to modify the "Transport.js" file before installation the JS client to properly set their Breaker settings?

robdasilva added a commit to robdasilva/opensearch-documentation-website that referenced this issue Jul 21, 2022
robdasilva added a commit to robdasilva/opensearch-documentation-website that referenced this issue Jul 21, 2022
Fix opensearch-project#823

Signed-off-by: Robert Da Silva <mail@robdasilva.com>
@robdasilva
Copy link
Contributor

robdasilva commented Jul 21, 2022

@Naarcha-AWS It's actually easier than that. As I mentioned in my comment above, the user would simply instantiate the client with the memoryCircuitBreaker option configured. This option is passed on to the Transport instance used by the client.

If a user instead explicitly defines a Transport to be used, it must implement a memoryCircuitBreaker option, as this gets passed down from the client when instantiating that given Transport.

Unfortunately, it seems the Transport.d.ts is currently falsely missing that option.

@kavilla
Copy link
Member

kavilla commented Jul 25, 2022

Yes I actually think the doc website is incorrect because it won't be a cluster setting. It's a client side configuration, so before the response returns from OpenSearch it suppose allow for the client to be configured (for us OpenSearch Dashboards in our opensearch_dashboards.yml) so that it doesn't kill the application of there is less memory available that what it needs.

@dblock
Copy link
Member Author

dblock commented Jul 26, 2022

The documentation needs to document all client-side options with examples. Let's make that the issue here?

@robdasilva
Copy link
Contributor

@dblock Can we make that a separate issue? I made a proposal for the memoryCircuitBreaker documentation in #827. It would be great, if we could merge that and then continue adding documentation from there. WDYT?

@Naarcha-AWS
Copy link
Collaborator

@robdasilva: I'm currently reviewing #827 now. I agree that we should make client-side options with examples separate issues per client.

@Naarcha-AWS Naarcha-AWS self-assigned this Jul 28, 2022
@Naarcha-AWS Naarcha-AWS added 2 - In progress Issue/PR: The issue or PR is in progress. v2.0.0 v-All This issue is valid for all versions through 1.3 v2.1.0 and removed bug Technical problem with the doc site or broken link untriaged v-All This issue is valid for all versions through 1.3 labels Jul 28, 2022
@Naarcha-AWS Naarcha-AWS modified the milestones: v2.2, 2022-Q3 Jul 28, 2022
@dblock
Copy link
Member Author

dblock commented Sep 29, 2022

@robdasilva @Naarcha-AWS A-OK by me, anything else needs to be done?

@robdasilva
Copy link
Contributor

@dblock Agree. Nothing to add from my side.

opensearch-trigger-bot bot pushed a commit that referenced this issue Oct 11, 2022
* Fix Circuit Breaker section in JS client docs

Fix #823

Signed-off-by: Robert Da Silva <mail@robdasilva.com>

* Add documentation for JS client bulk helper

Signed-off-by: Robert Da Silva <mail@robdasilva.com>

* Refactors js client helper documentation

* Incorporated tech review comments

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Incorporated doc review comments

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Update _clients/javascript/helpers.md

Co-authored-by: Alice Williams <88908598+alicejw-aws@users.noreply.github.com>

* Update _clients/javascript/helpers.md

Co-authored-by: Alice Williams <88908598+alicejw-aws@users.noreply.github.com>

* Update helpers.md

* Incorporated tech review feedback

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Implemented editorial comments

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

Signed-off-by: Robert Da Silva <mail@robdasilva.com>
Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>
Co-authored-by: Robert Da Silva <mail@robdasilva.com>
Co-authored-by: Alice Williams <88908598+alicejw-aws@users.noreply.github.com>
(cherry picked from commit 89f966a)
kolchfa-aws added a commit that referenced this issue Oct 11, 2022
* Fix Circuit Breaker section in JS client docs

Fix #823

Signed-off-by: Robert Da Silva <mail@robdasilva.com>

* Add documentation for JS client bulk helper

Signed-off-by: Robert Da Silva <mail@robdasilva.com>

* Refactors js client helper documentation

* Incorporated tech review comments

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Incorporated doc review comments

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Update _clients/javascript/helpers.md

Co-authored-by: Alice Williams <88908598+alicejw-aws@users.noreply.github.com>

* Update _clients/javascript/helpers.md

Co-authored-by: Alice Williams <88908598+alicejw-aws@users.noreply.github.com>

* Update helpers.md

* Incorporated tech review feedback

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Implemented editorial comments

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

Signed-off-by: Robert Da Silva <mail@robdasilva.com>
Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>
Co-authored-by: Robert Da Silva <mail@robdasilva.com>
Co-authored-by: Alice Williams <88908598+alicejw-aws@users.noreply.github.com>
(cherry picked from commit 89f966a)

Co-authored-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 - In progress Issue/PR: The issue or PR is in progress. v2.0.0 v2.1.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants