Skip to content
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

feat : grafana LGTM sample #1189

Merged
merged 5 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
37 changes: 37 additions & 0 deletions boot-grafana-lgtm/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
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/

### Misc ###
*.log
.DS_Store
Binary file added boot-grafana-lgtm/.mvn/wrapper/maven-wrapper.jar
Binary file not shown.
18 changes: 18 additions & 0 deletions boot-grafana-lgtm/.mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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
#
# http://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.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
24 changes: 24 additions & 0 deletions boot-grafana-lgtm/ReadMe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# boot-grafana-lgtm

LGTM stands for Loki, Grafana, Tempo and Mimir. It’s Grafana’s tool stack that enables logs, metrics, and traces to be collected and visualized within a single stack of tools that works in harmony


**Grafana**

Grafana is the visualization tool for the whole stack. It allows you to visualize metrics, logs, traces, and many more with its plentiful dashboards and integrations.

**Loki**

Loki is the log aggregator of the LGTM stack. Logs are pushed to Loki, indexed based on given labels and stored within a defined storage. This can be the filesystem, a database (Cassandra, BigTable, DynamoDB), or an object storage. The logs can then be queried from Grafana or through Loki’s API using LogQL, a query language similar to Prometheus’ PromQL.

**Mimir**

Mimir is the long-term metric storage of the LGTM stack. It receives Prometheus metrics through its Prometheus remote write API and stores them on object storage. Metrics can be queried through Grafana or Mimir’s API using PromQL. Mimir is Prometheus-compatible, meaning that any application using Prometheus APIs can use Mimir without any change in the codebase.

**Tempo**

Tempo is the tracing backend of the LGTM stack. It collects traces in Jaeger, Zipkin, and OpenTelemetry formats. You can then query the traces from Grafana and visualize the path of every request within a distributed system.

**Flow**

![img.png](img.png)
rajadilipkolli marked this conversation as resolved.
Show resolved Hide resolved
rajadilipkolli marked this conversation as resolved.
Show resolved Hide resolved
17 changes: 17 additions & 0 deletions boot-grafana-lgtm/config/prometheus/prometheus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
global:
scrape_interval: 2s
evaluation_interval: 2s

scrape_configs:
- job_name: 'boot-grafana-lgtm'
scrape_interval: 2s
metrics_path: '/actuator/prometheus'
static_configs:
- targets: ['host.docker.internal:8080']
labels:
application: 'boot-grafana-lgtm'
- job_name: 'prometheus'
static_configs:
- targets: ['host.docker.internal:9090']
labels:
application: 'prometheus'
29 changes: 29 additions & 0 deletions boot-grafana-lgtm/docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: '3.8'
services:

grafanalgtm:
image: grafana/otel-lgtm:0.5.0
extra_hosts: ['host.docker.internal:host-gateway']
container_name: grafanalgtm
environment:
- OTEL_METRIC_EXPORT_INTERVAL=500
ports:
- "3000:3000"
- "4317:4317"
- "4318:4318"

prometheus:
image: prom/prometheus:v2.51.1
extra_hosts: ['host.docker.internal:host-gateway']
container_name: prometheus
command:
- --enable-feature=exemplar-storage
- --config.file=/etc/prometheus/prometheus.yml
volumes:
- ../config/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
ports:
- "9090:9090"
healthcheck:
interval: 5s
retries: 10
test: wget --no-verbose --tries=1 --spider http://localhost:9090/status || exit 1
Binary file added boot-grafana-lgtm/img.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading