On Production
This is relevant, when you want to replay code executions on a remote machine.
How does it work on Staging/Production?
The logs your application generates, are sent to Videobug server. You need to self-host Videobug server. Here is how the staging/production set up works.
Check how to self-host videobug on GCP & AWS in the following sections.
Once you get your IP after following those steps, enter it in the credentials window as shown below:
Sign up or Sign in and you will get a JVM argument with package name, and JWT token.
--add-opens=java.base/java.util=ALL-UNNAMED -javaagent:"/PATH/TO/videobug-java-agent.jar=i=YOUR/PACKAGE/NAME,server=https://34.12.120.98,token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJzaGFyZHVsQGdtYWlsLmNvbSIsImlzcyI6InZpZGVvYnVnLWNsb3VkIiwiZXhwIjoyNjMxNDU2MzgyMjA1LCJwcm9qZWN0SWQiOiJzaGFyZHVsLWRlbW8tMTY1NjA4MDUwNzQ3NSIsImlhdCI6MTY1NjM4MjIwNX0.2dS1o6Bup8H0u-VOEbdbkm8bb38-MDEitghDoM1vxRwKvbKXydpGLKpavuYnDgJGJnPNGZQLE0EK459v3eHGjw"
Deploying with Docker
If your deployment is on Docker, you need to download the java-agent jar to the Docker image and update the parameters to JVM to use the javaagent.
Here is what you can use
## Update token
ARG VIDEOBUG_TOKEN=videobug-jwt-token
## Update package name
ARG PACKAGE=com.company.project
## Update server endpoint
ARG VIDEOBUG_SERVER=https://cloud.bug.video
ARG VIDEOBUG_AGENT_PATH=/tmp/videobug-java-agent.jar
RUN wget -O $VIDEOBUG_AGENT_PATH $(wget -qO- https://cloud.bug.video/api/data/java-agent-jar-link)
ENTRYPOINT ["java", "--add-opens=java.base/java.util=ALL-UNNAMED", "-javaagent:$VIDEOBUG_AGENT_PATH=i=$PACKAGE,server=$VIDEOBUG_SERVER,token=$VIDEOBUG_TOKEN", "-jar", "/application.jar"]
Replaying Remote Exceptions
Whenever your code crashes or an exception occurs in staging or production environment, you can refresh inside the Exceptions tab and see all the exceptions in your code.
Click on any row and fetch session, you will be taken in the debugging tab, you can go back or forward in time and see the variables.
Search Remote Code Executions
You can search code executions by the variable values. For example, if you send shardul@gmail.com to your code and want to see the code execution for this email id, you can do so using Traces
The below code shows the search done for code execution where shardul@gmail.com was passed as a variable value.
Logical Bugs
This is very relevant for bugs where for particular users something went wrong and no stack trace is available. For example, for shardul@gmail.com, the checkout amount was $99.9 and the amount sent to bank was $100. You would want to trace the code execution line by line for such users.