https://alex.dzyoba.com/blog/jmx-exporter/
https://medium.com/@danielmrosa/monitoring-kafka-b97d2d5a5434
https://data-realtime-api-00:9291/data-realtime/indices/upa_reduction
| use std::{sync, thread}; | |
| use std::sync::{Arc, Mutex}; | |
| use std::sync::atomic::{AtomicBool, Ordering}; | |
| use std::time::{Duration, Instant}; | |
| use hdrhistogram::Histogram; | |
| pub struct HiccupMonitor { | |
| hiccup_nanos: u64, | |
| histogram: Arc<Mutex<Histogram<u64>>>, |
| package kamon.armeria | |
| import kamon.instrumentation.http.HttpMessage.Request | |
| import kamon.instrumentation.http.HttpOperationNameGenerator | |
| object Armeria | |
| class DefaultNameGenerator extends HttpOperationNameGenerator { | |
| import java.util.Locale |
| package com.example.demo; | |
| import kamon.Kamon; | |
| import kamon.prometheus.PrometheusReporter; | |
| import org.springframework.boot.SpringApplication; | |
| import org.springframework.boot.autoconfigure.SpringBootApplication; | |
| @SpringBootApplication | |
| public class KamonSpringExampleApplication { |
Muy útil para depurar los mensajes que se envían por la red.
Permite ver en tiempo real los paquetes TCP/UDP que están pasando por la red. Por ejemplo, podríamos entrar a una app y ver como se comunica con otra. Supongamos que se comunica app-02 mediante el puerto 2020:
sudo tcpdump -i any -A "host app-02 and port 2020"| package smart; | |
| import java.io.File; | |
| import java.io.FileNotFoundException; | |
| import java.io.RandomAccessFile; | |
| import java.nio.ByteBuffer; | |
| public class FileTransport implements Transport { | |
| private final RandomAccessFile file; |
| object GoogleService { | |
| def service[F[_]: Effect](c: Client[F]): HttpService[F] = { | |
| val dsl = new Http4sDsl[F]{} | |
| import dsl._ | |
| HttpService[F] { | |
| case GET -> Root / "not" => | |
| Thread.sleep((Math.random() * 1000).toLong) | |
| NotFound("NotFound") | |
| case req@GET -> Root / "call-google" => |
| /* | |
| * ========================================================================================= | |
| * Copyright © 2013-2018 the kamon project <http://kamon.io/> | |
| * | |
| * 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 | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software distributed under the |
| object Process { | |
| type UserTime = Long | |
| type KernelTime = Long | |
| type StartTime = Long | |
| //Hertz (number of clock ticks per second) of your system. | |
| val Hz: Long = executeCmd("getconf CLK_TCK").map(_.toLong).getOrElse(100L) | |
| /** |
| import java.util.concurrent.atomic.AtomicLong | |
| import scala.annotation.tailrec | |
| class LongMaxUpdater(value:AtomicLong) { | |
| def update(newMax:Long):Long = { | |
| @tailrec def compare():Long = { | |
| val currentMax = value.get() | |
| if(newMax > currentMax) { | |
| if (!value.compareAndSet(currentMax, newMax)) compare() | |
| else newMax |