[MM-55268] Implement ServeMetrics plugins hook (#24249)
* Implement ServeMetrics plugins hook * Update error id * Simplify * Revert "Simplify" This reverts commit c9dc5d5eac6c933ff69e158cf3e34d0973bd3bcd. * Add comment and error handler * Wrap error * Update translation file --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
926142ca22
Коммит
aa3a12f183
@@ -0,0 +1,27 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/mattermost/mattermost/server/public/plugin"
|
||||
)
|
||||
|
||||
type Plugin struct {
|
||||
plugin.MattermostPlugin
|
||||
}
|
||||
|
||||
func (p *Plugin) ServeMetrics(_ *plugin.Context, w http.ResponseWriter, r *http.Request) {
|
||||
if r.URL.Path == "/subpath" {
|
||||
w.Write([]byte("METRICS SUBPATH"))
|
||||
return
|
||||
}
|
||||
|
||||
w.Write([]byte("METRICS"))
|
||||
}
|
||||
|
||||
func main() {
|
||||
plugin.ClientMain(&Plugin{})
|
||||
}
|
||||
Ссылка в новой задаче
Block a user