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

Adding Pinger interface and Removing mandatory nature of Ping fuction #1784

Merged
merged 5 commits into from
Jun 14, 2022

Conversation

DeepanshuA
Copy link
Contributor

@DeepanshuA DeepanshuA commented Jun 13, 2022

Description

This change introduces Pinger interface and also reduces mandatory Ping functionality.
Ping works on the basis, that wen called, it returns either an Error or nil.
With forced implementation, any component returning without checking actual heartbeat and simply returning nil, causes wrong sense of correctness of component. So, ideally Ping should be implemented only when correctly implemented.

Issue reference

We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.

Please reference the issue this PR will close: dapr/dapr#2167

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation / Created issue in the https://github.com/dapr/docs/ repo: dapr/docs#[issue number]

@DeepanshuA DeepanshuA requested review from a team as code owners June 13, 2022 07:50
@hueifeng
Copy link
Member

Please fix DCO.

Copy link
Member

@berndverst berndverst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also fix DCO

state/store.go Outdated Show resolved Hide resolved
tests/conformance/state/state.go Outdated Show resolved Hide resolved
if inputBindingWithPing, ok := inputBinding.(health.Pinger); ok {
return inputBindingWithPing.Ping()
} else {
return fmt.Errorf("Ping is not implemented by this Input Binding")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return fmt.Errorf("Ping is not implemented by this Input Binding")
return fmt.Errorf("Ping is not implemented by this input binding")

this should be lowercase for consistency and it currently breaks tests

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. To understand that what tests are failing and how these rules are setup, I tried to search, are these the Conformance tests that are failing? I could not find this in UTs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so now almost all Conf tests started to pass after this. I would need to check how this is checked in conf tests.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You had inconsistency in spelling between your conformance tests and your error implementation if you look at your PR carefully :)

At some place you would essentially raise error "Error" but somewhere else expect error "error" if that makes sense.

bindings/output_binding.go Outdated Show resolved Hide resolved
pubsub/pubsub.go Outdated Show resolved Hide resolved
moonchanyong and others added 3 commits June 14, 2022 12:09
Signed-off-by: chanyong.moon <dev.chanyongmoon@gmail.com>
Signed-off-by: Deepanshu Agarwal <deepanshu.agarwal1984@gmail.com>
Signed-off-by: Deepanshu Agarwal <deepanshu.agarwal1984@gmail.com>
Signed-off-by: Deepanshu Agarwal <deepanshu.agarwal1984@gmail.com>
@codecov
Copy link

codecov bot commented Jun 14, 2022

Codecov Report

Merging #1784 (8640bae) into master (4322a22) will increase coverage by 0.04%.
The diff coverage is 30.28%.

@@            Coverage Diff             @@
##           master    #1784      +/-   ##
==========================================
+ Coverage   36.59%   36.64%   +0.04%     
==========================================
  Files         177      179       +2     
  Lines       16222    16347     +125     
==========================================
+ Hits         5937     5990      +53     
- Misses       9617     9671      +54     
- Partials      668      686      +18     
Impacted Files Coverage Δ
bindings/redis/redis.go 18.18% <0.00%> (-2.88%) ⬇️
pubsub/azure/servicebus/subscription.go 0.00% <0.00%> (ø)
pubsub/pubsub.go 0.00% <0.00%> (ø)
pubsub/redis/redis.go 21.22% <0.00%> (-0.37%) ⬇️
state/aerospike/aerospike.go 18.64% <ø> (+0.15%) ⬆️
state/alicloud/tablestore/tablestore.go 79.56% <ø> (+0.84%) ⬆️
state/aws/dynamodb/dynamodb.go 86.25% <ø> (+0.53%) ⬆️
state/azure/tablestorage/tablestorage.go 11.96% <ø> (+0.10%) ⬆️
state/cassandra/cassandra.go 26.14% <ø> (+0.16%) ⬆️
state/couchbase/couchbase.go 19.81% <ø> (+0.18%) ⬆️
... and 23 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 83a76d5...8640bae. Read the comment docs.

@DeepanshuA DeepanshuA changed the title [WIP] Convert Ping fuction to optional Pinger interface and Removing mandatory nature of Ping fuction Jun 14, 2022
@DeepanshuA DeepanshuA changed the title Pinger interface and Removing mandatory nature of Ping fuction Adding Pinger interface and Removing mandatory nature of Ping fuction Jun 14, 2022
@berndverst berndverst merged commit a0ef462 into dapr:master Jun 14, 2022
berndverst pushed a commit to berndverst/components-contrib that referenced this pull request Jun 20, 2022
…dapr#1784)

* add `Pinger` interface.

Signed-off-by: chanyong.moon <dev.chanyongmoon@gmail.com>

* Convert Ping fuction to optional

Signed-off-by: Deepanshu Agarwal <deepanshu.agarwal1984@gmail.com>

* Removing unrequired Ping implementations

Signed-off-by: Deepanshu Agarwal <deepanshu.agarwal1984@gmail.com>

* Addressing comments

Signed-off-by: Deepanshu Agarwal <deepanshu.agarwal1984@gmail.com>

Co-authored-by: chanyong.moon <dev.chanyongmoon@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proposal: Allow components to perform custom health checks
4 participants