Skip to content

Commit

Permalink
refactor: make span names consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
hacdias committed Oct 10, 2023
1 parent 310943f commit b97cf12
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions namesys/ipns_publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func NewIPNSPublisher(route routing.ValueStore, ds ds.Datastore) *IPNSPublisher
func (p *IPNSPublisher) Publish(ctx context.Context, priv crypto.PrivKey, value path.Path, options ...PublishOption) error {
log.Debugf("Publish %s", value)

ctx, span := startSpan(ctx, "IpnsPublisher.Publish", trace.WithAttributes(attribute.String("Value", value.String())))
ctx, span := startSpan(ctx, "IPNSPublisher.Publish", trace.WithAttributes(attribute.String("Value", value.String())))
defer span.End()

record, err := p.updateRecord(ctx, priv, value, options...)
Expand Down Expand Up @@ -203,7 +203,7 @@ func (p *IPNSPublisher) updateRecord(ctx context.Context, k crypto.PrivKey, valu
// the provided [routing.ValueStore]. The public key is also made available to the routing
// system if it cannot be derived from the corresponding [peer.ID].
func PublishIPNSRecord(ctx context.Context, r routing.ValueStore, pubKey crypto.PubKey, rec *ipns.Record) error {
ctx, span := startSpan(ctx, "PutRecordToRouting")
ctx, span := startSpan(ctx, "PublishIPNSRecord")
defer span.End()

ctx, cancel := context.WithCancel(ctx)
Expand Down Expand Up @@ -249,7 +249,7 @@ func waitOnErrChan(ctx context.Context, errs chan error) error {
// PutPublicKey puts the given [crypto.PubKey] for the given [peer.ID] in the [routing.ValueStore].
func PutPublicKey(ctx context.Context, r routing.ValueStore, pid peer.ID, pubKey crypto.PubKey) error {
routingKey := PkRoutingKey(pid)
ctx, span := startSpan(ctx, "PublishPublicKey", trace.WithAttributes(attribute.String("Key", routingKey)))
ctx, span := startSpan(ctx, "PutPublicKey", trace.WithAttributes(attribute.String("Key", routingKey)))
defer span.End()

bytes, err := crypto.MarshalPublicKey(pubKey)
Expand All @@ -269,7 +269,7 @@ func PkRoutingKey(id peer.ID) string {
// PutIPNSRecord puts the given [ipns.Record] for the given [ipns.Name] in the [routing.ValueStore].
func PutIPNSRecord(ctx context.Context, r routing.ValueStore, name ipns.Name, rec *ipns.Record) error {
routingKey := string(name.RoutingKey())
ctx, span := startSpan(ctx, "PublishEntry", trace.WithAttributes(attribute.String("IPNSKey", routingKey)))
ctx, span := startSpan(ctx, "PutIPNSRecord", trace.WithAttributes(attribute.String("IPNSKey", routingKey)))
defer span.End()

bytes, err := ipns.MarshalRecord(rec)
Expand Down
2 changes: 1 addition & 1 deletion namesys/ipns_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (r *IPNSResolver) resolveOnceAsync(ctx context.Context, p path.Path, option
go func() {
defer cancel()
defer close(out)
ctx, span := startSpan(ctx, "IpnsResolver.ResolveOnceAsync.Worker")
ctx, span := startSpan(ctx, "IPNSResolver.ResolveOnceAsync.Worker")
defer span.End()

for {
Expand Down
2 changes: 1 addition & 1 deletion namesys/namesys.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ func emitOnceResult(ctx context.Context, outCh chan<- ResolveAsyncResult, r Reso

// Publish implements Publisher
func (ns *namesys) Publish(ctx context.Context, name ci.PrivKey, value path.Path, options ...PublishOption) error {
ctx, span := startSpan(ctx, "MPNS.Publish")
ctx, span := startSpan(ctx, "namesys.Publish")
defer span.End()

// This is a bit hacky. We do this because the EOL is based on the current
Expand Down
1 change: 1 addition & 0 deletions routing/http/contentrouter/contentrouter.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type contentRouter struct {
maxProvideBatchSize int
}

var _ routing.Routing = (*contentRouter)(nil)

Check failure on line 40 in routing/http/contentrouter/contentrouter.go

View workflow job for this annotation

GitHub Actions / go-test / ubuntu (go this)

cannot use (*contentRouter)(nil) (value of type *contentRouter) as routing.Routing value in variable declaration: *contentRouter does not implement routing.Routing (missing method Bootstrap)

Check failure on line 40 in routing/http/contentrouter/contentrouter.go

View workflow job for this annotation

GitHub Actions / go-test / ubuntu (go next)

cannot use (*contentRouter)(nil) (value of type *contentRouter) as routing.Routing value in variable declaration: *contentRouter does not implement routing.Routing (missing method Bootstrap)

Check failure on line 40 in routing/http/contentrouter/contentrouter.go

View workflow job for this annotation

GitHub Actions / go-test / macos (go this)

cannot use (*contentRouter)(nil) (value of type *contentRouter) as routing.Routing value in variable declaration: *contentRouter does not implement routing.Routing (missing method Bootstrap)

Check failure on line 40 in routing/http/contentrouter/contentrouter.go

View workflow job for this annotation

GitHub Actions / go-test / macos (go next)

cannot use (*contentRouter)(nil) (value of type *contentRouter) as routing.Routing value in variable declaration: *contentRouter does not implement routing.Routing (missing method Bootstrap)
var _ routing.ContentRouting = (*contentRouter)(nil)
var _ routing.PeerRouting = (*contentRouter)(nil)
var _ routing.ValueStore = (*contentRouter)(nil)
Expand Down

0 comments on commit b97cf12

Please sign in to comment.