Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Sarama improve async producer #120

Merged
merged 2 commits into from
Apr 14, 2021
Merged

Sarama improve async producer #120

merged 2 commits into from
Apr 14, 2021

Conversation

owais
Copy link
Contributor

@owais owais commented Apr 14, 2021

Fixed sarama instrumentation and introduced ContextExt interface

Sarama instrumentation was identifying spans with a non-unique and
uneligile key which caused a number of issues with span reporting as
some spans were not being finished. This commit replaces the said key
with the span ID.

This span ID is extracted from the kafka message headers and used to
identify any pending spans. This requires Kafka (not sarama) version
0.11.0 or newer which was released in 2017.

@owais owais requested a review from pellared April 14, 2021 08:46
@owais owais force-pushed the sarama-improve-async-producer branch from 44af612 to 451ba5b Compare April 14, 2021 08:48
@owais
Copy link
Contributor Author

owais commented Apr 14, 2021

Depends on #119

@owais owais changed the base branch from main to fix-tracing-for-queues April 14, 2021 08:51
@owais owais force-pushed the sarama-improve-async-producer branch from 451ba5b to efb1c31 Compare April 14, 2021 08:53
@owais owais changed the base branch from fix-tracing-for-queues to main April 14, 2021 08:53
@owais owais force-pushed the sarama-improve-async-producer branch 2 times, most recently from 057737e to e90170b Compare April 14, 2021 08:55
CHANGELOG.md Outdated Show resolved Hide resolved
contrib/Shopify/sarama/sarama.go Show resolved Hide resolved
contrib/Shopify/sarama/sarama_test.go Outdated Show resolved Hide resolved
ddtrace/globaltracer.go Show resolved Hide resolved
ddtrace/ddtrace.go Outdated Show resolved Hide resolved
ddtrace/mocktracer/mockspan.go Show resolved Hide resolved
@owais owais force-pushed the sarama-improve-async-producer branch 4 times, most recently from d04ae01 to 5ae1b87 Compare April 14, 2021 12:10
ddtrace/tracer/tracer.go Show resolved Hide resolved
ddtrace/tracer/tracer.go Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@pellared
Copy link
Contributor

nit: please update the PR description 😉

@owais owais force-pushed the sarama-improve-async-producer branch 2 times, most recently from 8474efb to 3745191 Compare April 14, 2021 13:49
Sarama instrumentation was identifying spans with a non-unique and
unelibale key which caused a number of issues with span reporting as
some spans were not being finished. This commit replaces the said key
with the span ID.

This span ID is extracted from the kafka message headers and used to
identify any pending spans. This requires Kafka (not sarama) version
0.11.0 or newer which was released in 2017.
@owais owais force-pushed the sarama-improve-async-producer branch from 3745191 to 649d12e Compare April 14, 2021 13:53
c3 := &externalSpanContext{}
assert.Equal(t, SpanID(c3), uint64(0))
assert.Equal(t, TraceID(c3), uint64(0))

Copy link
Contributor

@pellared pellared Apr 14, 2021

Choose a reason for hiding this comment

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

you can remove this empty line 😉

Co-authored-by: Robert Pająk <[email protected]>
c3 := &externalSpanContext{}
assert.Equal(t, SpanID(c3), uint64(0))
assert.Equal(t, TraceID(c3), uint64(0))

Copy link
Contributor

Choose a reason for hiding this comment

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

probably you could also add:

	var c4 SpanContext
	assert.Equal(t, SpanID(c4), uint64(0))
	assert.Equal(t, TraceID(c4), uint64(0))

also I like table-driven tests for tests like this https://blog.golang.org/subtests

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not gonna write a loop for 3 items 😆

@owais owais merged commit 94d9d95 into main Apr 14, 2021
@owais owais deleted the sarama-improve-async-producer branch April 14, 2021 14:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants