Skip to content

Aula 50 - Monitorando métricas com gráficos no Grafana #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 52 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
2cb7f8a
feat: code used in video 06
williamsuane Oct 27, 2020
fa6ab61
feat: code used in video 07
williamsuane Oct 27, 2020
18863d7
feat: code used in video 08
williamsuane Oct 27, 2020
42ee0e2
feat: code used in video 09
williamsuane Oct 27, 2020
c4a1e40
feat: code used in video 10
williamsuane Oct 27, 2020
04957af
feat: code used in video 11
williamsuane Oct 27, 2020
b60043a
feat: code used in video 12
williamsuane Oct 27, 2020
983bf94
feat: code used in video 13
williamsuane Oct 27, 2020
8aecb6e
feat: code used in video 14
williamsuane Oct 27, 2020
1b61b8e
feat: code used in video 15
williamsuane Oct 27, 2020
01f37e3
feat: code used in video 16
williamsuane Oct 28, 2020
2332b66
feat: code used in video 17
williamsuane Oct 28, 2020
0b6be7e
feat: code used in video 18
williamsuane Oct 28, 2020
1eb989f
feat: code used in video 19
williamsuane Oct 28, 2020
78dc10c
feat: code used in video 20
williamsuane Oct 28, 2020
a2957f7
Continuação SpringBoot-2 essentials
GuilhermeMelo01 Feb 25, 2022
ac43890
Merge pull request #1 from GuilhermeMelo01/keep
GuilhermeMelo01 Feb 25, 2022
5888a89
alteraçao do mapstruct
GuilhermeMelo01 Mar 12, 2022
56dd371
Merge pull request #2 from GuilhermeMelo01/keep
GuilhermeMelo01 Mar 12, 2022
ae740a6
Aula 22 - Sobrescrevendo handler do Spring
GuilhermeMelo01 Mar 13, 2022
0a8d783
Merge pull request #3 from GuilhermeMelo01/keep
GuilhermeMelo01 Mar 13, 2022
e9ef220
Aula 23 - Paginação
GuilhermeMelo01 Mar 13, 2022
24510c3
Aula 24 - WebMvcConfigurer
GuilhermeMelo01 Mar 13, 2022
89d9e18
Merge pull request #4 from GuilhermeMelo01/keep
GuilhermeMelo01 Mar 13, 2022
8855a53
Aula 25 - Sorting, Log SQL
GuilhermeMelo01 Mar 13, 2022
3bf9931
Merge pull request #5 from GuilhermeMelo01/master
GuilhermeMelo01 Mar 13, 2022
5f7e067
Aula 26 - RestTemplate getForObject e getForEntity
GuilhermeMelo01 Mar 14, 2022
de9e097
Aula 27 - RestTemplate exchange
GuilhermeMelo01 Mar 14, 2022
0e4ec0f
Aula 28 - RestTemplate POST
GuilhermeMelo01 Mar 15, 2022
e7fb092
Aula 29 - RestTemplate PUT and DELETE
GuilhermeMelo01 Mar 15, 2022
e08f173
Aula 30 - Spring Data JPA Test pt 01
GuilhermeMelo01 Mar 17, 2022
ad63193
Aula 31 - Spring Data JPA Test pt 02
GuilhermeMelo01 Mar 17, 2022
8250297
Aula 32 - Spring Data JPA Test pt 03 - Exceções
GuilhermeMelo01 Mar 18, 2022
696f88b
Aula 33 - Unit Tests pt 02
GuilhermeMelo01 Mar 18, 2022
a757d67
Aula 34 - Unit Tests pt 02
GuilhermeMelo01 Mar 21, 2022
e42f228
Aula 35 - Unit Tests pt 03
GuilhermeMelo01 Mar 21, 2022
cf7177b
Aula 36 - Testes de Integração pt 01
GuilhermeMelo01 Mar 22, 2022
10e4f39
Aula 37 - Testes de Integração pt 02
GuilhermeMelo01 Mar 22, 2022
f006cce
Aula 38 - Maven Profile Para Testes de Integração
GuilhermeMelo01 Mar 22, 2022
7e2a4f5
Aula 39 - Spring Security pt 01 - Autenticação em memória
GuilhermeMelo01 Mar 23, 2022
2e92d01
Aula 40 - Spring Security pt 01 - CSRF Token
GuilhermeMelo01 Mar 23, 2022
5031d05
Aula 41 - Spring Security pt 02 - Segurança a nível de métodos com Pr…
GuilhermeMelo01 Mar 24, 2022
37b6916
Aula 42 - Spring Security pt 03 - Authentication Principal e página p…
GuilhermeMelo01 Mar 24, 2022
2de7984
Aula 44 - Spring Security pt 05 - Proteção de URL com Antmatcher
GuilhermeMelo01 Mar 28, 2022
b88328b
Aula 45 1/2 - Spring Security pt 06 - Testes de Integração com Sprin…
GuilhermeMelo01 Mar 28, 2022
c9995ba
Aula 45 2/2 - Spring Security pt 06 - Testes de Integração com Sprin…
GuilhermeMelo01 Mar 28, 2022
a178fbd
Aula 46 - Documentação com SpringDoc OpenAPI pt 01
GuilhermeMelo01 Mar 29, 2022
ab7f003
Aula 46 - Documentação com SpringDoc OpenAPI pt 02
GuilhermeMelo01 Mar 29, 2022
bc1255c
Aula 48 - Spring Boot Actuator
GuilhermeMelo01 Mar 30, 2022
84f74ab
Aula 49 - Monitorando aplicação com prometheus
GuilhermeMelo01 Mar 30, 2022
23e7085
Aula 50 - Monitorando métricas com gráficos no Grafana
GuilhermeMelo01 Mar 30, 2022
37eb836
Aula 51 - Criado imagem com jib e executando via docker-compose
GuilhermeMelo01 Mar 31, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/

