mirror of
https://github.com/minio/minio.git
synced 2025-03-30 17:23:42 -04:00
Send deployment ID in notification event response elements (#6991)
This commit is contained in:
parent
c5bf22fd90
commit
3be616de3f
@ -743,7 +743,9 @@ func (s customHeaderHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
// Set custom headers such as x-amz-request-id and x-minio-deployment-id
|
// Set custom headers such as x-amz-request-id and x-minio-deployment-id
|
||||||
// for each request.
|
// for each request.
|
||||||
w.Header().Set(responseRequestIDKey, mustGetRequestID(UTCNow()))
|
w.Header().Set(responseRequestIDKey, mustGetRequestID(UTCNow()))
|
||||||
w.Header().Set(responseDeploymentIDKey, globalDeploymentID)
|
if globalDeploymentID != "" {
|
||||||
|
w.Header().Set(responseDeploymentIDKey, globalDeploymentID)
|
||||||
|
}
|
||||||
s.handler.ServeHTTP(logger.NewResponseWriter(w), r)
|
s.handler.ServeHTTP(logger.NewResponseWriter(w), r)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net"
|
||||||
"net/url"
|
"net/url"
|
||||||
"path"
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
@ -488,10 +489,10 @@ func (args eventArgs) ToEvent() event.Event {
|
|||||||
host := globalMinioHost
|
host := globalMinioHost
|
||||||
if host == "" {
|
if host == "" {
|
||||||
// FIXME: Send FQDN or hostname of this machine than sending IP address.
|
// FIXME: Send FQDN or hostname of this machine than sending IP address.
|
||||||
host = localIP4.ToSlice()[0]
|
host = sortIPs(localIP4.ToSlice())[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
return fmt.Sprintf("%s://%s:%s", getURLScheme(globalIsSSL), host, globalMinioPort)
|
return fmt.Sprintf("%s://%s", getURLScheme(globalIsSSL), net.JoinHostPort(host, globalMinioPort))
|
||||||
}
|
}
|
||||||
|
|
||||||
eventTime := UTCNow()
|
eventTime := UTCNow()
|
||||||
@ -501,6 +502,10 @@ func (args eventArgs) ToEvent() event.Event {
|
|||||||
"x-amz-request-id": args.RespElements["requestId"],
|
"x-amz-request-id": args.RespElements["requestId"],
|
||||||
"x-minio-origin-endpoint": getOriginEndpoint(), // Minio specific custom elements.
|
"x-minio-origin-endpoint": getOriginEndpoint(), // Minio specific custom elements.
|
||||||
}
|
}
|
||||||
|
// Add deployment as part of
|
||||||
|
if globalDeploymentID != "" {
|
||||||
|
respElements["x-minio-deployment-id"] = globalDeploymentID
|
||||||
|
}
|
||||||
if args.RespElements["content-length"] != "" {
|
if args.RespElements["content-length"] != "" {
|
||||||
respElements["content-length"] = args.RespElements["content-length"]
|
respElements["content-length"] = args.RespElements["content-length"]
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user