Showing posts with label Devops. Show all posts
Showing posts with label Devops. Show all posts

Monday, 24 April 2023

How to setup GIT repository in Intelij ?

 



Pipeline Script Fundamentals

Click Here:   DevOps Related Posts

 Check GIT commands for Interview preparation SET-1:

GIT Interview Question 1 to 11

Check GIT commands for Interview preparation SET-2:

GIT Interview Question 12 to 21

Check GIT commands for Interview preparation SET-3:

GIT Interview Question 21 to 30


Set up Git repository

When you clone an existing Git repository or put an existing project under Git version control, IntelliJ IDEA automatically detects if git is installed on your computer. If the IDE can't locate the git executable, it suggests downloading it.

IntelliJ IDEA supports Git from the Windows Subsystem for Linux 2 (WSL2), which is available in Windows 10 version 2004.

If Git is not installed on Windows, IntelliJ IDEA searches for Git in WSL and uses it from there. Also, IntelliJ IDEA automatically switches to Git from WSL for projects that are opened when you use the \\wsl$ path.

If you need to manually configure IntelliJ IDEA to use Git from WSL, go to the Version Control | Git page of the IDE settings ⌘ ,, click the Browse icon in the Path to Git executable field and select Git from WSL via the \wsl$ path, for example, \\wsl$\debian\usr\bin\git.


Check out a project from a remote host (clone)


IntelliJ IDEA allows you to check out (in Git terms clone) an existing repository and create a new project based on the data you've downloaded.

  • From the main menu, select Git | Clone, or, if no project is currently opened, click Get from VCS on the Welcome screen.

  • In the Get from Version Control dialog, specify the URL of the remote repository you want to clone, or select one of the VCS hosting services on the left.
    If you are already logged in to the selected hosting service, completion will suggest the list of available repositories that you can clone.


  • Click Clone. If you want to create a project based on the sources you have cloned, click Yes in the confirmation dialog. Git root mapping will be automatically set to the project root directory.
    If your project contains submodules, they will also be cloned and automatically registered as project roots.

  • When you import or clone a project for the first time, IntelliJ IDEA analyzes it. If the IDE detects more than one configuration (for example, Eclipse and Gradle), it prompts you to select which configuration you want to use.


    If the project that you are importing uses a build tool, such as Maven or Gradle, we recommend that you select the build tool configuration.


    Select the necessary configuration and click OK.
  • The IDE pre-configures the project according to your choice. For example, if you select Gradle, IntelliJ IDEA executes its build scripts, loads dependencies, and so on.

Put an existing project under Git version control


You can create a local Git repository based on the existing project sources.


Associate the entire project with a single Git repository

  • Open the project that you want to put under Git.

  • Press ⌃ V to open the VCS Operations Popup and select Enable Version Control Integration.

    Alternatively, from the main menu, select VCS | Enable Version Control Integration.

  • Choose Git as the version control system and click OK.

  • After VCS integration is enabled, IntelliJ IDEA will ask you whether you want to share project settings files via VCS. You can choose Always Add to synchronize project settings with other repository users who work with IntelliJ IDEA.

Associate different directories within the project with different Git repositories

  • Open the project that you want to put under Git.
  • From the main menu, choose VCS | Create Git Repository.
  • In the dialog that opens, specify the directory where a new Git repository will be created.
    Git does not support external paths, so if you choose a directory that is outside your project root, make sure that the folder where the repository is going to be created also contains the project root.
  • If you are creating multiple Git repositories inside the project structure, repeat the previous steps for each directory.

After you have initialized a Git repository for your project, you need to add project files to the repository.


Add files to the local repository

  • In the Commit tool window ⌘ 0, expand the Unversioned Files node.

  • Select the files you want to add to Git or the entire changelist and press ⌥ ⌘ A or choose Add to VCS from the context menu.
  • You can also add files to your local Git repository from the Project tool window: select the files you want to add, and press ⌥ ⌘ A or choose Git | Add from the context menu.

When Git integration is enabled in your project, IntelliJ IDEA suggests adding each newly created file under Git, even if it was added from outside IntelliJ IDEA. You can change this behavior in the Version Control | Confirmation page of the IDE settings ⌘ ,. If you want certain files to always remain unversioned, you can ignore them.