### VS Code ###
.vscode/
117 changes: 117 additions & 0 deletions .mvn/wrapper/MavenWrapperDownloader.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
/*
* Copyright 2007-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.net.*;
import java.io.*;
import java.nio.channels.*;
import java.util.Properties;

public class MavenWrapperDownloader {

private static final String WRAPPER_VERSION = "0.5.6";
/**
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
*/
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";

/**
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
* use instead of the default one.
*/
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
".mvn/wrapper/maven-wrapper.properties";

/**
* Path where the maven-wrapper.jar will be saved to.
*/
private static final String MAVEN_WRAPPER_JAR_PATH =
".mvn/wrapper/maven-wrapper.jar";

/**
* Name of the property which should be used to override the default download url for the wrapper.
*/
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";

public static void main(String args[]) {
System.out.println("- Downloader started");
File baseDirectory = new File(args[0]);
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());

// If the maven-wrapper.properties exists, read it and check if it contains a custom
// wrapperUrl parameter.
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
String url = DEFAULT_DOWNLOAD_URL;
if(mavenWrapperPropertyFile.exists()) {
FileInputStream mavenWrapperPropertyFileInputStream = null;
try {
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
Properties mavenWrapperProperties = new Properties();
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
} catch (IOException e) {
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
} finally {
try {
if(mavenWrapperPropertyFileInputStream != null) {
mavenWrapperPropertyFileInputStream.close();
}
} catch (IOException e) {
// Ignore ...
}
}
}
System.out.println("- Downloading from: " + url);

File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
if(!outputFile.getParentFile().exists()) {
if(!outputFile.getParentFile().mkdirs()) {
System.out.println(
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
}
}
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
try {
downloadFileFromURL(url, outputFile);
System.out.println("Done");
System.exit(0);
} catch (Throwable e) {
System.out.println("- Error downloading");
e.printStackTrace();
System.exit(1);
}
}

private static void downloadFileFromURL(String urlString, File destination) throws Exception {
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
String username = System.getenv("MVNW_USERNAME");
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
});
}
URL website = new URL(urlString);
ReadableByteChannel rbc;
rbc = Channels.newChannel(website.openStream());
FileOutputStream fos = new FileOutputStream(destination);
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
fos.close();
rbc.close();
}

}
Binary file added .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
2 changes: 2 additions & 0 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
45 changes: 45 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
version: '2.4'
x-database-variables: &database-variables
SPRING_DATASOURCE_URL: jdbc:mysql://mysql:3306/anime?createDatabaseIfNotExist=true
SPRING_DATASOURCE_USERNAME: root
SPRING_DATASOURCE_PASSWORD: root

services:
db:
image: mysql
container_name: mysql
environment:
MYSQL_ROOT_PASSWORD: root
ports:
- "3306:3306"
volumes:
- devdojo_data:/var/lib/mysql
mem_limit: 512m

prometheus:
image: prom/prometheus:latest
container_name: prometheus
volumes:
- "./src/main/resources/prometheus.yml:/etc/prometheus/prometheus.yml"
command: "--config.file=/etc/prometheus/prometheus.yml"
ports:
- "9090:9090"
mem_limit: 128m

grafana:
image: grafana/grafana:latest
container_name: grafana
ports:
- "3000:3000"
mem_limit: 128m

springboot2-essentials:
image: guilhermemelo01/springboot2-essentials:0.0.1-SNAPSHOT
ports:
- "8080:8080"
environment:
<<: *database-variables
mem_limit: 512m

volumes:
devdojo_data:
Loading