feat: add logging for trace id (#1061)

relates to STACKITTPR-290
This commit is contained in:
Marcel Jacek 2025-11-27 11:06:18 +01:00 committed by GitHub
parent d1e12fcf64
commit 24b7387db9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
140 changed files with 1597 additions and 7 deletions

View file

@ -239,6 +239,8 @@ func (l *logAlertGroupResource) Create(ctx context.Context, req resource.CreateR
return
}
ctx = core.InitProviderContext(ctx)
projectId := model.ProjectId.ValueString()
instanceId := model.InstanceId.ValueString()
alertGroupName := model.Name.ValueString()
@ -258,6 +260,8 @@ func (l *logAlertGroupResource) Create(ctx context.Context, req resource.CreateR
return
}
ctx = core.LogResponse(ctx)
// all log alert groups are returned. We have to search the map for the one corresponding to our name
for _, alertGroup := range *createAlertGroupResp.Data {
if model.Name.ValueString() != *alertGroup.Name {
@ -289,6 +293,8 @@ func (l *logAlertGroupResource) Read(ctx context.Context, req resource.ReadReque
return
}
ctx = core.InitProviderContext(ctx)
projectId := model.ProjectId.ValueString()
instanceId := model.InstanceId.ValueString()
alertGroupName := model.Name.ValueString()
@ -308,6 +314,8 @@ func (l *logAlertGroupResource) Read(ctx context.Context, req resource.ReadReque
return
}
ctx = core.LogResponse(ctx)
err = mapFields(ctx, readAlertGroupResp.Data, &model)
if err != nil {
core.LogAndAddError(ctx, &resp.Diagnostics, "Error reading log alert group", fmt.Sprintf("Error processing API response: %v", err))
@ -337,6 +345,8 @@ func (l *logAlertGroupResource) Delete(ctx context.Context, req resource.DeleteR
return
}
ctx = core.InitProviderContext(ctx)
projectId := model.ProjectId.ValueString()
instanceId := model.InstanceId.ValueString()
alertGroupName := model.Name.ValueString()
@ -350,6 +360,8 @@ func (l *logAlertGroupResource) Delete(ctx context.Context, req resource.DeleteR
return
}
ctx = core.LogResponse(ctx)
tflog.Info(ctx, "log alert group deleted")
}