If you attempt to add a file that's on the .gitignore list, IntelliJ IDEA will suggest force adding it. Clicking Cancel in the confirmation dialog only cancels force adding ignored files - all other files will be added to the Git repository.



*******************************************************************
For any doubts or career guidance from me, reach out here : https://topmate.io/sidharth_shukla

********************************************************************

These commands cover a range of basic UI interactions and are a good starting point for building automated tests with Cypress.

Do remember that knowing Linux is one of the most important aspect to work as an SDET.

Basic Linux Commands for Automation QA


****************************************

TOP 15 BDD - CUCUMBER Interview Q&A


************************************************

✍️AUTHORLinkedIn Profile

************************************************

Learn (API-Microservice)Testing+ Selenium UI Automation-SDET with Self Paced Videos prepared by FAANG employees and LIVE Doubt Session 

SDET TRANING VIDEOS AVAILABLE with Live Doubt Session(course-1 below,API TRaining Videos With Class Notes and Coding Set) and (API+UI, both course-1 & 2 below) Check Training Page for Course Content or reach out @whatsapp +91-9619094122. 
This includes classnotes, 300+ interview questions, 3 projects, Java Coding question set for product companies along with career guidance from FAANG employees for Automation and SDET.

For more details whatsapp : https://lnkd.in/dnBWDM33

*************************************************

SeleniumWebdriver Automation Testing Interview Questions:

https://automationreinvented.blogspot.com/search/label/SeleniumWebdriver

API Testing Interview Question Set:

https://automationreinvented.blogspot.com/2022/03/top-80-api-testing-interview-questions.html

DevOps Interview Q&A:

https://automationreinvented.blogspot.com/2021/11/top-11-devops-interview-questions-and.html 

Kubernetes Interview Question Set

https://automationreinvented.blogspot.com/search/label/Kubernetes

Docker Interview Question Set

https://automationreinvented.blogspot.com/Docker

Linux Interview question Set

https://automationreinvented.blogspot.com/search/label/Linux

Automation Testing/SDET Framework Design

https://automationreinvented.blogspot.com/search/label/FrameworkDesign

Java Related Interview Question Set

https://automationreinvented.blogspot.com/search/label/Java

GIT Interview Question Set:

https://automationreinvented.blogspot.com/2021/09/top-40-git-interview-questions-and.html

Coding Interview Question Set:

https://automationreinvented.blogspot.com/search/label/Coding%20Questions

Mobile Testing Interview Question Set:

https://automationreinvented.blogspot.com/search/label/Mobile%20Testing

Python Interview Question Set for QAE - SDET - SDE:

https://automationreinvented.blogspot.com/search/label/Python


Sunday, 25 December 2022

How to Monitor Java application using prometheus?

 




Most Used Docker Commands:Interview Question

Pre-Requisite: 


What is Prometheus?


Prometheus is a free software application used for
 event monitoring and alerting. It records real-time metrics in a time series database (allowing for high dimensionality) built using a HTTP pull model, with flexible queries and real-time alerting.

Monitor Java Applications with Prometheus

This section will explain how an existing Java application can be updated to publish metrics and monitored by Prometheus.

Prometheus collects metrics from monitored targets by scraping metrics HTTP endpoints on these targets.

As discussed earlier, Prometheus collects metrics from monitored targets by scraping from an HTTP endpoint on these targets. By default, these metrics are expected to be published at /metrics. Any existing Java application can be updated to publish Prometheus-style metrics at this endpoint.

An earlier chapter explained a simple Java EE application that talks to a MySQL database. This application also publishes Prometheus-style metrics for the underlying JVM at /metrics. It also publishes application-specific metrics such as total number of times GET / and GET /{id} is called.

The complete set of JVM metrics are explained at https://github.com/prometheus/client_java. Refer to https://github.com/arun-gupta/docker-javaee/tree/master/employees/src/main/java/org/javaee/samples/employees/metrics for more details on how these metrics are enabled.

