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

*: Integrate timeline tracing with TiKV #19557

Closed
wants to merge 6 commits into from
Closed

Conversation

zhongzc
Copy link
Contributor

@zhongzc zhongzc commented Aug 28, 2020

Signed-off-by: zhongzc zhongzc_arch@outlook.com

Getting Started

Create a Work Directory

mkdir trace-tidb && cd trace-tidb

Build TiDB

git clone -b tracing https://github.com/zhongzc/tidb --depth=1
(cd tidb && make)

Build TiKV

git clone -b new-minitrace https://github.com/zhongzc/tikv --depth=1
(cd tikv && make build)

Create Config Files

echo -e '[log]\nslow-threshold=5\n[trace]\nenable = true\njaeger-thrift-compact-agent = "127.0.0.1:6831"\ndatadog-agent = "127.0.0.1:8126"' > tidb.config

Run Jaeger

docker run --rm -d -p6831:6831/udp -p16686:16686 --name jaeger jaegertracing/all-in-one:latest

You can then navigate to http://localhost:16686 to access the Jaeger UI.

Set Up Datadog (alternative)

Follow https://docs.datadoghq.com/getting_started/tracing/

Run TiUP to Start a Cluster Locally

tiup playground v4.0.12 --db.binpath=tidb/bin/tidb-server --db.config=tidb.config --kv.binpath=tikv/target/debug/tikv-server --tiflash 0

Examples

Trace data of SQL whose cost time more than log.slow-threshold (set to 5ms above) will be recorded.

Select:

From Jaeger UI:

Screenshot from 2020-11-26 17-22-21

From Datadog UI:
Screenshot from 2020-12-04 10-59-18

Insert:

From Jaeger UI:
Screenshot from 2020-11-26 17-23-32

From Datadog UI:
Screenshot from 2020-12-04 11-00-08

Screenshot from 2020-12-18 09-42-15

Release note

  • TBD

@sre-bot
Copy link
Contributor

sre-bot commented Sep 4, 2020

@github-actions github-actions bot added the sig/execution SIG execution label Sep 4, 2020
@sre-bot
Copy link
Contributor

sre-bot commented Sep 4, 2020

2 similar comments
@sre-bot
Copy link
Contributor

sre-bot commented Sep 9, 2020

@sre-bot
Copy link
Contributor

sre-bot commented Sep 9, 2020

@sre-bot
Copy link
Contributor

sre-bot commented Sep 9, 2020

2 similar comments
@sre-bot
Copy link
Contributor

sre-bot commented Sep 9, 2020

@sre-bot
Copy link
Contributor

sre-bot commented Sep 10, 2020

@sre-bot
Copy link
Contributor

sre-bot commented Nov 24, 2020

1 similar comment
@sre-bot
Copy link
Contributor

sre-bot commented Nov 24, 2020

@sre-bot
Copy link
Contributor

sre-bot commented Nov 25, 2020

@zhongzc zhongzc force-pushed the tracing branch 11 times, most recently from 9f25358 to a085381 Compare December 2, 2020 06:07
@zhongzc zhongzc force-pushed the tracing branch 3 times, most recently from 18a9b5a to 8737e7e Compare January 10, 2021 10:02
@zhongzc zhongzc marked this pull request as ready for review January 12, 2021 14:38
@zhongzc zhongzc requested a review from a team as a code owner January 12, 2021 14:38
@zhongzc zhongzc requested review from wshwsh12 and removed request for a team January 12, 2021 14:38
Signed-off-by: zhongzc <zhongzc_arch@outlook.com>

integration

Signed-off-by: zhongzc <zhongzc_arch@outlook.com>

support local storage

Signed-off-by: Zhenchi <zhongzc_arch@outlook.com>
@ti-chi-bot
Copy link
Member

@zhongzc: PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 23, 2021
@wshwsh12 wshwsh12 removed their request for review March 14, 2021 13:35
@ti-chi-bot ti-chi-bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label May 10, 2021
curTraceID uint64
curServiceName string
curJTrace *jaeger.Trace
curSpanIDPrefix uint32
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@breeswish

server/conn.go Show resolved Hide resolved
server/conn.go Outdated
var handle minitrace.TraceHandle
traceEnabled := tidbtrace.Enable.Load()
if traceEnabled {
ctx, handle = minitrace.StartRootSpan(ctx, cc.packetToSQL(data), rand.Uint64(), &tidbtrace.Context{})
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@c4pt0r You can replace rand.Uint64() with another meaningful trace ID here.

Copy link
Member

Choose a reason for hiding this comment

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

Sure

Signed-off-by: Zhenchi <zhongzc_arch@outlook.com>
Signed-off-by: Zhenchi <zhongzc_arch@outlook.com>
Signed-off-by: Zhenchi <zhongzc_arch@outlook.com>
Signed-off-by: Zhenchi <zhongzc_arch@outlook.com>
Signed-off-by: Zhenchi <zhongzc_arch@outlook.com>
@tisonkun
Copy link
Contributor

Closed as store/tikv moved to client-go.

Thanks for your contribution @zhongzc ! You may create another PR on both tidb and client-go for reimplementing it.

@Defined2014
Copy link
Contributor

Seems it's a very useful PR, I think we should support/merge it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
challenge-program component/config needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. sig/execution SIG execution sig/sql-infra SIG: SQL Infra size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants