-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: instrument with tracing #15
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,9 +2,13 @@ version: '3.5' | |
services: | ||
redis: | ||
container_name: redis | ||
image: redis | ||
image: redis:6 | ||
ports: | ||
- "6379:6379" | ||
environment: | ||
- ALLOW_EMPTY_PASSWORD=yes | ||
volumes: | ||
- redis-data:/var/lib/redis | ||
|
||
redis-commander: | ||
container_name: redis-commander | ||
|
@@ -14,7 +18,9 @@ services: | |
- REDIS_HOSTS=local:redis:6379 | ||
ports: | ||
- "8081:8081" | ||
|
||
depends_on: | ||
- redis | ||
|
||
workerui: | ||
restart: always | ||
environment: | ||
|
@@ -24,3 +30,31 @@ services: | |
dockerfile: Dockerfile.worker | ||
ports: | ||
- "8181:8181" | ||
|
||
timescaledb: | ||
container_name: timescaledb | ||
image: timescale/timescaledb:latest-pg10 | ||
ports: | ||
- "5432:5432" | ||
environment: | ||
- POSTGRES_PASSWORD=password | ||
volumes: | ||
- timescaledb:/var/lib/postgresql | ||
healthcheck: | ||
test: ["CMD-SHELL", "pg_isready -U postgres"] | ||
interval: 10s | ||
timeout: 5s | ||
retries: 5 | ||
|
||
jaeger: | ||
container_name: jaeger | ||
image: jaegertracing/all-in-one:1.19 | ||
ports: | ||
- "6831:6831/udp" | ||
- "5778:5778" | ||
- "16686:16686" | ||
|
||
volumes: | ||
timescaledb: | ||
grafana-data: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you intend to include the grafana volume here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nope. Fixed |
||
redis-data: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
package lotus | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/filecoin-project/go-address" | ||
"github.com/filecoin-project/go-bitfield" | ||
"github.com/filecoin-project/lotus/api" | ||
"github.com/filecoin-project/lotus/chain/types" | ||
"github.com/filecoin-project/sentinel-visor/lens" | ||
"github.com/filecoin-project/specs-actors/actors/util/adt" | ||
cid "github.com/ipfs/go-cid" | ||
"github.com/opentracing/opentracing-go" | ||
) | ||
|
||
func NewAPIWrapper(node api.FullNode, store adt.Store) *APIWrapper { | ||
|
@@ -23,3 +30,87 @@ type APIWrapper struct { | |
func (aw *APIWrapper) Store() adt.Store { | ||
return aw.store | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A couple thoughts on the change: this is definitely an improvement, but I have some concerns --- some of which you already mentioned:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We'll need to grow this if we want complete tracing coverage (we may not) or we should attempt to get it into lotus instead. I'm not convinced we want every method covered, especially since we are concerned about performance. Wrapping the api, making it unexported would help enforce some type safety. We could include the arguments as tags. I don't know useful it would be in general so I avoided paying the marshalling cost of things like cids in this pass. |
||
func (aw *APIWrapper) ChainGetBlock(ctx context.Context, msg cid.Cid) (*types.BlockHeader, error) { | ||
span, ctx := opentracing.StartSpanFromContext(ctx, "Lotus.ChainGetBlock") | ||
defer span.Finish() | ||
return aw.FullNode.ChainGetBlock(ctx, msg) | ||
} | ||
|
||
func (aw *APIWrapper) ChainGetBlockMessages(ctx context.Context, msg cid.Cid) (*api.BlockMessages, error) { | ||
span, ctx := opentracing.StartSpanFromContext(ctx, "Lotus.ChainGetBlockMessages") | ||
defer span.Finish() | ||
return aw.FullNode.ChainGetBlockMessages(ctx, msg) | ||
} | ||
|
||
func (aw *APIWrapper) ChainGetGenesis(ctx context.Context) (*types.TipSet, error) { | ||
span, ctx := opentracing.StartSpanFromContext(ctx, "Lotus.ChainNotify") | ||
defer span.Finish() | ||
return aw.FullNode.ChainGetGenesis(ctx) | ||
} | ||
|
||
func (aw *APIWrapper) ChainGetParentMessages(ctx context.Context, bcid cid.Cid) ([]api.Message, error) { | ||
span, ctx := opentracing.StartSpanFromContext(ctx, "Lotus.ChainGetParentMessages") | ||
defer span.Finish() | ||
return aw.FullNode.ChainGetParentMessages(ctx, bcid) | ||
} | ||
|
||
func (aw *APIWrapper) ChainGetParentReceipts(ctx context.Context, bcid cid.Cid) ([]*types.MessageReceipt, error) { | ||
span, ctx := opentracing.StartSpanFromContext(ctx, "Lotus.ChainGetParentReceipts") | ||
defer span.Finish() | ||
return aw.FullNode.ChainGetParentReceipts(ctx, bcid) | ||
} | ||
|
||
func (aw *APIWrapper) ChainGetTipSet(ctx context.Context, tsk types.TipSetKey) (*types.TipSet, error) { | ||
span, ctx := opentracing.StartSpanFromContext(ctx, "Lotus.ChainGetTipSet") | ||
defer span.Finish() | ||
return aw.FullNode.ChainGetTipSet(ctx, tsk) | ||
} | ||
|
||
func (aw *APIWrapper) ChainNotify(ctx context.Context) (<-chan []*api.HeadChange, error) { | ||
span, ctx := opentracing.StartSpanFromContext(ctx, "Lotus.ChainNotify") | ||
defer span.Finish() | ||
return aw.FullNode.ChainNotify(ctx) | ||
} | ||
|
||
func (aw *APIWrapper) ChainReadObj(ctx context.Context, obj cid.Cid) ([]byte, error) { | ||
span, ctx := opentracing.StartSpanFromContext(ctx, "Lotus.ChainReadObj") | ||
defer span.Finish() | ||
return aw.FullNode.ChainReadObj(ctx, obj) | ||
} | ||
|
||
func (aw *APIWrapper) StateChangedActors(ctx context.Context, old cid.Cid, new cid.Cid) (map[string]types.Actor, error) { | ||
span, ctx := opentracing.StartSpanFromContext(ctx, "Lotus.StateChangedActors") | ||
defer span.Finish() | ||
return aw.FullNode.StateChangedActors(ctx, old, new) | ||
} | ||
|
||
func (aw *APIWrapper) StateGetActor(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*types.Actor, error) { | ||
span, ctx := opentracing.StartSpanFromContext(ctx, "Lotus.StateGetActor") | ||
defer span.Finish() | ||
return aw.FullNode.StateGetActor(ctx, actor, tsk) | ||
} | ||
|
||
func (aw *APIWrapper) StateListActors(ctx context.Context, tsk types.TipSetKey) ([]address.Address, error) { | ||
span, ctx := opentracing.StartSpanFromContext(ctx, "Lotus.StateListActors") | ||
defer span.Finish() | ||
return aw.FullNode.StateListActors(ctx, tsk) | ||
} | ||
|
||
func (aw *APIWrapper) StateMarketDeals(ctx context.Context, tsk types.TipSetKey) (map[string]api.MarketDeal, error) { | ||
span, ctx := opentracing.StartSpanFromContext(ctx, "Lotus.StateMarketDeals") | ||
defer span.Finish() | ||
return aw.FullNode.StateMarketDeals(ctx, tsk) | ||
} | ||
|
||
func (aw *APIWrapper) StateMinerPower(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*api.MinerPower, error) { | ||
span, ctx := opentracing.StartSpanFromContext(ctx, "Lotus.StateMinerPower") | ||
defer span.Finish() | ||
return aw.FullNode.StateMinerPower(ctx, addr, tsk) | ||
} | ||
|
||
func (aw *APIWrapper) StateMinerSectors(ctx context.Context, addr address.Address, filter *bitfield.BitField, filterOut bool, tsk types.TipSetKey) ([]*api.ChainSectorInfo, error) { | ||
span, ctx := opentracing.StartSpanFromContext(ctx, "Lotus.StateMinerSectors") | ||
defer span.Finish() | ||
return aw.FullNode.StateMinerSectors(ctx, addr, filter, filterOut, tsk) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️ 🙏