"If a worker wants to do his job well, he must first sharpen his tools." - Confucius, "The Analects of Confucius. Lu Linggong"
Front page > Programming > Grafana Opentelemetry Starter

Grafana Opentelemetry Starter

Published on 2024-08-25
Browse:568

Grafana Hotel LGTM

I want to view server logs and traces with Grafana, but when I look for them, they all tell me to just set up a configuration file and launch a node in Kubernates, so there is a starter for people who don't feel like giving up.

grafana-otel-lgtm allows you to easily launch Loki, Grafana, Tempo, and Mimir locally without any configuration.

Overview of Grafana Otel LGTM

The grafana/otel-lgtm Docker image comes with OpenTelemetry Collector, Prometheus, Loki, Tempo, and Grafana preset as default settings.

It is easy to understand if you look at the picture below.

Grafana Opentelemetry Starter

Flow as seen in the picture

1

The application sends it to port 4317 (grpc) or 4318 (http) using the OTLP protocol.

2

The Opentelemetry Collector is listening to the port, collects it, and transmits it to Prometheus for Metric, Loki for Log, and Tempo for Trace depending on the type of signal.

3

Prometheus, Loki, and Tempo store signals in their respective storage.

4

Connect to Grafana at localhost:3000 and visualize the accumulated data through queries.

How to set up

It is simple to key locally.

1. Pull docker image

docker pull grafana/otel-lgtm

2. Run run script

Write and run the run-lgtm.sh script.
#!/bin/bash

RELEASE=${1:-latest}

docker run \
  --name lgtm \
  -p 3000:3000 \
  -p 4317:4317 \
  -p 4318:4318 \
  --rm \
  -ti \
  -v $PWD/container/grafana:/data/grafana \
  -v $PWD/container/prometheus:/data/prometheus \
  -v $PWD/container/loki:/loki \
  -e GF_PATHS_DATA=/data/grafana \
  docker.io/grafana/otel-lgtm:${RELEASE}
execution result
sh run-lgtm.sh
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
Waiting for the OpenTelemetry collector and the Grafana LGTM stack to start up...

When I run it on an Apple silicon MacBook, the warning above appears, but it doesn't really matter since I'm using it locally for testing.

Docker execution screen

Grafana Opentelemetry Starter

(You can check that ports 3000, 4317, and 4318 are open)

Grafana login screen

Let’s connect to localhost:3000.

You can log in as admin/admin.

Grafana Opentelemetry Starter

Release Statement This article is reproduced at: https://dev.to/siisee11/grafana-opentelemetry-starter-df4?1 If there is any infringement, please contact [email protected] to delete it
Latest tutorial More>

Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.

Copyright© 2022 湘ICP备2022001581号-3