sematext / sematext-agent-java

Sematext Monitoring Agent
https://sematext.com/spm
Apache License 2.0
23 stars 9 forks source link

Agent runtime status #79

Closed bsmid closed 4 years ago

bsmid commented 4 years ago

Start writing agent status info into file

The file is located in /opt/spm/spm-monitor/run, it is named like /opt/spm/spm-monitor/run/53fcaf0a-de07-4b46-bacc-0f60f6bcbf33--default-monitor-0.status (same format as .lock files, but with different extension). Few examples of content:

startedAt=1595431789086
lastUpdate=1595432809975
metricsCollected=true
metricsSent=true
connectionStatus=OK
connectionErrors={}
startedAt=1595431789086
lastUpdate=1595432809975
metricsCollected=false
metricsSent=false
connectionStatus=FAILED
connectionErrors={Cannot load db driver class. Please check if the JDBC driver is in classpath=1595432214479}

I am not entirely happy with the implementation - AgentStatusRecorder instance being static and sprinkling N places in code with logic that calls different AgentStatusRecorder methods. Ideally this would be done in transparent and generic way, but making it right would require huge refactoring, so decided against it.