worker icon indicating copy to clipboard operation
worker copied to clipboard

enhancement: Info Request

Open PierreBrisorgueil opened this issue 3 years ago • 6 comments

Hey @ziflex ,

Sometimes we are billed per request on the hosting of an API;

it would be possible to have an option on the post / to retrieve the info in the process?

{ 
  data: ...
  info: ...
}

I have a quick look for PR .. I have to dig a little GO before 😅

It's my last step to align all my containers on your worker and trash my fork 🤞

PierreBrisorgueil avatar Mar 24 '21 20:03 PierreBrisorgueil

Hey, not sure I understand what you want. Could you elaborate more on that?

ziflex avatar Mar 26 '21 03:03 ziflex

@ziflex, Yep, sorry for the lack of precision.

Some providers will charge per request to the worker, the number of requests and its execution time etc.

If we want to retrieve the information for each triggered scrap, we go to two requests per scrap ( POST / & GET /info )

My idea was to include a new parameter on the post request.

POST /

Query {
    text: String!
    params: Map<string, any>
    info: Boolean? 
}

and if boolean is true return something like

{ 
  data: post request content []
  info: get /info request content []
}

PierreBrisorgueil avatar Mar 26 '21 10:03 PierreBrisorgueil

Hmm, I do not like the idea of putting payload from another endpoint. What particular information are you interested in ? We could use response headers for that and set up the behavior on a worker launch.

ziflex avatar Mar 26 '21 15:03 ziflex

Hmm, I understand, and you are right. All the information, the goal would be to have the scrap and information about its execution in a single request (ip / chrome / ferret).

Perhaps a more straightforward solution would be to add a route running the other two? something like POST / debug (This is what I wanted PR to separate the use-case well but too little knowledge of GO to do it)

PierreBrisorgueil avatar Mar 26 '21 16:03 PierreBrisorgueil

We could add this information to response headers.

What exactly do you need from /info? Everything?

ziflex avatar Apr 01 '21 03:04 ziflex

hey, yep 🙂 the idea is to get all necessary informations to debug

PierreBrisorgueil avatar Apr 01 '21 06:04 PierreBrisorgueil