Skip to content

Commit

Permalink
Extend DatabaseSessionStart posthog event (gravitational#28931)
Browse files Browse the repository at this point in the history
  • Loading branch information
smallinsky authored Jul 14, 2023
1 parent 6b26d57 commit d4805cc
Show file tree
Hide file tree
Showing 10 changed files with 2,529 additions and 1,993 deletions.
4 changes: 4 additions & 0 deletions api/proto/teleport/legacy/types/events/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2431,6 +2431,10 @@ message DatabaseMetadata {
string DatabaseGCPInstanceID = 10 [(gogoproto.jsontag) = "db_gcp_instance_id,omitempty"];
// DatabaseRoles is a list of database roles for auto-provisioned users.
repeated string DatabaseRoles = 11 [(gogoproto.jsontag) = "db_roles,omitempty"];
// DatabaseType is the database type.
string DatabaseType = 12 [(gogoproto.jsontag) = "db_type,omitempty"];
// DatabaseOrigin is the database origin source.
string DatabaseOrigin = 13 [(gogoproto.jsontag) = "db_origin,omitempty"];
}

// DatabaseCreate is emitted when a new database resource is created.
Expand Down
1,472 changes: 782 additions & 690 deletions api/types/events/events.pb.go

Large diffs are not rendered by default.

2,701 changes: 1,403 additions & 1,298 deletions gen/proto/go/prehog/v1alpha/teleport.pb.go

Large diffs are not rendered by default.

36 changes: 36 additions & 0 deletions gen/proto/js/prehog/v1alpha/teleport_pb.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

265 changes: 264 additions & 1 deletion gen/proto/js/prehog/v1alpha/teleport_pb.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions lib/srv/db/common/audit.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ func (a *audit) OnSessionStart(ctx context.Context, session *Session, sessionErr
Success: true,
},
}

// If the database session wasn't started successfully, emit
// a failure event with error details.
if sessionErr != nil {
Expand Down Expand Up @@ -212,5 +213,7 @@ func MakeDatabaseMetadata(session *Session) events.DatabaseMetadata {
DatabaseName: session.DatabaseName,
DatabaseUser: session.DatabaseUser,
DatabaseRoles: session.DatabaseRoles,
DatabaseType: session.Database.GetType(),
DatabaseOrigin: session.Database.Origin(),
}
}
Loading

0 comments on commit d4805cc

Please sign in to comment.