Skip to content

Commit e581ebb

Browse files
committed
rename telemetry HostName to TelemetryGUID
1 parent 8a45d7f commit e581ebb

File tree

7 files changed

+52
-52
lines changed

7 files changed

+52
-52
lines changed

daemon/algod/server.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ func (s *Server) Initialize(cfg config.Local, phonebookAddresses []string, genes
147147
fmt.Fprintln(logWriter, "Logging Starting")
148148
if s.log.GetTelemetryUploadingEnabled() {
149149
// May or may not be logging to node.log
150-
fmt.Fprintf(logWriter, "Telemetry Enabled: %s\n", s.log.GetTelemetryHostID())
150+
fmt.Fprintf(logWriter, "Telemetry Enabled: %s\n", s.log.GetTelemetryGUID())
151151
fmt.Fprintf(logWriter, "Session: %s\n", s.log.GetTelemetrySession())
152152
} else {
153153
// May or may not be logging to node.log
@@ -158,7 +158,7 @@ func (s *Server) Initialize(cfg config.Local, phonebookAddresses []string, genes
158158
metricLabels := map[string]string{}
159159
if s.log.GetTelemetryEnabled() {
160160
metricLabels["telemetry_session"] = s.log.GetTelemetrySession()
161-
if h := s.log.GetTelemetryHostID(); h != "" {
161+
if h := s.log.GetTelemetryGUID(); h != "" {
162162
metricLabels["telemetry_host"] = h
163163
}
164164
if i := s.log.GetInstanceName(); i != "" {

logging/log.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ type Logger interface {
157157
EventWithDetails(category telemetryspec.Category, identifier telemetryspec.Event, details interface{})
158158
StartOperation(category telemetryspec.Category, identifier telemetryspec.Operation) TelemetryOperation
159159
GetTelemetrySession() string
160-
GetTelemetryHostID() string
160+
GetTelemetryGUID() string
161161
GetInstanceName() string
162162
GetTelemetryURI() string
163163
CloseTelemetry()
@@ -401,11 +401,11 @@ func (l logger) GetTelemetryVersion() string {
401401
return l.loggerState.telemetry.telemetryConfig.Version
402402
}
403403

404-
func (l logger) GetTelemetryHostID() string {
404+
func (l logger) GetTelemetryGUID() string {
405405
if !l.GetTelemetryEnabled() {
406406
return ""
407407
}
408-
return l.loggerState.telemetry.telemetryConfig.getHostID()
408+
return l.loggerState.telemetry.telemetryConfig.getHostGUID()
409409
}
410410

411411
func (l logger) GetInstanceName() string {

logging/telemetryConfig.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,13 @@ func (cfg TelemetryConfig) Save(configPath string) error {
105105
return err
106106
}
107107

108-
// getHostID returns the Host ID for telemetry (GUID:Name -- :Name is optional if blank)
109-
func (cfg TelemetryConfig) getHostID() string {
110-
hostID := cfg.GUID
108+
// getHostGUID returns the Host GUID for telemetry (GUID:Name -- :Name is optional if blank)
109+
func (cfg TelemetryConfig) getHostGUID() string {
110+
ret := cfg.GUID
111111
if cfg.Enable && len(cfg.Name) > 0 {
112-
hostID += ":" + cfg.Name
112+
ret += ":" + cfg.Name
113113
}
114-
return hostID
114+
return ret
115115
}
116116

117117
// getInstanceName allows us to distinguish between multiple instances running on the same node.

logging/telemetryhook.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ func createElasticHook(cfg TelemetryConfig) (hook logrus.Hook, err error) {
242242
err = fmt.Errorf("Unable to create new elastic client on '%s' using '%s:%s' : %w", cfg.URI, cfg.UserName, cfg.Password, err)
243243
return nil, err
244244
}
245-
hostName := cfg.getHostID()
245+
hostName := cfg.getHostGUID()
246246
hook, err = elogrus.NewElasticHook(client, hostName, cfg.MinLogLevel, cfg.ChainID)
247247

248248
if err != nil {

logging/telemetryspec/event.go

+11-11
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,10 @@ const ConnectPeerEvent Event = "ConnectPeer"
191191

192192
// PeerEventDetails contains details for the ConnectPeerEvent
193193
type PeerEventDetails struct {
194-
Address string
195-
HostName string
196-
Incoming bool
197-
InstanceName string
194+
Address string
195+
TelemetryGUID string `json:"HostName"`
196+
Incoming bool
197+
InstanceName string
198198
// Endpoint is the dialed-to address, for an outgoing connection. Not being used for incoming connection.
199199
Endpoint string `json:",omitempty"`
200200
// MessageDelay is the avarage relative message delay. Not being used for incoming connection.
@@ -206,11 +206,11 @@ const ConnectPeerFailEvent Event = "ConnectPeerFail"
206206

207207
// ConnectPeerFailEventDetails contains details for the ConnectPeerFailEvent
208208
type ConnectPeerFailEventDetails struct {
209-
Address string
210-
HostName string
211-
Incoming bool
212-
InstanceName string
213-
Reason string
209+
Address string
210+
TelemetryGUID string `json:"HostName"`
211+
Incoming bool
212+
InstanceName string
213+
Reason string
214214
}
215215

216216
// DisconnectPeerEvent event
@@ -282,8 +282,8 @@ type PeersConnectionDetails struct {
282282
type PeerConnectionDetails struct {
283283
// Address is the IP address of the remote connected socket
284284
Address string
285-
// The HostName is the TelemetryGUID passed via the X-Algorand-TelId header during the http connection handshake.
286-
HostName string
285+
// The TelemetryGUID is the TelemetryGUID passed via the X-Algorand-TelId header during the http connection handshake.
286+
TelemetryGUID string `json:"HostName"`
287287
// InstanceName is the node-specific hashed instance name that was passed via X-Algorand-InstanceName header during the http connection handshake.
288288
InstanceName string
289289
// ConnectionDuration is the duration of the connection, in seconds.

network/requestTracker.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -482,11 +482,11 @@ func (rt *RequestTracker) ServeHTTP(response http.ResponseWriter, request *http.
482482
rt.log.With("connection", "http").With("count", originConnections).Debugf("Rejected connection due to excessive connections attempt rate")
483483
rt.log.EventWithDetails(telemetryspec.Network, telemetryspec.ConnectPeerFailEvent,
484484
telemetryspec.ConnectPeerFailEventDetails{
485-
Address: trackedRequest.remoteHost,
486-
HostName: trackedRequest.otherTelemetryGUID,
487-
Incoming: true,
488-
InstanceName: trackedRequest.otherInstanceName,
489-
Reason: "Remote IP Connection Rate Limit",
485+
Address: trackedRequest.remoteHost,
486+
TelemetryGUID: trackedRequest.otherTelemetryGUID,
487+
Incoming: true,
488+
InstanceName: trackedRequest.otherInstanceName,
489+
Reason: "Remote IP Connection Rate Limit",
490490
})
491491
response.Header().Add(TooManyRequestsRetryAfterHeader, fmt.Sprintf("%d", rt.config.ConnectionsRateLimitingWindowSeconds))
492492
response.WriteHeader(http.StatusTooManyRequests)

network/wsNetwork.go

+25-25
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,7 @@ func (wn *WebsocketNetwork) ClearHandlers() {
917917
}
918918

919919
func (wn *WebsocketNetwork) setHeaders(header http.Header) {
920-
localTelemetryGUID := wn.log.GetTelemetryHostID()
920+
localTelemetryGUID := wn.log.GetTelemetryGUID()
921921
localInstanceName := wn.log.GetInstanceName()
922922
header.Set(TelemetryIDHeader, localTelemetryGUID)
923923
header.Set(InstanceNameHeader, localInstanceName)
@@ -970,11 +970,11 @@ func (wn *WebsocketNetwork) checkIncomingConnectionLimits(response http.Response
970970
networkConnectionsDroppedTotal.Inc(map[string]string{"reason": "incoming_connection_limit"})
971971
wn.log.EventWithDetails(telemetryspec.Network, telemetryspec.ConnectPeerFailEvent,
972972
telemetryspec.ConnectPeerFailEventDetails{
973-
Address: remoteHost,
974-
HostName: otherTelemetryGUID,
975-
Incoming: true,
976-
InstanceName: otherInstanceName,
977-
Reason: "Connection Limit",
973+
Address: remoteHost,
974+
TelemetryGUID: otherTelemetryGUID,
975+
Incoming: true,
976+
InstanceName: otherInstanceName,
977+
Reason: "Connection Limit",
978978
})
979979
response.WriteHeader(http.StatusServiceUnavailable)
980980
return http.StatusServiceUnavailable
@@ -985,11 +985,11 @@ func (wn *WebsocketNetwork) checkIncomingConnectionLimits(response http.Response
985985
networkConnectionsDroppedTotal.Inc(map[string]string{"reason": "incoming_connection_per_ip_limit"})
986986
wn.log.EventWithDetails(telemetryspec.Network, telemetryspec.ConnectPeerFailEvent,
987987
telemetryspec.ConnectPeerFailEventDetails{
988-
Address: remoteHost,
989-
HostName: otherTelemetryGUID,
990-
Incoming: true,
991-
InstanceName: otherInstanceName,
992-
Reason: "Remote IP Connection Limit",
988+
Address: remoteHost,
989+
TelemetryGUID: otherTelemetryGUID,
990+
Incoming: true,
991+
InstanceName: otherInstanceName,
992+
Reason: "Remote IP Connection Limit",
993993
})
994994
response.WriteHeader(http.StatusServiceUnavailable)
995995
return http.StatusServiceUnavailable
@@ -1154,10 +1154,10 @@ func (wn *WebsocketNetwork) ServeHTTP(response http.ResponseWriter, request *htt
11541154
wn.log.With("event", "ConnectedIn").With("remote", trackedRequest.otherPublicAddr).With("local", localAddr).Infof("Accepted incoming connection from peer %s", trackedRequest.otherPublicAddr)
11551155
wn.log.EventWithDetails(telemetryspec.Network, telemetryspec.ConnectPeerEvent,
11561156
telemetryspec.PeerEventDetails{
1157-
Address: trackedRequest.remoteHost,
1158-
HostName: trackedRequest.otherTelemetryGUID,
1159-
Incoming: true,
1160-
InstanceName: trackedRequest.otherInstanceName,
1157+
Address: trackedRequest.remoteHost,
1158+
TelemetryGUID: trackedRequest.otherTelemetryGUID,
1159+
Incoming: true,
1160+
InstanceName: trackedRequest.otherInstanceName,
11611161
})
11621162

11631163
wn.maybeSendMessagesOfInterest(peer, nil)
@@ -1754,7 +1754,7 @@ func (wn *WebsocketNetwork) sendPeerConnectionsTelemetryStatus() {
17541754
for _, peer := range peers {
17551755
connDetail := telemetryspec.PeerConnectionDetails{
17561756
ConnectionDuration: uint(now.Sub(peer.createTime).Seconds()),
1757-
HostName: peer.TelemetryGUID,
1757+
TelemetryGUID: peer.TelemetryGUID,
17581758
InstanceName: peer.InstanceName,
17591759
}
17601760
if peer.outgoing {
@@ -2098,11 +2098,11 @@ func (wn *WebsocketNetwork) tryConnect(addr, gossipAddr string) {
20982098
wn.log.With("event", "ConnectedOut").With("remote", addr).With("local", localAddr).Infof("Made outgoing connection to peer %v", addr)
20992099
wn.log.EventWithDetails(telemetryspec.Network, telemetryspec.ConnectPeerEvent,
21002100
telemetryspec.PeerEventDetails{
2101-
Address: justHost(conn.RemoteAddr().String()),
2102-
HostName: peer.TelemetryGUID,
2103-
Incoming: false,
2104-
InstanceName: peer.InstanceName,
2105-
Endpoint: peer.GetAddress(),
2101+
Address: justHost(conn.RemoteAddr().String()),
2102+
TelemetryGUID: peer.TelemetryGUID,
2103+
Incoming: false,
2104+
InstanceName: peer.InstanceName,
2105+
Endpoint: peer.GetAddress(),
21062106
})
21072107

21082108
wn.maybeSendMessagesOfInterest(peer, nil)
@@ -2206,10 +2206,10 @@ func (wn *WebsocketNetwork) removePeer(peer *wsPeer, reason disconnectReason) {
22062206
}
22072207
}
22082208
eventDetails := telemetryspec.PeerEventDetails{
2209-
Address: peerAddr,
2210-
HostName: peer.TelemetryGUID,
2211-
Incoming: !peer.outgoing,
2212-
InstanceName: peer.InstanceName,
2209+
Address: peerAddr,
2210+
TelemetryGUID: peer.TelemetryGUID,
2211+
Incoming: !peer.outgoing,
2212+
InstanceName: peer.InstanceName,
22132213
}
22142214
if peer.outgoing {
22152215
eventDetails.Endpoint = peer.GetAddress()

0 commit comments

Comments
 (0)