MM-21898: Part 2. Add opentracing (#13904)

* initial implementation of opentracing

* app layer

* Revert Makefile

* .

* cleanup

* .

* .

* .

* .

* .

* .

* .

* .

* .

* .

* .

* [ci]

* autogenerate interface

* .

* missed vendor files

* updated interfaces

* updated store layers

* lint fixes

* .

* finishing layer generators and nested spans

* added errors and b3 support

* code review

* .

* .

* fixed build error due to misplased flag.Parse()

* code review addressed
Этот коммит содержится в:
Miguel de la Cruz
2020-03-05 14:46:08 +01:00
коммит произвёл GitHub
родитель 5a34ec4793
Коммит 182c29b456
154 изменённых файлов: 47653 добавлений и 264 удалений

Просмотреть файл

@@ -35,6 +35,7 @@ import (
"github.com/mattermost/mattermost-server/v5/services/httpservice"
"github.com/mattermost/mattermost-server/v5/services/imageproxy"
"github.com/mattermost/mattermost-server/v5/services/timezones"
"github.com/mattermost/mattermost-server/v5/services/tracing"
"github.com/mattermost/mattermost-server/v5/store"
"github.com/mattermost/mattermost-server/v5/utils"
)
@@ -135,6 +136,8 @@ type Server struct {
Saml einterfaces.SamlInterface
CacheProvider cache.Provider
tracer *tracing.Tracer
}
func NewServer(options ...Option) (*Server, error) {
@@ -178,6 +181,14 @@ func NewServer(options ...Option) (*Server, error) {
// Use this app logger as the global logger (eventually remove all instances of global logging)
mlog.InitGlobalLogger(s.Log)
if *s.Config().ServiceSettings.EnableOpenTracing {
tracer, err := tracing.New()
if err != nil {
return nil, err
}
s.tracer = tracer
}
s.logListenerId = s.AddConfigListener(func(_, after *model.Config) {
s.Log.ChangeLevels(utils.MloggerConfigFromLoggerConfig(&after.LogSettings, utils.GetLogFileLocation))
@@ -374,6 +385,12 @@ func (s *Server) Shutdown() error {
s.RunOldAppShutdown()
if s.tracer != nil {
if err := s.tracer.Close(); err != nil {
mlog.Error("Unable to cleanly shutdown opentracing client", mlog.Err(err))
}
}
err := s.shutdownDiagnostics()
if err != nil {
mlog.Error("Unable to cleanly shutdown diagnostic client", mlog.Err(err))