Skip to content

Refactor server_dap to use command-registration style - #12

Closed
andyw8 wants to merge 1 commit into
masterfrom
andyw8/server-dap-register-commands-refactor
Closed

Refactor server_dap to use command-registration style#12
andyw8 wants to merge 1 commit into
masterfrom
andyw8/server-dap-register-commands-refactor

Conversation

@andyw8

@andyw8andyw8 commented Mar 9, 2023

Copy link
Copy Markdown

@andyw8
andyw8force-pushed the andyw8/server-dap-register-commands-refactor branch 2 times, most recently from bf0a0b8 to c1ce4bcCompareMarch 9, 2023 16:07
@andyw8andyw8 changed the title wipRefactor server_dap to use command-registration styleMar 9, 2023
args = req.dig('arguments')

case req['command']
class RequestHandler

@andyw8andyw8Mar 9, 2023

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Using a class to hold only a single field may seem unnecessary, but this could be an extension point for analytics, etc.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How do you envision us adding metrics through this class?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

How do you envision us adding metrics through this class?

One approach could be to add a command line option, e,g. --request-handler="Shopify::RequestHandler", allowing a custom class to provided.

Maybe @st0012 already has something else in mind though.

@vinistockvinistockMar 9, 2023

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We may not even need this class at all. We can override register_request

defself.register_request *names, &binstrumented=->{measure_stuffdob.callend}names.each{ |name| REGISTERED_REQUESTS[name]=instrumented}end

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yeah that would also work, but I worry it may not be resilient to future changes within debug.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I feel if we don't have a concrete use case for it now, it doesn't make sense for the upstream to accept it. So maybe let's hold back on adding this new class and aim at just patching register_request if we need to?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I'll draft a PR description and share it in internally for review.

@andyw8
andyw8force-pushed the andyw8/server-dap-register-commands-refactor branch from 51764da to 8a9b8ddCompareMarch 9, 2023 16:19
@andyw8
andyw8force-pushed the andyw8/server-dap-register-commands-refactor branch from 8a9b8dd to 70c0d61CompareMarch 9, 2023 16:29
end
end

def self.register_request *names, &b

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The style/naming is not what I'd typically use, but I've tried keep it consistent with what's already in use.

@andyw8
andyw8 marked this pull request as ready for review March 9, 2023 16:31
@andyw8
andyw8 requested a review from a teamMarch 9, 2023 16:32
@andyw8

Copy link
Copy Markdown
Author

Opened upstream: ruby#931

@andyw8andyw8 closed this Mar 17, 2023
Sign up for freeto 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.

3 participants

@andyw8@st0012@vinistock