[ 
https://issues.apache.org/jira/browse/BEAM-5837?focusedWorklogId=158305&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-158305
 ]

ASF GitHub Bot logged work on BEAM-5837:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 24/Oct/18 20:26
            Start Date: 24/Oct/18 20:26
    Worklog Time Spent: 10m 
      Work Description: swegner closed pull request #6819: [BEAM-5837] Add 
health check prober for community metrics infrastructure
URL: https://github.com/apache/beam/pull/6819
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/.test-infra/jenkins/job_PostCommit_CommunityMetrics.groovy 
b/.test-infra/jenkins/job_PostCommit_CommunityMetrics.groovy
new file mode 100644
index 00000000000..3334c501b90
--- /dev/null
+++ b/.test-infra/jenkins/job_PostCommit_CommunityMetrics.groovy
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import CommonJobProperties as commonJobProperties
+
+job('beam_Prober_CommunityMetrics') {
+  description('Health check probes for the Community Metrics infrastructure')
+ commonJobProperties.setTopLevelMainJobProperties(delegate)
+
+ commonJobProperties.enablePhraseTriggeringFromPullRequest(delegate,
+     'Community Metrics Prober',
+     'Run Community Metrics Prober')
+
+ commonJobProperties.setAutoJob(delegate)
+
+ commonJobProperties.enablePhraseTriggeringFromPullRequest(
+         delegate,
+         'Community Metrics Prober',
+         'Run Community Metrics Prober')
+
+  // Gradle goals for this job.
+  steps {
+    gradle {
+      rootBuildScriptDir(commonJobProperties.checkoutDir)
+      tasks(':communityMetricsProber')
+      commonJobProperties.setGradleSwitches(delegate)
+    }
+  }
+}
diff --git a/.test-infra/jenkins/job_PreCommit_CommunityMetrics.groovy 
b/.test-infra/jenkins/job_PreCommit_CommunityMetrics.groovy
index 005204ed607..598bad152f9 100644
--- a/.test-infra/jenkins/job_PreCommit_CommunityMetrics.groovy
+++ b/.test-infra/jenkins/job_PreCommit_CommunityMetrics.groovy
@@ -21,7 +21,7 @@ import PrecommitJobBuilder
 PrecommitJobBuilder builder = new PrecommitJobBuilder(
     scope: this,
     nameBase: 'Community Metrics',
-    gradleTask: ':communitymetricsPreCommit',
+    gradleTask: ':communityMetricsPreCommit',
     triggerPathPatterns: ['^.test-infra/metrics/.*$']
 )
 builder.build()
diff --git a/.test-infra/metrics/build.gradle b/.test-infra/metrics/build.gradle
index 983a44c192f..b91f3023571 100644
--- a/.test-infra/metrics/build.gradle
+++ b/.test-infra/metrics/build.gradle
@@ -17,10 +17,20 @@
  */
 
 apply plugin: "base"
+apply plugin: "groovy"
+
+repositories {
+  mavenCentral()
+}
 
 // https://github.com/avast/gradle-docker-compose-plugin
 apply plugin: "com.avast.gradle.docker-compose"
 
+dependencies {
+  testCompile library.groovy.groovy_all
+  testCompile library.java.junit
+}
+
 task testMetricsStack {
   doLast {
     // TODO(BEAM-5837): Add some actual validation of the metrics stack
@@ -33,3 +43,6 @@ task preCommit {
   dependsOn testMetricsStack
 }
 
+task checkProber {
+  dependsOn test
+}
diff --git a/.test-infra/metrics/src/test/groovy/ProberTests.groovy 
b/.test-infra/metrics/src/test/groovy/ProberTests.groovy
new file mode 100644
index 00000000000..f365327c49a
--- /dev/null
+++ b/.test-infra/metrics/src/test/groovy/ProberTests.groovy
@@ -0,0 +1,42 @@
+#!groovy
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.junit.Test
+import groovy.json.JsonSlurper
+import static groovy.test.GroovyAssert.shouldFail
+
+/**
+ * Prober tests which performs health checks on deployed infrasture for
+ * community metrics.
+ */
+class ProberTests {
+  // TODO: Make this configurable
+  def grafanaEndpoint = 'http://104.154.241.245';
+
+  @Test
+  void PingGrafanaHttpApi() {
+    def allDashboardsJson = 
"${grafanaEndpoint}/api/search?type=dash-db".toURL().text
+    def allDashboards = new JsonSlurper().parseText(allDashboardsJson)
+    def dashboardNames = allDashboards.title
+    // Validate at least one expected dashboard exists
+    assert dashboardNames.contains('Post-commit Tests') : 'Expected dashboard 
does not exist'
+    assert dashboardNames.size >= 3 : "Number of dashboards is less than 
expected ${dashboardNames}"
+  }
+}
+
diff --git a/build.gradle b/build.gradle
index da88f4d0f47..f36328ad448 100644
--- a/build.gradle
+++ b/build.gradle
@@ -245,10 +245,13 @@ task websitePreCommit() {
 }
 
 task communityMetricsPreCommit() {
-  dependsOn ":rat"
   dependsOn ":beam-test-infra-metrics:preCommit"
 }
 
+task communityMetricsProber() {
+  dependsOn ":beam-test-infra-metrics:checkProber"
+}
+
 task javaExamplesDataflowPrecommit() {
   dependsOn ":beam-runners-google-cloud-dataflow-java-examples:preCommit"
   dependsOn 
":beam-runners-google-cloud-dataflow-java-examples-streaming:preCommit"
diff --git 
a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy 
b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy
index d88f2aa7a34..30d5926d9b8 100644
--- a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy
+++ b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy
@@ -441,6 +441,9 @@ class BeamModulePlugin implements Plugin<Project> {
         woodstox_core_asl                           : 
"org.codehaus.woodstox:woodstox-core-asl:4.4.1",
         quickcheck_core                             : 
"com.pholser:junit-quickcheck-core:$quickcheck_version",
       ],
+      groovy: [
+        groovy_all: "org.codehaus.groovy:groovy-all:2.4.13",
+      ],
       // For generating pom.xml from archetypes.
       maven: [
         maven_compiler_plugin: "maven-plugins:maven-compiler-plugin:3.7.0",
diff --git a/release/build.gradle b/release/build.gradle
index 20bca0540fb..f658d276568 100644
--- a/release/build.gradle
+++ b/release/build.gradle
@@ -23,7 +23,7 @@ repositories {
 }
 
 dependencies {
-  compile 'org.codehaus.groovy:groovy-all:2.4.13'
+  compile library.groovy.groovy_all
   compile 'commons-cli:commons-cli:1.2'
 }
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 158305)
    Time Spent: 1.5h  (was: 1h 20m)

> Add monitoring for community metrics pipeline
> ---------------------------------------------
>
>                 Key: BEAM-5837
>                 URL: https://issues.apache.org/jira/browse/BEAM-5837
>             Project: Beam
>          Issue Type: Sub-task
>          Components: project-management
>            Reporter: Scott Wegner
>            Assignee: Scott Wegner
>            Priority: Major
>          Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> For the new community metrics infrastructure, we need to build some 
> monitoring that can check the pipeline and make sure it's healthy.
> This could be implemented as a Jenkins job which can:
>  * Probe the Grafana dashboard URL to ensure Grafana is up
>  * Query some data from postgres to ensure the data is recent



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to