Skip to content

make the tablet identification added to errors more concise#3015

Merged
sougou merged 2 commits intovitessio:masterfrom
tinyspeck:concise-tablet-ident-in-error-logs
Aug 2, 2017
Merged

make the tablet identification added to errors more concise#3015
sougou merged 2 commits intovitessio:masterfrom
tinyspeck:concise-tablet-ident-in-error-logs

Conversation

@demmer
Copy link
Member

@demmer demmer commented Jul 26, 2017

Instead of printing the full Tablet object in every error that is propagated from vtgate, include a concise summary of the cell, uid, and hostname to reduce the clutter in error logs.

As an example from the discoverygateway tests, this error:

target: ks.0.replica, used tablet: (alias:<cell:"cell" > hostname:"1.1.1.1" port_map:<key:"vt" value:1001 > keyspace:"ks" shard:"0" type:REPLICA ), INVALID_ARGUMENT error

Would now be:

target: ks.0.replica, used tablet: cell-0 (1.1.1.1), INVALID_ARGUMENT error

The removed information is still available through the topology if needed for debugging.

Instead of printing the full Tablet object in every error from vtgate,
only include the cell, uid, and hostname to reduce the clutter in error
logs.

The removed information is still available through the topology if
needed for debugging.
Copy link
Contributor

@alainjobart alainjobart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good change, couple suggested changes :)

func tabletIdent(tablet *topodatapb.Tablet) string {
return fmt.Sprintf("%s-%d (%s)", tablet.Alias.Cell, tablet.Alias.Uid, tablet.Hostname)
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move that function to go/vt/topotools/tablet.go, export it and name it TabletIdent.

Additionally, it would be nice to also have in there the 'tags' fields, something like:
cell-123 (host1 tag1=value1)
The tags are usually used to describe a tablet (and for instance put some extra name in there, that's what we do inside YouTube). They are displayed in 'vtctl ListAllTablets' and it's very useful.

}
if tablet != nil {
return vterrors.Errorf(vterrors.Code(in), "target: %s.%s.%s, used tablet: (%+v), %v", target.Keyspace, target.Shard, topoproto.TabletTypeLString(target.TabletType), tablet, in)
return vterrors.Errorf(vterrors.Code(in), "target: %s.%s.%s, used tablet: %s-%d (%s), %v", target.Keyspace, target.Shard, topoproto.TabletTypeLString(target.TabletType), tablet.Alias.Cell, tablet.Alias.Uid, tablet.Hostname, in)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And then you can use TabletIndent here too.

@bbeaudreault
Copy link
Contributor

+1 to this change. I've been meaning to get to this myself

Based on PR feedback:
* Add Tags
* Move TabletIdent into topotools

Added a simple test as well
@demmer
Copy link
Member Author

demmer commented Jul 28, 2017

@alainjobart Thanks for the feedback. Updated as per your suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants