Přeskočit obsah
For the complete DHIS2 documentation index, see llms.txt.

Použití Glowroot

Glowroot je odlehčený Java Application Performance Monitor, který může být velmi užitečný při poskytování informací o problémech s výkonem při spuštění DHIS2.

Tato stránka má za cíl poskytnout rychlý přehled, který vám pomůže začít používat Glowroot.

Instalace

Installation is quite straightforward, and is described in the Glowroot wiki. We advise you to follow their instructions, which cover a variety of different environments.

Pro základní nastavení můžete začít pomocí několika jednoduchých kroků:

Download and unpack Glowroot

Vyberte nejnovější verzi Glowroot z jejich stránky vydání a rozbalte balíček do požadovaného umístění.

Example:

# create a location to install glowroot. I will use /opt/glowroot
mkdir -p /opt/glowroot

# download the chosen version and uncompress
cd /opt/glowroot
wget https://github.com/glowroot/glowroot/releases/download/v0.13.6/glowroot-0.13.6-dist.zip
unzip glowroot-0.13.6-dist.zip

# there should now be a file called /opt/glowroot/glowroot.jar

Note: make sure that the user who is running the DHIS2 service has write access to the glowroot install directory. E.g. If running DHIS2 under tomcat as `dhis` user:
chown -R dhis: /opt/glowroot

Set your DHIS2 service to use glowroot

Add -javaagent:path/to/glowroot.jar to your application servers' JVM args. This step is described well here. You can then restart DHIS2 to start using glowroot. By default it will be accessable on http://localhost:4000. In most cases you will want to access this remotely...

Set up external access to glowroot

If you want to access glowroot through a reverse proxy, such as nginx, you should configure it to redirect to the glowroot instance.

Pokud například běží na nginx, na hostiteli s názvem myserver.com a chcete získat přístup ke glowroot na https://myserver.com/glowroot V tomto případě musíte nastavit přesměrování v konfiguraci serveru nginx, jako například:

location /glowroot {
    proxy_pass    http://127.0.0.1:4000/glowroot;
}
Ve výše uvedeném příkladu, protože glowroot spouští kontextovou cestu glowroot, budete to muset také nastavit v konfiguraci glowroot. To lze změnit vytvořením (nebo úpravou) admin.json (ve stejném adresáři jako glowroot.jar), např. v sekci web:
{
  "web": {
    "contextPath": "/glowroot",
  }
}

Set an admin password

Nastavte heslo pro účet správce v části Správa -> Uživatelé v uživatelském rozhraní Glowroot

Usage Tips

Rozhraní Glowroot je docela intuitivní a doporučujeme vám ho prozkoumat, ale zde je několik tipů, na co byste se měli zaměřit.

Transactions tab

Záložky Transactions poskytují různé informace v reálném čase o různých rozhraních API obsluhovaných aplikací spolu s souvisejícími dotazy, dobami odezvy, pomalým trasováním atd. Přehled celkových transakcí API se zobrazí v levém podokně a při výběru jednotlivých rozhraní API. typu transakce, lze uvést podrobný rozpis slowtraces/dob odezvy/dotazů. Sledování této karty v reálném čase pomůže při identifikaci, zda některé konkrétní API nefunguje špatně. Odpovídající Slow Trace pro API lze otevřít na záložce Slow Traces, která poskytuje podrobné informace o konkrétním API. JVM Thread Stats a Query stats jsou užitečné, pokud jsou načteny ze slabě fungujícího pomalého trasování API, aby se zjistilo, zda je problém v konkrétním pomalém dotazu nebo zda existuje vysoká alokace paměti atd.

Errors tab

The Errors tab shows the exception stacktraces that has occurred during execution of any part of the system. Usually information from other tabs is required to get the complete picture.

JVM tab

Pozor

Tato záložka by se měla používat opatrně, protože existují možnosti vynutit GC (Garbage Collection) nebo provést Heap dump nebo Thread dump. Jejich zbytečné použití zvýší zátěž na JVM!

The JVM tab has certain sub sections that is useful to know the current state of the JVM. A useful area to check in the tab is the Mbean tree section. There are several configs exposed by Mbeans in DHIS2. Some of them are the connection pool configuration and it's current state. It shows the configuration of the connection pool like the maxPoolSize and other parameters as well as real-time state of the connection pool parameters like numBusyConnections, numConnections, numIdleConnections and so on which gives an idea of how the connection pool is behaving. If you notice that the numBusyConnection is equal to the maxPoolSize configuration, and if the database is not struggling for resources, it would be wise to increase the maxPoolSize dhis2 config so that the available connection pool is larger.

Reporting tab

The Reporting tab can be used to export any metric for a specific date/time range. It supports exporting Metrics like Response Time (Average or Percentile) or Transaction count from the Transactions tab. It also supports explorting metrics related to the JVM tab which include Guages for the different memory spaces. In most cases, real time monitoring and analysis will suffice, but it would be good to assess whether any exporting of specific metrics are needed for future reference.

Instrumentation

By default, glowroot will group all requests to an endpoint in one transaction group. This can be suboptimal in cases when you want to make optimisations to a specific flow and want to track the improvements. In these cases, glowroot can be instrumented to separate the requests into different transaction groups based on java method. That can be done in Configuration -> Instrumentation.

Example: separate GETs and POST's to /trackedEntityInstances

Načítání instancí trasovaných entit může být pomalejší než vytváření, takže může být užitečné monitorovat tyto typy požadavků samostatně. K dosažení toho lze do glowroot importovat následující konfiguraci (Instrumentace -> Import).

{
  "className": "org.hisp.dhis.webapi.controller.event.TrackedEntityInstanceController",
  "methodName": "getTrackedEntityInstances",
  "methodParameterTypes": [
    ".."
  ],
  "captureKind": "other",
  "transactionType": "Web",
  "transactionNameTemplate": "/api/trackedEntityInstances: GET"
}

Example: monitor asynchronous requests

Some asynchronous requests can not be monitored easily. One of those cases is tracker import using /tracker endpoint, with async parameter set to true ( applicable to 2.37 and up). That is because the initial request only returns a job id and doesn't wait for job to finish. To be able to monitor the internal process of tracker import, you import the following configuration (`Instrumentation -> Import).

{
    "className": "org.hisp.dhis.tracker.report.DefaultTrackerImportService",
    "methodName": "importTracker",
    "methodParameterTypes": [
      ".."
    ],
    "captureKind": "transaction",
    "transactionType": "Web",
    "transactionNameTemplate": "/api/tracker: import",
    "alreadyInTransactionBehavior": "capture-new-transaction",
    "traceEntryMessageTemplate": "{{0}}",
    "traceEntryStackThresholdMillis": 1000,
    "traceEntryCaptureSelfNested": true,
    "timerName": "Timer"
  }