mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-04-11 22:33:40 +00:00
Replace "appservice" with "appservice_id" in structured logs
This commit is contained in:
parent
2e6eff2012
commit
6a0cce29a6
5 changed files with 25 additions and 25 deletions
|
@ -68,7 +68,7 @@ func SetupAppServiceAPIComponent(
|
||||||
// Create bot account for this AS if it doesn't already exist
|
// Create bot account for this AS if it doesn't already exist
|
||||||
if err = generateAppServiceAccount(accountsDB, deviceDB, appservice); err != nil {
|
if err = generateAppServiceAccount(accountsDB, deviceDB, appservice); err != nil {
|
||||||
log.WithFields(log.Fields{
|
log.WithFields(log.Fields{
|
||||||
"appservice": appservice.ID,
|
"appservice_id": appservice.ID,
|
||||||
}).WithError(err).Panicf("failed to generate bot account for appservice")
|
}).WithError(err).Panicf("failed to generate bot account for appservice")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ func setupWorkers(
|
||||||
// Create a worker that handles transmitting events to a single homeserver
|
// Create a worker that handles transmitting events to a single homeserver
|
||||||
for _, workerState := range workerStates {
|
for _, workerState := range workerStates {
|
||||||
log.WithFields(log.Fields{
|
log.WithFields(log.Fields{
|
||||||
"appservice": workerState.AppService.ID,
|
"appservice_id": workerState.AppService.ID,
|
||||||
}).Info("starting application service")
|
}).Info("starting application service")
|
||||||
|
|
||||||
// Don't create a worker if this AS doesn't want to receive events
|
// Don't create a worker if this AS doesn't want to receive events
|
||||||
|
|
|
@ -90,8 +90,8 @@ func (a *AppServiceQueryAPI) RoomAliasExists(
|
||||||
err = resp.Body.Close()
|
err = resp.Body.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithFields(log.Fields{
|
log.WithFields(log.Fields{
|
||||||
"appservice": appservice.ID,
|
"appservice_id": appservice.ID,
|
||||||
"status_code": resp.StatusCode,
|
"status_code": resp.StatusCode,
|
||||||
}).WithError(err).Error("Unable to close application service response body")
|
}).WithError(err).Error("Unable to close application service response body")
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
@ -110,8 +110,8 @@ func (a *AppServiceQueryAPI) RoomAliasExists(
|
||||||
default:
|
default:
|
||||||
// Application service reported an error. Warn
|
// Application service reported an error. Warn
|
||||||
log.WithFields(log.Fields{
|
log.WithFields(log.Fields{
|
||||||
"appservice": appservice.ID,
|
"appservice_id": appservice.ID,
|
||||||
"status_code": resp.StatusCode,
|
"status_code": resp.StatusCode,
|
||||||
}).Warn("Application service responded with non-OK status code")
|
}).Warn("Application service responded with non-OK status code")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ func (a *AppServiceQueryAPI) UserIDExists(
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithFields(log.Fields{
|
log.WithFields(log.Fields{
|
||||||
"appservice": appservice.ID,
|
"appservice_id": appservice.ID,
|
||||||
}).WithError(err).Error("issue querying user ID on application service")
|
}).WithError(err).Error("issue querying user ID on application service")
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -172,8 +172,8 @@ func (a *AppServiceQueryAPI) UserIDExists(
|
||||||
|
|
||||||
// Log if return code is not OK
|
// Log if return code is not OK
|
||||||
log.WithFields(log.Fields{
|
log.WithFields(log.Fields{
|
||||||
"appservice": appservice.ID,
|
"appservice_id": appservice.ID,
|
||||||
"status_code": resp.StatusCode,
|
"status_code": resp.StatusCode,
|
||||||
}).Warn("application service responded with non-OK status code")
|
}).Warn("application service responded with non-OK status code")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -305,7 +305,7 @@ func contactApplicationService(
|
||||||
req, err := http.NewRequest(http.MethodGet, requestURL, bytes.NewReader(request.Content))
|
req, err := http.NewRequest(http.MethodGet, requestURL, bytes.NewReader(request.Content))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithFields(log.Fields{
|
log.WithFields(log.Fields{
|
||||||
"appservice": as.ID,
|
"appservice_id": as.ID,
|
||||||
}).WithError(err).Error("problem building proxy request to application service")
|
}).WithError(err).Error("problem building proxy request to application service")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -318,15 +318,15 @@ func contactApplicationService(
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithFields(log.Fields{
|
log.WithFields(log.Fields{
|
||||||
"appservice": as.ID,
|
"appservice_id": as.ID,
|
||||||
}).WithError(err).Warn("unable to proxy request to application service")
|
}).WithError(err).Warn("unable to proxy request to application service")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if resp.StatusCode != http.StatusOK {
|
if resp.StatusCode != http.StatusOK {
|
||||||
log.WithFields(log.Fields{
|
log.WithFields(log.Fields{
|
||||||
"appservice": as.ID,
|
"appservice_id": as.ID,
|
||||||
"status_code": resp.StatusCode,
|
"status_code": resp.StatusCode,
|
||||||
}).Warn("non-OK response from application server while proxying request")
|
}).Warn("non-OK response from application server while proxying request")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -336,7 +336,7 @@ func contactApplicationService(
|
||||||
body, err := ioutil.ReadAll(resp.Body)
|
body, err := ioutil.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithFields(log.Fields{
|
log.WithFields(log.Fields{
|
||||||
"appservice": as.ID,
|
"appservice_id": as.ID,
|
||||||
}).WithError(err).Warn("unable to read response from application server while proxying request")
|
}).WithError(err).Warn("unable to read response from application server while proxying request")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -346,7 +346,7 @@ func contactApplicationService(
|
||||||
err = json.Unmarshal(body, &querySlice)
|
err = json.Unmarshal(body, &querySlice)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithFields(log.Fields{
|
log.WithFields(log.Fields{
|
||||||
"appservice": as.ID,
|
"appservice_id": as.ID,
|
||||||
}).WithError(err).Warn("unable to unmarshal response from application server while proxying request")
|
}).WithError(err).Warn("unable to unmarshal response from application server while proxying request")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,7 +119,7 @@ func (s *eventsStatements) selectEventsByApplicationServiceID(
|
||||||
err = eventRows.Close()
|
err = eventRows.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithFields(log.Fields{
|
log.WithFields(log.Fields{
|
||||||
"appservice": applicationServiceID,
|
"appservice_id": applicationServiceID,
|
||||||
}).WithError(err).Fatalf("appservice unable to select new events to send")
|
}).WithError(err).Fatalf("appservice unable to select new events to send")
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
|
@ -66,7 +66,7 @@ func ThirdPartyWorker(
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithFields(log.Fields{
|
log.WithFields(log.Fields{
|
||||||
"appservice": appservice.ID,
|
"appservice_id": appservice.ID,
|
||||||
"backoff_exponent": backoffCount,
|
"backoff_exponent": backoffCount,
|
||||||
}).WithError(err).Warn("error contacting appservice thirdparty endpoints")
|
}).WithError(err).Warn("error contacting appservice thirdparty endpoints")
|
||||||
|
|
||||||
|
@ -82,8 +82,8 @@ func ThirdPartyWorker(
|
||||||
err = storeProtocolDefinition(ctx, db, protocolID, protocolDefinition)
|
err = storeProtocolDefinition(ctx, db, protocolID, protocolDefinition)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithFields(log.Fields{
|
log.WithFields(log.Fields{
|
||||||
"appservice": appservice.ID,
|
"appservice_id": appservice.ID,
|
||||||
"definition": protocolDefinition,
|
"definition": protocolDefinition,
|
||||||
}).WithError(err).Fatalf("unable to store appservice protocol definition in db")
|
}).WithError(err).Fatalf("unable to store appservice protocol definition in db")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ func TransactionWorker(db *storage.Database, ws types.ApplicationServiceWorkerSt
|
||||||
eventCount, err := db.CountEventsWithAppServiceID(ctx, ws.AppService.ID)
|
eventCount, err := db.CountEventsWithAppServiceID(ctx, ws.AppService.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithFields(log.Fields{
|
log.WithFields(log.Fields{
|
||||||
"appservice": ws.AppService.ID,
|
"appservice_id": ws.AppService.ID,
|
||||||
}).WithError(err).Fatal("appservice worker unable to read queued events from DB")
|
}).WithError(err).Fatal("appservice worker unable to read queued events from DB")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ func TransactionWorker(db *storage.Database, ws types.ApplicationServiceWorkerSt
|
||||||
transactionJSON, txnID, maxEventID, eventsRemaining, err := createTransaction(ctx, db, ws.AppService.ID)
|
transactionJSON, txnID, maxEventID, eventsRemaining, err := createTransaction(ctx, db, ws.AppService.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithFields(log.Fields{
|
log.WithFields(log.Fields{
|
||||||
"appservice": ws.AppService.ID,
|
"appservice_id": ws.AppService.ID,
|
||||||
}).WithError(err).Fatal("appservice worker unable to create transaction")
|
}).WithError(err).Fatal("appservice worker unable to create transaction")
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -81,7 +81,7 @@ func TransactionWorker(db *storage.Database, ws types.ApplicationServiceWorkerSt
|
||||||
err = send(client, ws.AppService, txnID, transactionJSON)
|
err = send(client, ws.AppService, txnID, transactionJSON)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithFields(log.Fields{
|
log.WithFields(log.Fields{
|
||||||
"appservice": ws.AppService.ID,
|
"appservice_id": ws.AppService.ID,
|
||||||
"backoff_exponent": ws.Backoff,
|
"backoff_exponent": ws.Backoff,
|
||||||
}).WithError(err).Warnf("unable to send transactions successfully, backing off")
|
}).WithError(err).Warnf("unable to send transactions successfully, backing off")
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ func TransactionWorker(db *storage.Database, ws types.ApplicationServiceWorkerSt
|
||||||
err = db.RemoveEventsBeforeAndIncludingID(ctx, ws.AppService.ID, maxEventID)
|
err = db.RemoveEventsBeforeAndIncludingID(ctx, ws.AppService.ID, maxEventID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithFields(log.Fields{
|
log.WithFields(log.Fields{
|
||||||
"appservice": ws.AppService.ID,
|
"appservice_id": ws.AppService.ID,
|
||||||
}).WithError(err).Fatal("unable to remove appservice events from the database")
|
}).WithError(err).Fatal("unable to remove appservice events from the database")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ func createTransaction(
|
||||||
txnID, maxID, events, eventsRemaining, err := db.GetEventsWithAppServiceID(ctx, appserviceID, transactionBatchSize)
|
txnID, maxID, events, eventsRemaining, err := db.GetEventsWithAppServiceID(ctx, appserviceID, transactionBatchSize)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithFields(log.Fields{
|
log.WithFields(log.Fields{
|
||||||
"appservice": appserviceID,
|
"appservice_id": appserviceID,
|
||||||
}).WithError(err).Fatalf("appservice worker unable to read queued events from DB")
|
}).WithError(err).Fatalf("appservice worker unable to read queued events from DB")
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -177,7 +177,7 @@ func send(
|
||||||
err := resp.Body.Close()
|
err := resp.Body.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithFields(log.Fields{
|
log.WithFields(log.Fields{
|
||||||
"appservice": appservice.ID,
|
"appservice_id": appservice.ID,
|
||||||
}).WithError(err).Error("unable to close response body from application service")
|
}).WithError(err).Error("unable to close response body from application service")
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
Loading…
Reference in a new issue