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

Span without service name causes NullPointerException #148

Open
z-oo opened this issue Sep 13, 2019 · 2 comments
Open

Span without service name causes NullPointerException #148

z-oo opened this issue Sep 13, 2019 · 2 comments
Assignees
Labels

Comments

@z-oo
Copy link
Contributor

z-oo commented Sep 13, 2019

Example:

curl -X POST -s localhost:9411/api/v2/spans -H'Content-Type: application/json' -d '[{"traceId":"fe1583ed5be1b96cf40538f958ca97a6","id":"96169d26c53f25ab","name":"loader::unload","timestamp":1568360755828060,"duration":124,"localEndpoint":{"ipv6":"::1"}}]'

result in

java.lang.NullPointerException: null
	at zipkin2.translation.stackdriver.AttributesExtractor.extract(AttributesExtractor.java:83) ~[zipkin-translation-stackdriver-0.14.1-SNAPSHOT.jar!/:?]
	at zipkin2.translation.stackdriver.SpanTranslator.translate(SpanTranslator.java:112) ~[zipkin-translation-stackdriver-0.14.1-SNAPSHOT.jar!/:?]
	at zipkin2.translation.stackdriver.SpanTranslator.translate(SpanTranslator.java:60) ~[zipkin-translation-stackdriver-0.14.1-SNAPSHOT.jar!/:?]
	at zipkin2.storage.stackdriver.StackdriverSpanConsumer.accept(StackdriverSpanConsumer.java:51) ~[zipkin-storage-stackdriver-0.14.1-SNAPSHOT.jar!/:?]
	at zipkin2.collector.Collector.store(Collector.java:200) ~[zipkin-collector-2.16.3-SNAPSHOT.jar!/:?]
	at zipkin2.collector.Collector$StoreSpans.run(Collector.java:229) ~[zipkin-collector-2.16.3-SNAPSHOT.jar!/:?]
	at com.linecorp.armeria.common.AbstractRequestContext.lambda$makeContextAware$1(AbstractRequestContext.java:69) ~[armeria-0.91.0.jar!/:?]
	at com.linecorp.armeria.common.AbstractRequestContext.lambda$makeContextAware$1(AbstractRequestContext.java:69) ~[armeria-0.91.0.jar!/:?]
	at io.micrometer.core.instrument.AbstractTimer.record(AbstractTimer.java:160) ~[micrometer-core-1.2.1.jar!/:1.2.1]
	at io.micrometer.core.instrument.Timer.lambda$wrap$0(Timer.java:144) ~[micrometer-core-1.2.1.jar!/:1.2.1]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [netty-common-4.1.39.Final.jar!/:4.1.39.Final]
	at java.lang.Thread.run(Thread.java:834) [?:?]

while

curl -X POST -s localhost:9411/api/v2/spans -H'Content-Type: application/json' -d '[{"traceId":"fe1583ed5be1b96cf40538f958ca97a6","id":"96169d26c53f25ab","name":"loader::unload","timestamp":1568360755828060,"duration":124,"localEndpoint":{"ipv6":"::1", "serviceName":"test"}}]'

works fine.

@z-oo
Copy link
Contributor Author

z-oo commented Sep 13, 2019

And it is caused by isEmpty() check that is not null-safe:
https://github.com/openzipkin/zipkin-gcp/blob/master/translation-stackdriver/src/main/java/zipkin2/translation/stackdriver/AttributesExtractor.java#L83

if (zipkinSpan.localEndpoint() != null && !zipkinSpan.localEndpoint().serviceName().isEmpty()) {

@codefromthecrypt
Copy link
Member

codefromthecrypt commented Sep 13, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants