Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
43358973
Unverified
Commit
43358973
authored
Mar 05, 2023
by
boojack
Committed by
GitHub
Mar 05, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: remove metrics plugin (#1276)
* chore: remove metrics plugin * chore: update
parent
6201dcf1
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
3 additions
and
164 deletions
+3
-164
go.mod
go.mod
+0
-4
go.sum
go.sum
+0
-8
collector.go
plugin/metrics/collector.go
+0
-14
collector.go
plugin/metrics/segment/collector.go
+0
-45
auth.go
server/auth.go
+0
-7
memo.go
server/memo.go
+0
-4
metric_collector.go
server/metric_collector.go
+0
-62
resource.go
server/resource.go
+0
-4
server.go
server/server.go
+3
-12
user.go
server/user.go
+0
-4
No files found.
go.mod
View file @
43358973
...
@@ -15,7 +15,6 @@ require (
...
@@ -15,7 +15,6 @@ require (
github.com/labstack/echo/v4 v4.9.0
github.com/labstack/echo/v4 v4.9.0
github.com/mattn/go-sqlite3 v1.14.9
github.com/mattn/go-sqlite3 v1.14.9
github.com/pkg/errors v0.9.1
github.com/pkg/errors v0.9.1
github.com/segmentio/analytics-go v3.1.0+incompatible
github.com/spf13/cobra v1.6.1
github.com/spf13/cobra v1.6.1
github.com/spf13/viper v1.15.0
github.com/spf13/viper v1.15.0
github.com/stretchr/testify v1.8.1
github.com/stretchr/testify v1.8.1
...
@@ -42,7 +41,6 @@ require (
...
@@ -42,7 +41,6 @@ require (
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.1 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.1 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.18.3 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.18.3 // indirect
github.com/aws/smithy-go v1.13.5 // indirect
github.com/aws/smithy-go v1.13.5 // indirect
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
...
@@ -60,7 +58,6 @@ require (
...
@@ -60,7 +58,6 @@ require (
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/segmentio/backo-go v1.0.1 // indirect
github.com/spf13/afero v1.9.3 // indirect
github.com/spf13/afero v1.9.3 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
...
@@ -68,7 +65,6 @@ require (
...
@@ -68,7 +65,6 @@ require (
github.com/subosito/gotenv v1.4.2 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.1 // indirect
github.com/valyala/fasttemplate v1.2.1 // indirect
github.com/xtgo/uuid v0.0.0-20140804021211-a0b114877d4c // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/sys v0.5.0 // indirect
...
...
go.sum
View file @
43358973
...
@@ -79,8 +79,6 @@ github.com/aws/aws-sdk-go-v2/service/sts v1.18.3/go.mod h1:b+psTJn33Q4qGoDaM7ZiO
...
@@ -79,8 +79,6 @@ github.com/aws/aws-sdk-go-v2/service/sts v1.18.3/go.mod h1:b+psTJn33Q4qGoDaM7ZiO
github.com/aws/smithy-go v1.13.5 h1:hgz0X/DX0dGqTYpGALqXJoRKRj5oQ7150i5FdTePzO8=
github.com/aws/smithy-go v1.13.5 h1:hgz0X/DX0dGqTYpGALqXJoRKRj5oQ7150i5FdTePzO8=
github.com/aws/smithy-go v1.13.5/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA=
github.com/aws/smithy-go v1.13.5/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA=
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY=
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
...
@@ -232,10 +230,6 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR
...
@@ -232,10 +230,6 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/segmentio/analytics-go v3.1.0+incompatible h1:IyiOfUgQFVHvsykKKbdI7ZsH374uv3/DfZUo9+G0Z80=
github.com/segmentio/analytics-go v3.1.0+incompatible/go.mod h1:C7CYBtQWk4vRk2RyLu0qOcbHJ18E3F1HV2C/8JvKN48=
github.com/segmentio/backo-go v1.0.1 h1:68RQccglxZeyURy93ASB/2kc9QudzgIDexJ927N++y4=
github.com/segmentio/backo-go v1.0.1/go.mod h1:9/Rh6yILuLysoQnZ2oNooD2g7aBnvM7r/fNVxRNWfBc=
github.com/spf13/afero v1.9.3 h1:41FoI0fD7OR7mGcKE/aOiLkGreyf8ifIOQmJANWogMk=
github.com/spf13/afero v1.9.3 h1:41FoI0fD7OR7mGcKE/aOiLkGreyf8ifIOQmJANWogMk=
github.com/spf13/afero v1.9.3/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y=
github.com/spf13/afero v1.9.3/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y=
github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w=
github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w=
...
@@ -266,8 +260,6 @@ github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6Kllzaw
...
@@ -266,8 +260,6 @@ github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6Kllzaw
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasttemplate v1.2.1 h1:TVEnxayobAdVkhQfrfes2IzOB6o+z4roRkPF52WA1u4=
github.com/valyala/fasttemplate v1.2.1 h1:TVEnxayobAdVkhQfrfes2IzOB6o+z4roRkPF52WA1u4=
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
github.com/xtgo/uuid v0.0.0-20140804021211-a0b114877d4c h1:3lbZUMbMiGUW/LMkfsEABsc5zNT9+b1CvsJx47JzJ8g=
github.com/xtgo/uuid v0.0.0-20140804021211-a0b114877d4c/go.mod h1:UrdRz5enIKZ63MEE3IF9l2/ebyx59GyGgPi+tICQdmM=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
...
...
plugin/metrics/collector.go
deleted
100644 → 0
View file @
6201dcf1
package
metric
// Metric is the API message for metric.
type
Metric
struct
{
ID
string
Name
string
Labels
map
[
string
]
string
}
// Collector is the interface definition for metric collector.
type
Collector
interface
{
Identify
(
id
string
)
error
Collect
(
metric
*
Metric
)
error
}
plugin/metrics/segment/collector.go
deleted
100644 → 0
View file @
6201dcf1
package
segment
import
(
"time"
"github.com/segmentio/analytics-go"
metric
"github.com/usememos/memos/plugin/metrics"
)
// collector is the metrics collector https://segment.com/.
type
collector
struct
{
client
analytics
.
Client
}
// NewCollector creates a new instance of segment.
func
NewCollector
(
key
string
)
metric
.
Collector
{
client
:=
analytics
.
New
(
key
)
return
&
collector
{
client
:
client
,
}
}
// Identify will identify the server caller.
func
(
c
*
collector
)
Identify
(
id
string
)
error
{
return
c
.
client
.
Enqueue
(
analytics
.
Identify
{
UserId
:
id
,
Timestamp
:
time
.
Now
()
.
UTC
(),
})
}
// Collect will exec all the segment collector.
func
(
c
*
collector
)
Collect
(
metric
*
metric
.
Metric
)
error
{
properties
:=
analytics
.
NewProperties
()
for
key
,
value
:=
range
metric
.
Labels
{
properties
.
Set
(
key
,
value
)
}
return
c
.
client
.
Enqueue
(
analytics
.
Track
{
UserId
:
metric
.
ID
,
Timestamp
:
time
.
Now
()
.
UTC
(),
Event
:
metric
.
Name
,
Properties
:
properties
,
})
}
server/auth.go
View file @
43358973
...
@@ -11,7 +11,6 @@ import (
...
@@ -11,7 +11,6 @@ import (
"github.com/usememos/memos/common"
"github.com/usememos/memos/common"
"github.com/usememos/memos/plugin/idp"
"github.com/usememos/memos/plugin/idp"
"github.com/usememos/memos/plugin/idp/oauth2"
"github.com/usememos/memos/plugin/idp/oauth2"
metric
"github.com/usememos/memos/plugin/metrics"
"github.com/usememos/memos/store"
"github.com/usememos/memos/store"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4"
...
@@ -237,9 +236,6 @@ func (s *Server) createUserAuthSignInActivity(c echo.Context, user *api.User) er
...
@@ -237,9 +236,6 @@ func (s *Server) createUserAuthSignInActivity(c echo.Context, user *api.User) er
if
err
!=
nil
||
activity
==
nil
{
if
err
!=
nil
||
activity
==
nil
{
return
errors
.
Wrap
(
err
,
"failed to create activity"
)
return
errors
.
Wrap
(
err
,
"failed to create activity"
)
}
}
s
.
Collector
.
Collect
(
ctx
,
&
metric
.
Metric
{
Name
:
string
(
activity
.
Type
),
})
return
err
return
err
}
}
...
@@ -262,8 +258,5 @@ func (s *Server) createUserAuthSignUpActivity(c echo.Context, user *api.User) er
...
@@ -262,8 +258,5 @@ func (s *Server) createUserAuthSignUpActivity(c echo.Context, user *api.User) er
if
err
!=
nil
||
activity
==
nil
{
if
err
!=
nil
||
activity
==
nil
{
return
errors
.
Wrap
(
err
,
"failed to create activity"
)
return
errors
.
Wrap
(
err
,
"failed to create activity"
)
}
}
s
.
Collector
.
Collect
(
ctx
,
&
metric
.
Metric
{
Name
:
string
(
activity
.
Type
),
})
return
err
return
err
}
}
server/memo.go
View file @
43358973
...
@@ -11,7 +11,6 @@ import (
...
@@ -11,7 +11,6 @@ import (
"github.com/pkg/errors"
"github.com/pkg/errors"
"github.com/usememos/memos/api"
"github.com/usememos/memos/api"
"github.com/usememos/memos/common"
"github.com/usememos/memos/common"
metric
"github.com/usememos/memos/plugin/metrics"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4"
)
)
...
@@ -504,8 +503,5 @@ func (s *Server) createMemoCreateActivity(c echo.Context, memo *api.Memo) error
...
@@ -504,8 +503,5 @@ func (s *Server) createMemoCreateActivity(c echo.Context, memo *api.Memo) error
if
err
!=
nil
||
activity
==
nil
{
if
err
!=
nil
||
activity
==
nil
{
return
errors
.
Wrap
(
err
,
"failed to create activity"
)
return
errors
.
Wrap
(
err
,
"failed to create activity"
)
}
}
s
.
Collector
.
Collect
(
ctx
,
&
metric
.
Metric
{
Name
:
string
(
activity
.
Type
),
})
return
err
return
err
}
}
server/metric_collector.go
deleted
100644 → 0
View file @
6201dcf1
package
server
import
(
"context"
"fmt"
metric
"github.com/usememos/memos/plugin/metrics"
"github.com/usememos/memos/plugin/metrics/segment"
"github.com/usememos/memos/server/profile"
"github.com/usememos/memos/server/version"
)
// MetricCollector is the metric collector.
type
MetricCollector
struct
{
collector
metric
.
Collector
ID
string
Enabled
bool
Profile
*
profile
.
Profile
}
const
(
segmentMetricWriteKey
=
"NbPruMMmfqfD2AMCw3pkxZTsszVS3hKq"
)
func
(
s
*
Server
)
registerMetricCollector
()
{
c
:=
segment
.
NewCollector
(
segmentMetricWriteKey
)
mc
:=
&
MetricCollector
{
collector
:
c
,
ID
:
s
.
ID
,
Enabled
:
false
,
Profile
:
s
.
Profile
,
}
s
.
Collector
=
mc
}
func
(
mc
*
MetricCollector
)
Identify
(
_
context
.
Context
)
{
if
!
mc
.
Enabled
{
return
}
err
:=
mc
.
collector
.
Identify
(
mc
.
ID
)
if
err
!=
nil
{
fmt
.
Printf
(
"Failed to request segment, error: %+v
\n
"
,
err
)
}
}
func
(
mc
*
MetricCollector
)
Collect
(
_
context
.
Context
,
metric
*
metric
.
Metric
)
{
if
!
mc
.
Enabled
{
return
}
if
metric
.
Labels
==
nil
{
metric
.
Labels
=
map
[
string
]
string
{}
}
metric
.
Labels
[
"mode"
]
=
mc
.
Profile
.
Mode
metric
.
Labels
[
"version"
]
=
version
.
GetCurrentVersion
(
mc
.
Profile
.
Mode
)
metric
.
ID
=
mc
.
ID
err
:=
mc
.
collector
.
Collect
(
metric
)
if
err
!=
nil
{
fmt
.
Printf
(
"Failed to request segment, error: %+v
\n
"
,
err
)
}
}
server/resource.go
View file @
43358973
...
@@ -15,7 +15,6 @@ import (
...
@@ -15,7 +15,6 @@ import (
"github.com/pkg/errors"
"github.com/pkg/errors"
"github.com/usememos/memos/api"
"github.com/usememos/memos/api"
"github.com/usememos/memos/common"
"github.com/usememos/memos/common"
metric
"github.com/usememos/memos/plugin/metrics"
"github.com/usememos/memos/plugin/storage/s3"
"github.com/usememos/memos/plugin/storage/s3"
)
)
...
@@ -396,8 +395,5 @@ func (s *Server) createResourceCreateActivity(c echo.Context, resource *api.Reso
...
@@ -396,8 +395,5 @@ func (s *Server) createResourceCreateActivity(c echo.Context, resource *api.Reso
if
err
!=
nil
||
activity
==
nil
{
if
err
!=
nil
||
activity
==
nil
{
return
errors
.
Wrap
(
err
,
"failed to create activity"
)
return
errors
.
Wrap
(
err
,
"failed to create activity"
)
}
}
s
.
Collector
.
Collect
(
ctx
,
&
metric
.
Metric
{
Name
:
string
(
activity
.
Type
),
})
return
err
return
err
}
}
server/server.go
View file @
43358973
...
@@ -9,7 +9,6 @@ import (
...
@@ -9,7 +9,6 @@ import (
"github.com/pkg/errors"
"github.com/pkg/errors"
"github.com/usememos/memos/api"
"github.com/usememos/memos/api"
metric
"github.com/usememos/memos/plugin/metrics"
"github.com/usememos/memos/server/profile"
"github.com/usememos/memos/server/profile"
"github.com/usememos/memos/store"
"github.com/usememos/memos/store"
"github.com/usememos/memos/store/db"
"github.com/usememos/memos/store/db"
...
@@ -24,10 +23,9 @@ type Server struct {
...
@@ -24,10 +23,9 @@ type Server struct {
e
*
echo
.
Echo
e
*
echo
.
Echo
db
*
sql
.
DB
db
*
sql
.
DB
ID
string
ID
string
Profile
*
profile
.
Profile
Profile
*
profile
.
Profile
Store
*
store
.
Store
Store
*
store
.
Store
Collector
*
MetricCollector
}
}
func
NewServer
(
ctx
context
.
Context
,
profile
*
profile
.
Profile
)
(
*
Server
,
error
)
{
func
NewServer
(
ctx
context
.
Context
,
profile
*
profile
.
Profile
)
(
*
Server
,
error
)
{
...
@@ -94,9 +92,6 @@ func NewServer(ctx context.Context, profile *profile.Profile) (*Server, error) {
...
@@ -94,9 +92,6 @@ func NewServer(ctx context.Context, profile *profile.Profile) (*Server, error) {
embedFrontend
(
e
)
embedFrontend
(
e
)
// Register MetricCollector to server.
s
.
registerMetricCollector
()
rootGroup
:=
e
.
Group
(
""
)
rootGroup
:=
e
.
Group
(
""
)
s
.
registerRSSRoutes
(
rootGroup
)
s
.
registerRSSRoutes
(
rootGroup
)
...
@@ -126,7 +121,6 @@ func (s *Server) Start(ctx context.Context) error {
...
@@ -126,7 +121,6 @@ func (s *Server) Start(ctx context.Context) error {
if
err
:=
s
.
createServerStartActivity
(
ctx
);
err
!=
nil
{
if
err
:=
s
.
createServerStartActivity
(
ctx
);
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"failed to create activity"
)
return
errors
.
Wrap
(
err
,
"failed to create activity"
)
}
}
s
.
Collector
.
Identify
(
ctx
)
return
s
.
e
.
Start
(
fmt
.
Sprintf
(
":%d"
,
s
.
Profile
.
Port
))
return
s
.
e
.
Start
(
fmt
.
Sprintf
(
":%d"
,
s
.
Profile
.
Port
))
}
}
...
@@ -165,8 +159,5 @@ func (s *Server) createServerStartActivity(ctx context.Context) error {
...
@@ -165,8 +159,5 @@ func (s *Server) createServerStartActivity(ctx context.Context) error {
if
err
!=
nil
||
activity
==
nil
{
if
err
!=
nil
||
activity
==
nil
{
return
errors
.
Wrap
(
err
,
"failed to create activity"
)
return
errors
.
Wrap
(
err
,
"failed to create activity"
)
}
}
s
.
Collector
.
Collect
(
ctx
,
&
metric
.
Metric
{
Name
:
string
(
activity
.
Type
),
})
return
err
return
err
}
}
server/user.go
View file @
43358973
...
@@ -10,7 +10,6 @@ import (
...
@@ -10,7 +10,6 @@ import (
"github.com/pkg/errors"
"github.com/pkg/errors"
"github.com/usememos/memos/api"
"github.com/usememos/memos/api"
"github.com/usememos/memos/common"
"github.com/usememos/memos/common"
metric
"github.com/usememos/memos/plugin/metrics"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4"
"golang.org/x/crypto/bcrypt"
"golang.org/x/crypto/bcrypt"
...
@@ -270,8 +269,5 @@ func (s *Server) createUserCreateActivity(c echo.Context, user *api.User) error
...
@@ -270,8 +269,5 @@ func (s *Server) createUserCreateActivity(c echo.Context, user *api.User) error
if
err
!=
nil
||
activity
==
nil
{
if
err
!=
nil
||
activity
==
nil
{
return
errors
.
Wrap
(
err
,
"failed to create activity"
)
return
errors
.
Wrap
(
err
,
"failed to create activity"
)
}
}
s
.
Collector
.
Collect
(
ctx
,
&
metric
.
Metric
{
Name
:
string
(
activity
.
Type
),
})
return
err
return
err
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment