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 удалений

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

@@ -7,6 +7,7 @@
package store
import (
"context"
timemodule "time"
"github.com/mattermost/mattermost-server/v5/einterfaces"
@@ -1207,6 +1208,22 @@ func (s *TimerLayerChannelStore) GetTeamChannels(teamId string) (*model.ChannelL
return resultVar0, resultVar1
}
func (s *TimerLayerChannelStore) GroupSyncedChannelCount() (int64, *model.AppError) {
start := timemodule.Now()
resultVar0, resultVar1 := s.ChannelStore.GroupSyncedChannelCount()
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
success := "false"
if resultVar1 == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GroupSyncedChannelCount", success, elapsed)
}
return resultVar0, resultVar1
}
func (s *TimerLayerChannelStore) IncrementMentionCount(channelId string, userId string) *model.AppError {
start := timemodule.Now()
@@ -2446,6 +2463,22 @@ func (s *TimerLayerFileInfoStore) GetForUser(userId string) ([]*model.FileInfo,
return resultVar0, resultVar1
}
func (s *TimerLayerFileInfoStore) GetWithOptions(page int, perPage int, opt *model.GetFileInfosOptions) ([]*model.FileInfo, *model.AppError) {
start := timemodule.Now()
resultVar0, resultVar1 := s.FileInfoStore.GetWithOptions(page, perPage, opt)
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
success := "false"
if resultVar1 == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("FileInfoStore.GetWithOptions", success, elapsed)
}
return resultVar0, resultVar1
}
func (s *TimerLayerFileInfoStore) InvalidateFileInfosForPostCache(postId string) {
start := timemodule.Now()
@@ -2733,6 +2766,22 @@ func (s *TimerLayerGroupStore) DeleteMember(groupID string, userID string) (*mod
return resultVar0, resultVar1
}
func (s *TimerLayerGroupStore) DistinctGroupMemberCount() (int64, *model.AppError) {
start := timemodule.Now()
resultVar0, resultVar1 := s.GroupStore.DistinctGroupMemberCount()
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
success := "false"
if resultVar1 == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.DistinctGroupMemberCount", success, elapsed)
}
return resultVar0, resultVar1
}
func (s *TimerLayerGroupStore) Get(groupID string) (*model.Group, *model.AppError) {
start := timemodule.Now()
@@ -2957,6 +3006,70 @@ func (s *TimerLayerGroupStore) GetMemberUsersPage(groupID string, page int, perP
return resultVar0, resultVar1
}
func (s *TimerLayerGroupStore) GroupChannelCount() (int64, *model.AppError) {
start := timemodule.Now()
resultVar0, resultVar1 := s.GroupStore.GroupChannelCount()
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
success := "false"
if resultVar1 == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.GroupChannelCount", success, elapsed)
}
return resultVar0, resultVar1
}
func (s *TimerLayerGroupStore) GroupCount() (int64, *model.AppError) {
start := timemodule.Now()
resultVar0, resultVar1 := s.GroupStore.GroupCount()
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
success := "false"
if resultVar1 == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.GroupCount", success, elapsed)
}
return resultVar0, resultVar1
}
func (s *TimerLayerGroupStore) GroupMemberCount() (int64, *model.AppError) {
start := timemodule.Now()
resultVar0, resultVar1 := s.GroupStore.GroupMemberCount()
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
success := "false"
if resultVar1 == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.GroupMemberCount", success, elapsed)
}
return resultVar0, resultVar1
}
func (s *TimerLayerGroupStore) GroupTeamCount() (int64, *model.AppError) {
start := timemodule.Now()
resultVar0, resultVar1 := s.GroupStore.GroupTeamCount()
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
success := "false"
if resultVar1 == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.GroupTeamCount", success, elapsed)
}
return resultVar0, resultVar1
}
func (s *TimerLayerGroupStore) PermanentDeleteMembersByUser(userId string) *model.AppError {
start := timemodule.Now()
@@ -5657,6 +5770,22 @@ func (s *TimerLayerTeamStore) GetUserTeamIds(userId string, allowFromCache bool)
return resultVar0, resultVar1
}
func (s *TimerLayerTeamStore) GroupSyncedTeamCount() (int64, *model.AppError) {
start := timemodule.Now()
resultVar0, resultVar1 := s.TeamStore.GroupSyncedTeamCount()
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
success := "false"
if resultVar1 == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.GroupSyncedTeamCount", success, elapsed)
}
return resultVar0, resultVar1
}
func (s *TimerLayerTeamStore) InvalidateAllTeamIdsForUser(userId string) {
start := timemodule.Now()
@@ -7701,6 +7830,10 @@ func (s *TimerLayer) MarkSystemRanUnitTests() {
s.Store.MarkSystemRanUnitTests()
}
func (s *TimerLayer) SetContext(context context.Context) {
s.Store.SetContext(context)
}
func (s *TimerLayer) TotalMasterDbConnections() int {
return s.Store.TotalMasterDbConnections()
}