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

Add span deduper to support zipkin client/server kind spans #687

Merged
merged 7 commits into from
May 11, 2021

Conversation

annanay25
Copy link
Contributor

@annanay25 annanay25 commented May 4, 2021

Testing:

curl -X POST http://localhost:9411 -H 'Content-Type: application/json' -d '[{
 "id": "12345",
 "traceId": "0123456789abcdbb",
 "timestamp": 1608239395286553,
 "duration": 100000,
 "name": "span from bash!",
 "kind": "SERVER",
 "parentId": "6b221d5bc9e6496c"
 "tags": {
    "http.method": "GET",
    "http.path": "/api"
  },
  "localEndpoint": {
    "serviceName": "shell script"
  }
},
{
 "id": "12345",
 "traceId": "0123456789abcdbb",
 "timestamp": 1608239395286533,
 "duration": 100000,
 "name": "span from bash!",
 "kind": "CLIENT",
 "tags": {
    "http.method": "GET",
    "http.path": "/api"
  },
  "localEndpoint": {
    "serviceName": "shell script"

  }
}]'

zipkin dedupe

Signed-off-by: Annanay annanayagarwal@gmail.com

Benchmark results

$ go test -bench=.
goos: darwin
goarch: amd64
pkg: github.com/grafana/tempo/modules/frontend
cpu: Intel(R) Core(TM) i5-8279U CPU @ 2.40GHz
BenchmarkDeduper100-8      	   89684	     13172 ns/op
BenchmarkDeduper1000-8     	    7178	    163071 ns/op
BenchmarkDeduper10000-8    	     738	   1567722 ns/op
BenchmarkDeduper100000-8   	      57	  19311762 ns/op
PASS
ok  	github.com/grafana/tempo/modules/frontend	6.102s

I think these are ok to proceed.

What this PR does:
Adds a span deduper middleware that allows multiple spans of the same ID but different spanKind (client/server).

This is supported in Zipkin.

Which issue(s) this PR fixes:
Fixes #682

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

Signed-off-by: Annanay <annanayagarwal@gmail.com>
Copy link
Member

@joe-elliott joe-elliott left a comment

Choose a reason for hiding this comment

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

Two comments but otherwise looks good so far. Besides the comments two other things that would be nice to see:

  • a comment to indicate that this is being done to support zipkin
  • benchmarking of various trace sizes: 100, 1k, 10k, 100k spans

I'm a little nervous about the impact on correctness but with @kvrhdn 's improvements to the vulture I think we will feel better.

modules/frontend/deduper_test.go Show resolved Hide resolved
@joe-elliott joe-elliott mentioned this pull request May 4, 2021
3 tasks
Signed-off-by: Annanay <annanayagarwal@gmail.com>
@annanay25
Copy link
Contributor Author

Just need to add benchmarks now.

Signed-off-by: Annanay <annanayagarwal@gmail.com>
@annanay25 annanay25 marked this pull request as ready for review May 5, 2021 13:54
Signed-off-by: Annanay <annanayagarwal@gmail.com>
Signed-off-by: Annanay <annanayagarwal@gmail.com>
Signed-off-by: Annanay <annanayagarwal@gmail.com>
@annanay25 annanay25 requested a review from joe-elliott May 6, 2021 10:48
Copy link
Member

@joe-elliott joe-elliott left a comment

Choose a reason for hiding this comment

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

Some comments. I think you need to make a change to your benchmark but I don't expect it to appreciably change the results.

Agree if the results stay roughly the same that we can just always run the deduper.

modules/frontend/deduper.go Show resolved Hide resolved
modules/frontend/deduper_test.go Show resolved Hide resolved
modules/frontend/deduper_test.go Show resolved Hide resolved
modules/frontend/frontend.go Outdated Show resolved Hide resolved
Signed-off-by: Annanay <annanayagarwal@gmail.com>
@annanay25 annanay25 merged commit d6d7af0 into grafana:main May 11, 2021
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.

Support Zipkin Client/Server Spans
2 participants