Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions postgres/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ func (p *plugin) PreStart(_ context.Context) (err error) {
}

p.runtime.Tools().Probes().RegisterCheck(p.prefix, probes.ReadinessProbe, PostgresPingChecker(conn, 1*time.Second))
p.runtime.Tools().Probes().RegisterCheck(p.prefix, probes.LivenessProbe, PostgresPingChecker(conn, 1*time.Second))

p.connection = p.opts.DSN
p.db = conn
Expand Down
2 changes: 2 additions & 0 deletions postgres_gorm/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ func (p *plugin) PreStart(ctx context.Context) (err error) {
}

p.runtime.Tools().Probes().RegisterCheck(p.prefix, probes.ReadinessProbe, PostgresPingChecker(conn, 1*time.Second))
p.runtime.Tools().Probes().RegisterCheck(p.prefix, probes.LivenessProbe, PostgresPingChecker(conn, 1*time.Second))

p.db = db

return nil
Expand Down
1 change: 1 addition & 0 deletions postgres_pg/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ func (p *plugin) PreStart(ctx context.Context) (err error) {
db.AddQueryHook(dbLogger{})

p.runtime.Tools().Probes().RegisterCheck(p.prefix, probes.ReadinessProbe, PostgresPingChecker(db, 1*time.Second))
p.runtime.Tools().Probes().RegisterCheck(p.prefix, probes.LivenessProbe, PostgresPingChecker(db, 1*time.Second))

p.db = db

Expand Down
2 changes: 2 additions & 0 deletions postgres_pgx/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ func (p *plugin) PreStart(ctx context.Context) (err error) {
}

p.runtime.Tools().Probes().RegisterCheck(p.prefix, probes.ReadinessProbe, PostgresPingChecker(db, 1*time.Second))
p.runtime.Tools().Probes().RegisterCheck(p.prefix, probes.LivenessProbe, PostgresPingChecker(db, 1*time.Second))

return nil
}

Expand Down
1 change: 0 additions & 1 deletion rabbitmq/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ func (a *amqpConn) Channel() (*amqp.Channel, error) {
if !a.connected {
return nil, errors.New("connection closed")
}

return a.conn.Channel()
}

Expand Down
5 changes: 1 addition & 4 deletions rabbitmq/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,7 @@ func (p *plugin) PreStart(ctx context.Context) error {
}

p.runtime.Tools().Probes().RegisterCheck(p.prefix, probes.ReadinessProbe, checkRabbitMQ(p.broker, 1*time.Second))

p.runtime.Tools().Probes().RegisterCheck(p.prefix, probes.LivenessProbe, func() error {
return p.broker.Connected()
})
p.runtime.Tools().Probes().RegisterCheck(p.prefix, probes.LivenessProbe, checkRabbitMQ(p.broker, 1*time.Second))

return nil
}
Expand Down
3 changes: 3 additions & 0 deletions redis/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,16 @@ func (p *plugin) PreStart(ctx context.Context) (err error) {
if p.opts.Cluster {
client := redis.NewClusterClient(p.prepareClusterOptions(p.opts))
p.runtime.Tools().Probes().RegisterCheck(p.prefix, probes.ReadinessProbe, redisClusterPingChecker(client, 1*time.Second))
p.runtime.Tools().Probes().RegisterCheck(p.prefix, probes.LivenessProbe, redisClusterPingChecker(client, 1*time.Second))

p.cdb = client
} else {
client := redis.NewClient(p.prepareOptions(p.opts))
p.runtime.Tools().Probes().RegisterCheck(p.prefix, probes.ReadinessProbe, redisPingChecker(client, 1*time.Second))
p.runtime.Tools().Probes().RegisterCheck(p.prefix, probes.LivenessProbe, redisPingChecker(client, 1*time.Second))
p.db = client
}

return nil
}

Expand Down