-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add reliability calculations support to Mentix (#1649)
- Loading branch information
1 parent
8ea3ae0
commit 3387212
Showing
13 changed files
with
447 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Enhancement: Add reliability calculations support to Mentix | ||
|
||
To make reliability calculations possible, a new exporter has been added to Mentix that reads scheduled downtimes from the GOCDB and exposes it through Prometheus metrics. | ||
|
||
https://github.com/cs3org/reva/pull/1649 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
docs/content/en/docs/config/http/services/mentix/metrics/_index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
title: "metrics" | ||
linkTitle: "metrics" | ||
weight: 10 | ||
description: > | ||
Configuration for the Metrics exporter of the Mentix service | ||
--- | ||
|
||
{{% pageinfo %}} | ||
The Metrics exporter exposes site-specific metrics through Prometheus. | ||
{{% /pageinfo %}} | ||
|
||
{{% dir name="enabled_connectors" type="[]string" default="*" %}} | ||
A list of all enabled connectors for the exporter. | ||
{{< highlight toml >}} | ||
[http.services.mentix.exporters.metrics] | ||
enabled_connectors = ["gocdb"] | ||
{{< /highlight >}} | ||
{{% /dir %}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
// Copyright 2018-2020 CERN | ||
// | ||
// Licensed 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. | ||
// | ||
// In applying this license, CERN does not waive the privileges and immunities | ||
// granted to it by virtue of its status as an Intergovernmental Organization | ||
// or submit itself to any jurisdiction. | ||
|
||
package exporters | ||
|
||
import ( | ||
"github.com/cs3org/reva/pkg/mentix/config" | ||
"github.com/cs3org/reva/pkg/mentix/exchangers/exporters/metrics" | ||
"github.com/cs3org/reva/pkg/mentix/meshdata" | ||
"github.com/pkg/errors" | ||
"github.com/rs/zerolog" | ||
) | ||
|
||
// MetricsExporter exposes various Prometheus metrics. | ||
type MetricsExporter struct { | ||
BaseExporter | ||
|
||
metrics *metrics.Metrics | ||
} | ||
|
||
// Activate activates the exporter. | ||
func (exporter *MetricsExporter) Activate(conf *config.Configuration, log *zerolog.Logger) error { | ||
if err := exporter.BaseExporter.Activate(conf, log); err != nil { | ||
return err | ||
} | ||
|
||
// Create the metrics handler | ||
m, err := metrics.New(conf, log) | ||
if err != nil { | ||
return errors.Wrap(err, "unable to create metrics") | ||
} | ||
exporter.metrics = m | ||
|
||
// Store Metrics specifics | ||
exporter.SetEnabledConnectors(conf.Exporters.Metrics.EnabledConnectors) | ||
|
||
return nil | ||
} | ||
|
||
// Update is called whenever the mesh data set has changed to reflect these changes. | ||
func (exporter *MetricsExporter) Update(meshDataSet meshdata.Map) error { | ||
if err := exporter.BaseExporter.Update(meshDataSet); err != nil { | ||
return err | ||
} | ||
|
||
// Data is read, so acquire a read lock | ||
exporter.Locker().RLock() | ||
defer exporter.Locker().RUnlock() | ||
|
||
if err := exporter.metrics.Update(exporter.MeshData()); err != nil { | ||
return errors.Wrap(err, "error while updating the metrics") | ||
} | ||
|
||
return nil | ||
} | ||
|
||
// GetID returns the ID of the exporter. | ||
func (exporter *MetricsExporter) GetID() string { | ||
return config.ExporterIDMetrics | ||
} | ||
|
||
// GetName returns the display name of the exporter. | ||
func (exporter *MetricsExporter) GetName() string { | ||
return "Metrics" | ||
} | ||
|
||
func init() { | ||
registerExporter(&MetricsExporter{}) | ||
} |
Oops, something went wrong.