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 Google Cloud Pub Sub reporter #142

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

javierviera
Copy link

@javierviera javierviera commented Aug 6, 2019

Add a new reporter for GCP streaming service.

The idea is to have pub sub subscriber as zipkin collector to process the spans

reporter/pubsub/pubsub.go Outdated Show resolved Hide resolved
}
if r.client == nil {
ctx := context.Background()
proj := os.Getenv("GOOGLE_CLOUD_PROJECT")
Copy link
Contributor

@jcchavezs jcchavezs Aug 6, 2019

Choose a reason for hiding this comment

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

I have mixed feelings here. In one hand I usually don't like env vars support for libraries but I don't see a trivial way to not to have mutually exclusive options like client and google_cloud_project. Maybe the env var is good enough. Any thoughts @basvanbeek ?

reporter/pubsub/pubsub.go Outdated Show resolved Hide resolved
@jcchavezs
Copy link
Contributor

Nice start @javierviera. I left some comments.

@coveralls
Copy link

coveralls commented Aug 6, 2019

Coverage Status

Coverage decreased (-2.2%) to 60.797% when pulling 5744523 on javierviera:master into b1a3538 on openzipkin:master.

@codefromthecrypt
Copy link
Member

codefromthecrypt commented Aug 7, 2019 via email

@javierviera
Copy link
Author

javierviera commented Aug 7, 2019

@adriancole we are evaluating 2 options... most probably we will add a new collector in https://github.com/javierviera/zipkin/tree/master/zipkin-collector but we are also evaluating create a private google cloud function in GCP which pull Google PubSub message and add it to zipkin by API (https://zipkin.io/zipkin-api/#/default/post_spans)

type ReporterOption func(c *Reporter)

// Send send span to topic
func (r *Reporter) Send(s model.SpanModel) {
Copy link
Contributor

@jcchavezs jcchavezs Aug 8, 2019

Choose a reason for hiding this comment

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

I am curious about the tradeoff for reporting one span each time of piling up them up to a point and then do the reporting. I would prefer to not to do a http call on every span cc @basvanbeek

Copy link
Member

Choose a reason for hiding this comment

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

We can for symmetry reasons with other reporters (and maybe optimization of message encoding/decoding). For request/response calls it is not needed as pubsub handles sending underneath and batches.... see https://godoc.org/cloud.google.com/go/pubsub

@codefromthecrypt
Copy link
Member

codefromthecrypt commented Aug 9, 2019 via email

@javierviera
Copy link
Author

javierviera commented Aug 10, 2019

Thanks @adriancole Why not creating a new collector in https://github.com/javierviera/zipkin/tree/master/zipkin-collector instead of updating zipkin-gcp? Seems like zipkin-gcp if for having stackdriver as storage.... My idea its just add a new transport.... Am i missing something?

@jcchavezs
Copy link
Contributor

jcchavezs commented Aug 10, 2019 via email

@codefromthecrypt
Copy link
Member

@javierviera I just raised this issue openzipkin/zipkin-gcp#132

@javierviera
Copy link
Author

@jcchavezs is there anything pending in the PR?

}

_, err = client.CreateTopic(ctx, topicID)
if err != nil {
Copy link
Contributor

@jcchavezs jcchavezs Sep 9, 2019

Choose a reason for hiding this comment

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

I think the best here is that instead of returning a nil we pass the t *testing.T variable into the setup and fatal (t.Fatal) if any of this errs is not nil.
What do you think?

Copy link
Author

Choose a reason for hiding this comment

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

It was like that originally. But the problem is that it would always fail in a CI server or everywhere where GOOGLE_CLOUD_PROJECT is not configured. As the test topic is created in an exiting GCP project... We we test the error but cannot test the success setup...

@jcchavezs
Copy link
Contributor

Hi @javierviera sorry for the late response. I added a couple of comments, I think we are very close. Great work!

@KeisukeYamashita
Copy link

@javierviera Any updates? If you don't have time, I can help you:)

@jcchavezs
Copy link
Contributor

jcchavezs commented Nov 26, 2019 via email

@javierviera
Copy link
Author

Hi folks,

I just improved the unit tests as required. Please check.

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.

8 participants