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

Mentix service #755

Merged
merged 13 commits into from
May 20, 2020
Merged

Mentix service #755

merged 13 commits into from
May 20, 2020

Conversation

Daniel-WWU-IT
Copy link
Contributor

This PR adds Mentix (Mesh Entity Exporter) as a Reva service. This includes:

  • Support for GOCDB as the data source
  • HTTP endpoint for getting the data in a standardized format (independent of the used source)
  • Exporting scrape configs for Prometheus
  • Example configuration file
  • Configuration documentation

For logging, I had to extend the rhttp NewService type to pass the global logger, as Mentix is actually a background service and needs logging outside of an HTTP request. I think that there should be services of a more general type so that services like Mentix can be added in a more elegant, streamlined way.

@labkode
Copy link
Member

labkode commented May 19, 2020

@Daniel-WWU-IT first of all, congrats for this astonishing piece of work, nice job!

For logging, I had to extend the rhttp NewService type to pass the global logger, as Mentix is actually a background service and needs logging outside of an HTTP request. I think that there should be services of a more general type so that services like Mentix can be added in a more elegant, streamlined way.

I couldn't agree more, let make sure is tracked in a Github issue for later.

One question, can you figure out the pat dependency where is used and from which pacakge? go mod why should help you.

I'm happy to merge after you make CI green (some lints are failling).

@Daniel-WWU-IT
Copy link
Contributor Author

@labkode I just updated everything to make lint happy and added some comments as well. The path package was used in network.utils, but I removed that dependency already (though it's a standard package).

@Daniel-WWU-IT
Copy link
Contributor Author

@labkode I created an issue for generic services: #757

@labkode
Copy link
Member

labkode commented May 19, 2020

@Daniel-WWU-IT
Copy link
Contributor Author

Daniel-WWU-IT commented May 19, 2020

I'm not using that package, neither directly nor indirectly. According to go mod why, it is used by the dataprovider service:

github.com/cs3org/reva/internal/http/services/dataprovider
github.com/tus/tusd/pkg/handler
github.com/bmizerany/pat

return nil
}

func (exporter *WebAPIExporter) GetName() string {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported method WebAPIExporter.GetName should have comment or be unexported

return nil
}

func (exporter *WebAPIExporter) HandleRequest(resp http.ResponseWriter, req *http.Request) error {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported method WebAPIExporter.HandleRequest should have comment or be unexported

BaseRequestExporter
}

func (exporter *WebAPIExporter) Activate(conf *config.Configuration, log *zerolog.Logger) error {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported method WebAPIExporter.Activate should have comment or be unexported

"github.com/cs3org/reva/pkg/mentix/exporters/webapi"
)

type WebAPIExporter struct {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported type WebAPIExporter should have comment or be unexported

return strings.TrimSpace(endpoint)
}

func (exporter *BaseRequestExporter) WantsRequest(r *http.Request) bool {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported method BaseRequestExporter.WantsRequest should have comment or be unexported

return nil
}

func (exporter *BaseExporter) Stop() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported method BaseExporter.Stop should have comment or be unexported

return nil
}

func (exporter *BaseExporter) Start() error {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported method BaseExporter.Start should have comment or be unexported

locker sync.RWMutex
}

func (exporter *BaseExporter) Activate(conf *config.Configuration, log *zerolog.Logger) error {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported method BaseExporter.Activate should have comment or be unexported

return properties
}

func (connector *GOCDBConnector) GetName() string {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported method GOCDBConnector.GetName should have comment or be unexported

return nil
}

func (connector *GOCDBConnector) RetrieveMeshData() (*meshdata.MeshData, error) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported method GOCDBConnector.RetrieveMeshData should have comment or be unexported

gocdbAddress string
}

func (connector *GOCDBConnector) Activate(conf *config.Configuration, log *zerolog.Logger) error {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported method GOCDBConnector.Activate should have comment or be unexported

"github.com/cs3org/reva/pkg/mentix/network"
)

type GOCDBConnector struct {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported type GOCDBConnector should have comment or be unexported

return nil
}

func FindConnector(connectorID string) (Connector, error) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported function FindConnector should have comment or be unexported

log *zerolog.Logger
}

func (connector *BaseConnector) Activate(conf *config.Configuration, log *zerolog.Logger) error {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported method BaseConnector.Activate should have comment or be unexported

)

const (
ExporterIDWebAPI = "webapi"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported const ExporterIDWebAPI should have comment (or a comment on this block) or be unexported

package config

const (
ConnectorIDGOCDB = "gocdb"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported const ConnectorIDGOCDB should have comment (or a comment on this block) or be unexported

@labkode labkode merged commit 05e7746 into cs3org:master May 20, 2020
@Daniel-WWU-IT Daniel-WWU-IT deleted the mentix branch May 20, 2020 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants