GoogleCloudPlatform / cloud-code-vscode

Cloud Code for Visual Studio Code: Issues, Documentation and more
Other
420 stars 112 forks source link

Apigee Emulator - Trace/Debug export #847

Open gosunilgo opened 1 year ago

gosunilgo commented 1 year ago

Use case What are you trying to do that our extension doesn't let you?

Trace access doesn't seem to be enabled in Apigee Emulator. We would like same feature/ability to trace headers like Apigee-Debug - https://cloud.google.com/apigee/docs/api-platform/debug/trace

Example - view traffic during each policy step

Like OPDK or apigee-hybridX, hosted version clearly allows ease-of-use by quickly viewing trace, via console. We are not looking for UI-replacement, but the actual tracefile contents. We can upload tracefile to hybrid for analysis.

ideas?

Feature

Option1 - Give user ability to download tracefile/debugfile from apigee-emulator. Like OPDK, we would like to download the tracefile during/after the test executions Option2 - Can the emulator emit metrics for scraping purposes ?

shirishtrivikr commented 1 year ago

@gosunilgo Thanks for the feature request

The feature is currently under development and we have a minimal feature set

Currently this feature can be accessed by adding following configuration option to user settings cloudcode.beta.enableApigeeTrace: true

Once this flag is enabled

  1. You can open a downloaded trace by using a Command palette option Cloud Code: Open Apigee trace
  2. In the Emulator view you will see A trace button next to each deployed application. Clicking this button the trace will be activated and as soon as the deployed proxy sees some traffic the trace view should pop up giving you the details about the request.
image

A sample view of the trace

image
marcinkubica commented 8 months ago

@shirishtrivikr I'm loving this feature! One note - I've noticed the ordering of calls is not being populated in order in the report. I'm on gcr.io/apigee-release/hybrid/apigee-emulator:1.11.0

image

image

image

image

image

adeelabid90 commented 8 months ago

I am getting some error when i add config to setting, Using the 1.11.0 emulator. Any one can guide on this?

image

sripasg commented 8 months ago

The squiggly underline for that setting is indicating a warning not an error. Are you getting any actual error while exercising this feature?

Note to @shirishtrivikr to respond for any group the user needs to be part of to exercise the trace feature.

I am getting some error when i add config to setting, Using the 1.11.0 emulator. Any one can guide on this?

image

adeelabid90 commented 8 months ago

@sripasg yes its a warning, I am able to start tracing, Traces view automatically loaded when trace data is available but it automatically stop receiving request after some time, I have to start it again n again. Is there any setting or config available to set how long it should receive calls

shirishtrivikr commented 8 months ago

@addelabid90 The trace is started for 10 minutes every time. After 10 minutes the emulator will automatically stop the tracing.

Currently there is no parameter which can control this behavior.

Thanks Shirish

On Thu, Mar 28, 2024 at 3:17 PM adeelabid90 @.***> wrote:

@sripasg https://github.com/sripasg yes its a warning, I am able to start tracing, Traces view automatically loaded when trace data is available but it automatically stop receiving request after some time, I have start to start it again n again. Is there any setting or config available to set how long it should receive calls

— Reply to this email directly, view it on GitHub https://github.com/GoogleCloudPlatform/cloud-code-vscode/issues/847#issuecomment-2024791366, or unsubscribe https://github.com/notifications/unsubscribe-auth/APALA6QTDZ7HXPWPJK7B2ETY2PRJ5AVCNFSM6AAAAAA4N4WDWKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRUG44TCMZWGY . You are receiving this because you were mentioned.Message ID: <GoogleCloudPlatform/cloud-code-vscode/issues/847/2024791366 @.***>

--

Shirish Kuncolienkar

@.***

Apigee

bartdw commented 6 months ago

I use the apigee emulator to run some unit tests on proxy code in a pipeline. Until now I could only verify the response body/headers. Since this is available I could also verify internal variables. Is there any documentation on the emulator's api calls to start the debug trace and export the variables?

Thanks, Bart

bartdw commented 4 months ago

If someone is interested in the api calls the emulator is supporting (for taking traces): I looked around in the sourcecode of the plugin and made a list of them, which you can find here: https://github.com/GoogleCloudPlatform/cloud-code-vscode/issues/524#issuecomment-2216843724