분류 전체보기
-
ELK 를 통한 사용자 요청에 대한 로그 수집🔍 elastic search/💡 elk 2022. 11. 23. 14:41
💬 Access Log 이용 이전에는 Elasticsearch를 이용해 access log를 수집 @Controller public class UserController { @GetMapping("/api/v1/users/") public User getUserInfo(@PathVariable("id") String id) { // 블라블라 } } 여기서 정의된 GET /v1/orders/ 라는 API가 사용되었지만 access log에는 다음과 같이 기록된다 127.0.0.1 - "GET /api/v1/users/A0000001 HTTP/1.1" 200 50 "-" "-" "127.0.0.1" 127.0.0.1 - "GET /api/v1/users/A0000002 HTTP/1.1" 200 50 "-" ..
-
ELK 구축 및 Filebeat로 로그 전송🔍 elastic search/💡 elk 2022. 11. 22. 11:23
📌 Docker Compose 로 ELK 구축 ELK 구축 https://github.com/deviantony/docker-elk mkdir ~/workspace cd ~/workspace git clone https://github.com/deviantony/docker-elk.git Logstash 파이프라인 설정 추가 Logstash 파이프라인 설정은 logstash/pipeline/logstash.conf 를 수정해주면 된다. Logstash 파이프라인 설정은 크게 다음의 3단계로 구성된다. Input Filter Output input { # FileBeat를 통해 로그 수집 beats { port => 5000 host => "0.0.0.0" ssl => false } tcp { port =..
-
애플리케이션 컨텍스트와 빈팩토리🌱 spring 2022. 11. 16. 11:23
❓애플리케이션 컨텍스트 (Application Context) 애플리케이션 컨텍스트는 빈들의 생성과 의존성 주입 등의 역할을 하는 일종의 DI 컨테이너이다. SpringBoot를 이용한다면 애플리케이션 종류에 따라 각기 다른 종류의 ApplicationContext가 내부에서 만들어진다. 웹 애플리케이션이 아닌 경우 애플리케이션 컨텍스트 : AnnotationConfigApplication 웹 서버 : ❌ 서블릿 기반의 웹 애플리케이션인 경우 애플리케이션 컨텍스트 : AnnotationConfigServletWebServerApplicationContext 웹 서버 : Tomcat 리액티브 웹 애플리케이션인 경우 애플리케이션 컨텍스트 : AnnotationConfigReactiveWebServerAppl..
-
7장 - 람다와 스트림📕 book/이펙티브 자바 2022. 11. 7. 18:27
자바 8에서 함수형 인터페이스, 람다, 메서드 참조라는 개념이 추가되면서 함수 객체를 더 쉽게 만들 수 있게 되었다. 이와 함께 스트림 API까지 추가되어 데이터 원소의 시퀀스 처리를 라이브러리 차원에서 지원하기 시작했다. 📌 익명 클래스보다는 람다를 사용하라 JDK 1.1. 이전 예전에는 자바에서 함수 타입을 표현할 때 추상 메서드를 하나만 담은 인터페이스(드물게는 추상클래스)를 사용했다. 이런 인터페이스의 인스턴스를 함수 객체(function object)라고 한다. JDK 1.1 JDK 1.1이 등장하면서 함수 객체를 만드는 주요한 수단은 익명 클래스가 되었다. 문자열을 길이순으로 정렬하기 위한 비교 함수로 익명 클래스를 사용 Collections.sort(words, new Comparator()..
-
6장 - 열거타입과 애너테이션📕 book/이펙티브 자바 2022. 11. 4. 19:21
자바의 특수한 목적의 참조타입 두가지 클래스의 일종인 열거 타입(Enum) 인터페이스의 일종인 어노테이션(annotation) 📌 int 상수 대신 열거 타입을 사용하라 열거 타입은 일정 개수의 상수 값을 정의한 후, 그 외의 값은 허용하지 않는 타입이다. 자바에서 열거 타입을 지원하기 전에는 정수 상수를 한 묶음 선언해서 사용하곤 했다. public static final int APPPLE_FUJI = 0; public static final int APPLE_PIPPIN = 1; public static final int APPLE_GRANNY_SMITH = 2; public static final int ORANGE_NAVEL = 0; public static final int ORANGE_TEM..
-
JPA - @ElementCollection🌱 spring 2022. 11. 2. 17:49
값 타입 컬렉션 값 타입 컬렉션이란 컬렉션에 값 타입을 담는 것을 의미한다 연관관계 매핑에서 엔티티를 컬렉션으로 사용하는 것이 아닌 값 타입을 컬렉션에 쓰는 것. 값 타입❓ 엔티티 ❓ 값 타입은 흔히 엔티티와 많이 비교 된다. 엔티티는 흔히 @Entity로 정의하는 객체이며 @Id라는 어노테이션으로 정의한 PK(식별자)를 통해 계속적으로 추적이 가능하다. 하지만, 값 타입은 식별자라는 개념이 존재하지 않아 추적이 어렵다. 값 타입은 흔히 우리가 사용하는 Integer, String 과 같은 자바 원시타입과 같은 존재이다. 흔히 사용하는 객체와 달리 공유에 안전하고 side effect가 발생하지 않는다. 임베디드 타입의 경우에는 구성 요소 자체가 값 타입으로 이루어져 있긴 하지만 임베디드 타입 자체가 불..
-
JPA - Embedded Type🌱 spring 2022. 11. 2. 17:23
🗂 JPA의 데이터 타입 분류 엔티티 타입 @Entity로 정의하는 객체 데이터가 변해도 식별자로 지속해서 추적 가능 값 타입 Integer, String 처럼 단순히 값으로 사용하는 자바 기본 타입이나 객체를 의미 식별자가 없고 값만 존재 → 변경시 추적 불가 값 타입 분류 기본 값 타입 자바 기본 타입 (int, double) 래퍼 클래스(Integer, Long) String 임베디드 타입 컬렉션 값 타입 임베디드 타입(Embedded Type) ❓ 복합 값 타입을 의미한다 새로운 값 타입을 직접 정의할 수 있다. JPA는 임베디드 타입 이라고 불려진다 주로 기본 값 타입을 모아서 만들어서 복합 값 타입이라고 한다. 직접 정의한 임베디드 타입도 int, String 처럼 값 타입이다!!! ⭐ 사용방..
-
3장 - 애그리거트📕 book/도메인 주도 개발 시작하기 2022. 11. 2. 16:05
⭐ 애그리거트 도메인 객체 모델이 복잡해지면 개별 구성요소 위주로 모델을 이해하게 되고 전반적인 구조나 큰 수준에서 도메인 간의 관계를 파악하기 어려워진다. 도메인 요소 간의 관계를 파악하기 어렵다는 것은 코드를 변경하고 확장하는 것이 어려워진다는 것을 의미 상위 수준에서 모델이 어떻게 엮여 있는지 알아야 전체 모델을 망가뜨리지 않으면서 추가 요구사항을 모델에 반영할 수 있는데, 세부적인 모델만 이해할 경우에는 코드 변경을 최대한 회피하는 쪽으로 요구사항을 협의하게 된다. 따라서, 복잡한 도메인을 이해하고 관리하기 쉬운 단위로 만들려면 상위 수준에서 모델을 조망할 수 있는 방법이 필요하다. → 애그리거트 관련된 객체를 하나의 군으로 묶음. 수 많은 객체를 애그리거트로 묶어서 바라보면 상위 수준에서 도메인..