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

API filter on events and results #179

Merged
merged 21 commits into from
Jun 5, 2018
Merged

Conversation

antho1404
Copy link
Member

@antho1404 antho1404 commented May 31, 2018

This allow to have more granularity on the events we listen from the core.

  • subscribes to events by key
  • subscribes to results by key
  • add filter on data from events
  • add filter on data from result

Also this request update the test command to be able to test an already deployed service and also keep a service alive

fix #23

@codecov
Copy link

codecov bot commented May 31, 2018

Codecov Report

Merging #179 into dev will decrease coverage by 0.19%.
The diff coverage is 64.61%.

Impacted file tree graph

@@            Coverage Diff            @@
##              dev     #179     +/-   ##
=========================================
- Coverage   74.52%   74.32%   -0.2%     
=========================================
  Files          57       58      +1     
  Lines        1162     1192     +30     
=========================================
+ Hits          866      886     +20     
- Misses        226      237     +11     
+ Partials       70       69      -1
Impacted Files Coverage Δ
utils/array/include.go 100% <100%> (ø)
api/core/listen_event.go 38.46% <55.55%> (+38.46%) ⬆️
api/core/listen_result.go 50% <60.52%> (+50%) ⬆️
service/start.go 71.79% <0%> (-6.34%) ⬇️
api/service/listen_task.go 0% <0%> (ø) ⬆️

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 d313837...dacfc34. Read the comment docs.

Copy link
Member

@NicolasMahe NicolasMahe left a comment

Choose a reason for hiding this comment

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

I was wondering what happen when a client kill the connection on the api ListenEvent for example.
Is the associated goroutine automatically destroyed? If not, we could end up with too many subscriber on pubsub.Subscribe.

Otherwise the code and logic seems ok. I didn't test yet.

@antho1404
Copy link
Member Author

I think this pull request should be done, the part to filter the data is not critical for now, we can do this in another pull request and also a bit tricky because we have to manage all the different types so let's keep this one simple and focus on more important developments.

For the subscribe you are right now we don't unsubscribe every time a stream is disconnected this should be added

@antho1404 antho1404 changed the title [WIP] API filter on events and results API filter on events and results Jun 1, 2018
@antho1404 antho1404 self-assigned this Jun 2, 2018
@antho1404 antho1404 added enhancement New feature or request application labels Jun 4, 2018
…r-message-from-services

# Conflicts:
#	CHANGELOG.md
#	cmd/service/test.go
@NicolasMahe
Copy link
Member

NicolasMahe commented Jun 5, 2018

  • should update documentation of service test command once merged.

Copy link
Member

@NicolasMahe NicolasMahe left a comment

Choose a reason for hiding this comment

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

I renamed the flag of the service test command to match with the name of the API.
I also improved the errors of validateEventKey and validateTaskKey.

Test.Flags().StringP("data", "d", "", "Path to the file containing the data required to run the task")
Test.Flags().StringP("task-filter", "r", "", "Only log the result of the given task")
Test.Flags().StringP("output-filter", "o", "", "Only log the data of the given output of a task result. If set, you also need to set the task in --result")
Test.Flags().StringP("serviceID", "s", "", "ID of a previously deployed service")
Copy link
Member

Choose a reason for hiding this comment

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

Flags event, result, output and service doesn't match with the API.
I renamed them with the API names.

@NicolasMahe
Copy link
Member

NicolasMahe commented Jun 5, 2018

I create this #195 issue to track the improved version of the filter

@NicolasMahe NicolasMahe merged commit e2cd65a into dev Jun 5, 2018
@NicolasMahe NicolasMahe deleted the 23-filter-message-from-services branch June 5, 2018 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Filter messages from services
2 participants