Start Java application

  1. Use the Compose file to deploy a simple the Java EE application. This will start WildFly Swarm application and MySQL database.

    docker stack deploy --compose-file=docker-compose.yml webapp

    This will create webapp_default overlay network, and start the webapp_web and webapp_db services.

  2. Verify the network:

    $ docker network ls
    NETWORK ID          NAME                DRIVER              SCOPE
    u6ybdaqx5h5y        webapp_default      overlay             swarm

    Other networks may be shown here as well.

  3. Verify the services:

    $ docker service ls
    ID                  NAME                MODE                REPLICAS            IMAGE                            PORTS
    ucztcpf1vw0a        webapp_db           replicated          1/1                 mysql:8                          *:3306->3306/tcp
    jttfgvr09kre        webapp_web          replicated          1/1                 arungupta/docker-javaee:latest   *:8080->8080/tcp,*:9990->9990/tcp
  4. Verify that the endpoint is accessible:

    $ curl http://localhost:8080/resources/employees
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?><collection><employee><id>1</id><name>Penny</name></employee><employee><id>2</id><name>Sheldon</name></employee><employee><id>3</id><name>Amy</name></employee><employee><id>4</id><name>Leonard</name></employee><employee><id>5</id><name>Bernadette</name></employee><employee><id>6</id><name>Raj</name></employee><employee><id>7</id><name>Howard</name></employee><employee><id>8</id><name>Priya</name></employee></collection>
  5. Access the metrics published by the endpoint using curl http://localhost:8080/metrics to see the output:

    # HELP jvm_info JVM version info
    # TYPE jvm_info gauge
    jvm_info{version="1.8.0_141-8u141-b15-1~deb9u1-b15",vendor="Oracle Corporation",} 1.0
    # HELP jvm_gc_collection_seconds Time spent in a given JVM garbage collector in seconds.
    # TYPE jvm_gc_collection_seconds summary
    jvm_gc_collection_seconds_count{gc="PS Scavenge",} 25.0
    jvm_gc_collection_seconds_sum{gc="PS Scavenge",} 0.386
    jvm_gc_collection_seconds_count{gc="PS MarkSweep",} 6.0
    jvm_gc_collection_seconds_sum{gc="PS MarkSweep",} 0.546
    # HELP process_cpu_seconds_total Total user and system CPU time spent in seconds.
    # TYPE process_cpu_seconds_total counter
    process_cpu_seconds_total 25.5
    # HELP process_start_time_seconds Start time of the process since unix epoch in seconds.
    # TYPE process_start_time_seconds gauge
    process_start_time_seconds 1.508056592419E9
    # HELP process_open_fds Number of open file descriptors.
    # TYPE process_open_fds gauge
    process_open_fds 499.0
    # HELP process_max_fds Maximum number of open file descriptors.
    # TYPE process_max_fds gauge
    process_max_fds 1048576.0
    # HELP process_virtual_memory_bytes Virtual memory size in bytes.
    # TYPE process_virtual_memory_bytes gauge
    process_virtual_memory_bytes 4.244393984E9
    # HELP process_resident_memory_bytes Resident memory size in bytes.
    # TYPE process_resident_memory_bytes gauge
    process_resident_memory_bytes 5.06601472E8
    # HELP jvm_classes_loaded The number of classes that are currently loaded in the JVM
    # TYPE jvm_classes_loaded gauge
    jvm_classes_loaded 13096.0
    # HELP jvm_classes_loaded_total The total number of classes that have been loaded since the JVM has started execution
    # TYPE jvm_classes_loaded_total counter
    jvm_classes_loaded_total 13096.0
    # HELP jvm_classes_unloaded_total The total number of classes that have been unloaded since the JVM has started execution
    # TYPE jvm_classes_unloaded_total counter
    jvm_classes_unloaded_total 0.0
    # HELP jvm_threads_current Current thread count of a JVM
    # TYPE jvm_threads_current gauge
    jvm_threads_current 60.0
    # HELP jvm_threads_daemon Daemon thread count of a JVM
    # TYPE jvm_threads_daemon gauge
    jvm_threads_daemon 12.0
    # HELP jvm_threads_peak Peak thread count of a JVM
    # TYPE jvm_threads_peak gauge
    jvm_threads_peak 67.0
    # HELP jvm_threads_started_total Started thread count of a JVM
    # TYPE jvm_threads_started_total counter
    jvm_threads_started_total 93.0
    # HELP jvm_threads_deadlocked Cycles of JVM-threads that are in deadlock waiting to acquire object monitors or ownable synchronizers
    # TYPE jvm_threads_deadlocked gauge
    jvm_threads_deadlocked 0.0
    # HELP jvm_threads_deadlocked_monitor Cycles of JVM-threads that are in deadlock waiting to acquire object monitors
    # TYPE jvm_threads_deadlocked_monitor gauge
    jvm_threads_deadlocked_monitor 0.0
    # HELP jvm_memory_bytes_used Used bytes of a given JVM memory area.
    # TYPE jvm_memory_bytes_used gauge
    jvm_memory_bytes_used{area="heap",} 1.2072508E8
    jvm_memory_bytes_used{area="nonheap",} 9.3550048E7
    # HELP jvm_memory_bytes_committed Committed (bytes) of a given JVM memory area.
    # TYPE jvm_memory_bytes_committed gauge
    jvm_memory_bytes_committed{area="heap",} 2.69484032E8
    jvm_memory_bytes_committed{area="nonheap",} 1.0133504E8
    # HELP jvm_memory_bytes_max Max (bytes) of a given JVM memory area.
    # TYPE jvm_memory_bytes_max gauge
    jvm_memory_bytes_max{area="heap",} 4.66092032E8
    jvm_memory_bytes_max{area="nonheap",} -1.0
    # HELP jvm_memory_pool_bytes_used Used bytes of a given JVM memory pool.
    # TYPE jvm_memory_pool_bytes_used gauge
    jvm_memory_pool_bytes_used{pool="Code Cache",} 1.4589888E7
    jvm_memory_pool_bytes_used{pool="Metaspace",} 6.9998048E7
    jvm_memory_pool_bytes_used{pool="Compressed Class Space",} 8962112.0
    jvm_memory_pool_bytes_used{pool="PS Eden Space",} 2.3732032E7
    jvm_memory_pool_bytes_used{pool="PS Survivor Space",} 6073592.0
    jvm_memory_pool_bytes_used{pool="PS Old Gen",} 9.0919456E7
    # HELP jvm_memory_pool_bytes_committed Committed bytes of a given JVM memory pool.
    # TYPE jvm_memory_pool_bytes_committed gauge
    jvm_memory_pool_bytes_committed{pool="Code Cache",} 1.47456E7
    jvm_memory_pool_bytes_committed{pool="Metaspace",} 7.5800576E7
    jvm_memory_pool_bytes_committed{pool="Compressed Class Space",} 1.0788864E7
    jvm_memory_pool_bytes_committed{pool="PS Eden Space",} 9.2274688E7
    jvm_memory_pool_bytes_committed{pool="PS Survivor Space",} 3.8797312E7
    jvm_memory_pool_bytes_committed{pool="PS Old Gen",} 1.38412032E8
    # HELP jvm_memory_pool_bytes_max Max bytes of a given JVM memory pool.
    # TYPE jvm_memory_pool_bytes_max gauge
    jvm_memory_pool_bytes_max{pool="Code Cache",} 2.5165824E8
    jvm_memory_pool_bytes_max{pool="Metaspace",} -1.0
    jvm_memory_pool_bytes_max{pool="Compressed Class Space",} 1.073741824E9
    jvm_memory_pool_bytes_max{pool="PS Eden Space",} 9.699328E7
    jvm_memory_pool_bytes_max{pool="PS Survivor Space",} 3.8797312E7
    jvm_memory_pool_bytes_max{pool="PS Old Gen",} 3.49700096E8

    It shows all the JVM metrics that are published by the Prometheus JVM Client. The metrics generated by the application are not shown yet. It requires for the application to be accessed first.

