Skip to content
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

Truncate span names at 255 characters #723

Closed
codefromthecrypt opened this issue Oct 4, 2017 · 12 comments
Closed

Truncate span names at 255 characters #723

codefromthecrypt opened this issue Oct 4, 2017 · 12 comments

Comments

@codefromthecrypt
Copy link
Contributor

codefromthecrypt commented Oct 4, 2017

Zipkin tracers usually default span names to the http method or RPC name as things like URLs can include variables that have two effects:

  • can be really long
  • can repeat, making them a poor choice for grouping

The current naming convention doesn't prevent these situations from occurring. We should at least limit (truncate) the length to 255 characters as multiple systems only index that much. The full url can still exist as a tag and be searchable by that.

From @pennstatephil on September 29, 2017 15:27

Currently, "name" in the database is limited to 255 characters. We have some REALLY long URLs (I know it's not ideal) and this causes a SQL exception:

[ZipkinMySQLStorage-1] zipkin.server.ZipkinHttpCollector        : Cannot store spans [bc4e3b8f7025cbde.aff2ed227e2cea87<:bc4e3b8f7025cbde, bc4e3b8f7025cbde.aff2ed227e2cea87<:bc4e3b8f7025cbde, 4bad878142e4c587.069ffdef649e62c4<:c603f78125156b83, 4bad878142e4c587.c603f78125156b83<:4bad878142e4c587] due to DataAccessException(SQL [null]; Data truncation: Data too long for column 'name' at row 1)

Trying to increase the field ourselves causes a key length error:

17:07:35 alter table zipkin.zipkin_spans modify column name varchar(400) Error Code: 1071. Specified key was too long; max key length is 767 bytes 0.00033 sec

Is there any way to get a longer name supported? If not, is there a recommended practice we can follow to work around the issue?

Copied from original issue: openzipkin/zipkin#1751

@codefromthecrypt
Copy link
Contributor Author

URLs tend to be a bad choice for span names as they end up with variable
names in them (which explodes the cardinality). Do you have very long span
names that don't have variables encoded? In general, we default to method
name, or where supported the associated RPC name (ex method name)

@codefromthecrypt
Copy link
Contributor Author

meant "RPC name (ex function name)"

@codefromthecrypt
Copy link
Contributor Author

From @pennstatephil on October 3, 2017 16:0

On further inspection, this is an issue with the way Spring Cloud Sleuth picks span names:

TraceFilter.java line 136:
String name = HTTP_COMPONENT + ":" + uri;

When "uri" is really long, we start seeing these issues. I can migrate this issue over to that project... Or, is there an easy way to override the span name?

edited to add: looks like it's been reported here: #500

@codefromthecrypt codefromthecrypt changed the title Feature Request: Allow longer zipkin span names Truncate span names at 255 characters Oct 4, 2017
@codefromthecrypt
Copy link
Contributor Author

revised description

@marcingrzejszczak
Copy link
Contributor

We're truncating already at 50 chars according to #530 . Do you want to extend this value to 255 ?

@codefromthecrypt
Copy link
Contributor Author

codefromthecrypt commented Oct 10, 2017 via email

@marcingrzejszczak
Copy link
Contributor

Maybe an older version of sleuth was used?

@pennstatephil
Copy link

pennstatephil commented Oct 10, 2017

Just some info-- we're on Camden release train; SR7 had Sleuth 1.1.4, which looks like it should have included #530, right? Looks like it was targeted for 1.1.3...

@marcingrzejszczak
Copy link
Contributor

You can check if your DefaultTracer contains the line of code that truncates the name. If it doesn't then you have to upgrade (btw camden is ancient) if it does then we have a bug

@pennstatephil
Copy link

You're right, we're on very old code. This is good ammunition to try and get my team up to Dalston. Thanks!

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

No branches or pull requests

3 participants