Skip to content

Commit

Permalink
[ci] Add Buildkite metrics/logs links to buildscans (#107719)
Browse files Browse the repository at this point in the history
  • Loading branch information
brianseeders authored Apr 22, 2024
1 parent 3e2dc4f commit 1100689
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
* Side Public License, v 1.
*/

import java.lang.management.ManagementFactory;
import java.time.LocalDateTime;

import org.elasticsearch.gradle.Architecture
import org.elasticsearch.gradle.OS
import org.elasticsearch.gradle.internal.info.BuildParams
Expand Down Expand Up @@ -118,6 +121,13 @@ buildScan {
}
}

def uptime = ManagementFactory.getRuntimeMXBean().getUptime() / 1000;
def metricsStartTime = LocalDateTime.now().minusSeconds(uptime.longValue()).minusMinutes(15).toString()
def metricsEndTime = LocalDateTime.now().plusMinutes(15).toString()

link 'Agent Metrics', "https://es-buildkite-agents.elastic.dev/app/metrics/detail/host/${System.getenv('BUILDKITE_AGENT_NAME')}?_a=(time:(from:%27${metricsStartTime}Z%27,interval:%3E%3D1m,to:%27${metricsEndTime}Z%27))"
link 'Agent Logs', "https://es-buildkite-agents.elastic.dev/app/logs/stream?logFilter=(filters:!(),query:(language:kuery,query:%27host.name:%20${System.getenv('BUILDKITE_AGENT_NAME')}%27),timeRange:(from:%27${metricsStartTime}Z%27,to:%27${metricsEndTime}Z%27))"

if (branch) {
tag branch
value 'Git Branch', branch
Expand Down

0 comments on commit 1100689

Please sign in to comment.