Let’s access the JVM metrics in Prometheus dashboard first, and then we’ll access the app to show app-specific metrics.

Start Prometheus service

  1. Make sure to terminate any previously running Prometheus endpoints:

    docker service rm metrics
  2. Create a directory prometheus and change into that directory.

  3. Create a text file prometheus.yml and add the following content:

    global:
      scrape_interval: 10s
    scrape_configs:
      - job_name: 'webapp'
        dns_sd_configs:
          - names: ['tasks.webapp_web']
            type: 'A'
            port: 8080

    This defines the configuration for the HTTP endpoint that publishes Prometheus-style metrics from the Java application.

  4. Start Prometheus service:

    docker service create \
      --replicas 1 \
      --network webapp_default \
      --name metrics \
      --mount type=bind,source=`pwd`/prometheus.yml,destination=/etc/prometheus/prometheus.yml \
      --publish 9090:9090 \
      prom/prometheus

    Note, this service is using the webapp_default overlay network that is created when the application stack was deployed.

  5. Access Prometheus dashboard at http://localhost:9090

  6. Check the configured targets at http://localhost:9090/targets:

    prometheus metrics target4

    It shows that the application metrics HTTP endpoint is configured as a Prometheus target.

View application metrics

  1. On Prometheus dashboard, click on -insert metric at cursor- to see the list of metrics available:

    prometheus metrics12

    JVM metrics shown earlier are displayed here as well.

  2. Select jvm_memory_pool_bytes_used metric and click on Execute to view the metric.

    prometheus metrics13
  3. Select Graph to view the graphical representation

    prometheus metrics14
  4. Now access the application using curl http://localhost:8080/resources/employees a few times.

  5. Refresh Prometheus dashboard and see the updated list of metrics:

    prometheus metrics15

    Note, app* and requests* that are generated by the application.

  6. Select requests_get_all metric and view the graph:

    prometheus metrics16
  7. Access the application a few times using curl http://localhost:8080/resources/employees/5 and then watch the requests_get_one metric.

