Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add successful stopped workspaces metric #13404

Merged
merged 3 commits into from
May 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 128 additions & 14 deletions deploy/openshift/templates/che-monitoring.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3897,6 +3897,7 @@ objects:
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"options": {},
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
Expand Down Expand Up @@ -3978,6 +3979,7 @@ objects:
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"options": {},
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
Expand Down Expand Up @@ -4060,12 +4062,14 @@ objects:
"linewidth": 1,
"links": [],
"nullPointMode": "null as zero",
"options": {},
"paceLength": 10,
"percentage": false,
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": true,
"steppedLine": false,
"targets": [
Expand Down Expand Up @@ -4131,50 +4135,60 @@ objects:
"dashLength": 10,
"dashes": false,
"datasource": "Che",
"description": "",
"fill": 1,
"gridPos": {
"h": 5,
"w": 6,
"x": 5,
"y": 7
},
"id": 8,
"id": 48,
"interval": "",
"legend": {
"avg": false,
"avg": true,
"current": true,
"max": false,
"min": false,
"max": true,
"min": true,
"show": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"nullPointMode": "null as zero",
"options": {},
"paceLength": 10,
"percentage": false,
"pointradius": 5,
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"stack": true,
"steppedLine": false,
"targets": [
{
"expr": "sum(che_workspace_failure_total)",
"expr": "sum(increase(che_workspace_failure_total{while=\"STOPPING\"} [1h])) /(sum(increase(che_workspace_failure_total{while=\"STOPPING\"} [1h])) + sum(increase(che_workspace_stopped_total [1h])))",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "failure",
"legendFormat": "fail",
"refId": "A"
},
{
"expr": "sum(increase(che_workspace_stopped_total [1h]))/(sum(increase(che_workspace_failure_total{while=\"STOPPING\"} [1h])) + sum(increase(che_workspace_stopped_total [1h])))",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "success",
"refId": "B"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Workspace Failures",
"title": "Workspace stop rate",
"tooltip": {
"shared": true,
"sort": 0,
Expand All @@ -4190,7 +4204,7 @@ objects:
},
"yaxes": [
{
"format": "short",
"format": "percentunit",
"label": null,
"logBase": 1,
"max": null,
Expand All @@ -4203,7 +4217,7 @@ objects:
"logBase": 1,
"max": null,
"min": null,
"show": true
"show": false
}
],
"yaxis": {
Expand All @@ -4220,7 +4234,7 @@ objects:
"fill": 1,
"gridPos": {
"h": 5,
"w": 6,
"w": 5,
"x": 11,
"y": 7
},
Expand All @@ -4238,6 +4252,7 @@ objects:
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"options": {},
"paceLength": 10,
"percentage": false,
"pointradius": 5,
Expand Down Expand Up @@ -4307,7 +4322,7 @@ objects:
"gridPos": {
"h": 5,
"w": 7,
"x": 17,
"x": 16,
"y": 7
},
"id": 10,
Expand All @@ -4324,6 +4339,7 @@ objects:
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"options": {},
"paceLength": 10,
"percentage": false,
"pointradius": 5,
Expand Down Expand Up @@ -4412,12 +4428,14 @@ objects:
"linewidth": 1,
"links": [],
"nullPointMode": "null as zero",
"options": {},
"paceLength": 10,
"percentage": false,
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
Expand Down Expand Up @@ -4471,6 +4489,93 @@ objects:
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "Che",
"fill": 1,
"gridPos": {
"h": 5,
"w": 6,
"x": 6,
"y": 12
},
"id": 8,
"legend": {
"avg": false,
"current": true,
"max": false,
"min": false,
"show": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"options": {},
"paceLength": 10,
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "sum(che_workspace_failure_total)",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "failure",
"refId": "A"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Workspace Failures",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"collapsed": false,
"gridPos": {
Expand Down Expand Up @@ -4511,6 +4616,7 @@ objects:
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"options": {},
"paceLength": 10,
"percentage": false,
"pointradius": 5,
Expand Down Expand Up @@ -4612,6 +4718,7 @@ objects:
"linewidth": 1,
"links": [],
"nullPointMode": "null as zero",
"options": {},
"paceLength": 10,
"percentage": false,
"pointradius": 5,
Expand Down Expand Up @@ -4724,6 +4831,7 @@ objects:
"linewidth": 1,
"links": [],
"nullPointMode": "null as zero",
"options": {},
"paceLength": 10,
"percentage": false,
"pointradius": 5,
Expand Down Expand Up @@ -4823,6 +4931,7 @@ objects:
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"options": {},
"paceLength": 10,
"percentage": false,
"pointradius": 5,
Expand Down Expand Up @@ -4919,6 +5028,7 @@ objects:
"linewidth": 1,
"links": [],
"nullPointMode": "null as zero",
"options": {},
"paceLength": 10,
"percentage": false,
"pointradius": 5,
Expand Down Expand Up @@ -5012,6 +5122,7 @@ objects:
"linewidth": 1,
"links": [],
"nullPointMode": "null as zero",
"options": {},
"paceLength": 10,
"percentage": false,
"pointradius": 5,
Expand Down Expand Up @@ -5107,6 +5218,7 @@ objects:
"linewidth": 1,
"links": [],
"nullPointMode": "null as zero",
"options": {},
"paceLength": 10,
"percentage": false,
"pointradius": 5,
Expand Down Expand Up @@ -5215,6 +5327,7 @@ objects:
"show": true
},
"links": [],
"options": {},
"targets": [
{
"expr": "increase(che_workspace_start_time_seconds_bucket{result=\"fail\"}[1h])",
Expand Down Expand Up @@ -5278,6 +5391,7 @@ objects:
"show": true
},
"links": [],
"options": {},
"targets": [
{
"expr": "increase(che_workspace_start_time_seconds_bucket{result=\"success\"} [1h])",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Copyright (c) 2012-2018 Red Hat, Inc.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
*/
package org.eclipse.che.api.metrics;

import static org.eclipse.che.api.metrics.WorkspaceBinders.workspaceMetric;

import com.google.inject.Inject;
import io.micrometer.core.instrument.Counter;
import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.binder.MeterBinder;
import javax.inject.Singleton;
import org.eclipse.che.api.core.model.workspace.WorkspaceStatus;
import org.eclipse.che.api.core.notification.EventService;
import org.eclipse.che.api.workspace.shared.dto.event.WorkspaceStatusEvent;

/** Counts number of successfully stopped workspaces. */
@Singleton
public class WorkspaceSuccessfulStopAttemptsMeterBinder implements MeterBinder {
private final EventService eventService;

private Counter stoppedCounter;

@Inject
public WorkspaceSuccessfulStopAttemptsMeterBinder(EventService eventService) {
this.eventService = eventService;
}

@Override
public void bindTo(MeterRegistry registry) {
stoppedCounter =
Counter.builder(workspaceMetric("stopped.total"))
.description("The count of stopped workspaces")
.register(registry);

// only subscribe to the event once we have the counters ready
eventService.subscribe(
event -> {
if ((event.getError() == null)
&& (event.getPrevStatus() == WorkspaceStatus.STOPPING
&& event.getStatus() == WorkspaceStatus.STOPPED)) {
stoppedCounter.increment();
}
},
WorkspaceStatusEvent.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ protected void configure() {
meterMultibinder.addBinding().to(WorkspaceFailureMeterBinder.class);
meterMultibinder.addBinding().to(WorkspaceStartTrackerMeterBinder.class);
meterMultibinder.addBinding().to(WorkspaceSuccessfulStartAttemptsMeterBinder.class);
meterMultibinder.addBinding().to(WorkspaceSuccessfulStopAttemptsMeterBinder.class);
meterMultibinder.addBinding().to(WorkspaceStartAttemptsMeterBinder.class);
meterMultibinder.addBinding().to(UserMeterBinder.class);
}
Expand Down
Loading