****************************************

TOP 15 BDD - CUCUMBER Interview Q&A


************************************************

✍️AUTHORLinkedIn Profile

************************************************

Learn (API-Microservice)Testing+ Selenium UI Automation-SDET with Self Paced Videos prepared by FAANG employees and LIVE Doubt Session 

SDET TRANING VIDEOS AVAILABLE with Live Doubt Session(course-1 below,API TRaining Videos With Class Notes and Coding Set) and (API+UI, both course-1 & 2 below) Check Training Page for Course Content or reach out @whatsapp +91-9619094122. 
This includes classnotes, 300+ interview questions, 3 projects, Java Coding question set for product companies along with career guidance from FAANG employees for Automation and SDET.

For more details whatsapp : https://lnkd.in/dnBWDM33

*************************************************

SeleniumWebdriver Automation Testing Interview Questions:

https://automationreinvented.blogspot.com/search/label/SeleniumWebdriver

API Testing Interview Question Set:

https://automationreinvented.blogspot.com/2022/03/top-80-api-testing-interview-questions.html

DevOps Interview Q&A:

https://automationreinvented.blogspot.com/2021/11/top-11-devops-interview-questions-and.html 

Kubernetes Interview Question Set

https://automationreinvented.blogspot.com/search/label/Kubernetes

Docker Interview Question Set

https://automationreinvented.blogspot.com/Docker

Linux Interview question Set

https://automationreinvented.blogspot.com/search/label/Linux

Automation Testing/SDET Framework Design

https://automationreinvented.blogspot.com/search/label/FrameworkDesign

Java Related Interview Question Set

https://automationreinvented.blogspot.com/search/label/Java

GIT Interview Question Set:

https://automationreinvented.blogspot.com/2021/09/top-40-git-interview-questions-and.html

Coding Interview Question Set:

https://automationreinvented.blogspot.com/search/label/Coding%20Questions

Mobile Testing Interview Question Set:

https://automationreinvented.blogspot.com/search/label/Mobile%20Testing

Python Interview Question Set for QAE - SDET - SDE:

https://automationreinvented.blogspot.com/search/label/Python


All Time Popular Posts

Most Featured Post

AWS For Test Automation

YOU CAN FIND THE PPT SLIDES HERE: AWS FOR TEST AUTOMATION As QAs, we often want to explore the cloud, but don’t know where to start. Wi...