-
Notifications
You must be signed in to change notification settings - Fork 113
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
base: master
Are you sure you want to change the base?
Conversation
# Conflicts: # go.mod # go.sum
# Conflicts: # go.mod # go.sum
reporter/pubsub/pubsub.go
Outdated
} | ||
if r.client == nil { | ||
ctx := context.Background() | ||
proj := os.Getenv("GOOGLE_CLOUD_PROJECT") |
There was a problem hiding this comment.
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 ?
Nice start @javierviera. I left some comments. |
usually we don't add reporters for transports that have no collectors. this
leads to an incomplete feature story and possibly code maintained for only
one user or site. can you mention what you are doing on the other side?
…On Tue, Aug 6, 2019, 6:58 PM Javier Viera ***@***.***> wrote:
Add a new reporter for GCP streaming service.
The idea is tho have pub sub subscriber as zipkin collector to process the
spans
------------------------------
You can view, comment on, or merge this pull request online at:
#142
Commit Summary
- Add GCP pubsub reporter
- Merge remote-tracking branch 'upstream/master'
- Merge remote-tracking branch 'upstream/master'
- Add Pubsub dependencies
- Configure topic with env name
File Changes
- *M* .gitignore
<https://github.com/openzipkin/zipkin-go/pull/142/files#diff-0> (1)
- *M* README.md
<https://github.com/openzipkin/zipkin-go/pull/142/files#diff-1> (3)
- *M* go.mod
<https://github.com/openzipkin/zipkin-go/pull/142/files#diff-2> (14)
- *M* go.sum
<https://github.com/openzipkin/zipkin-go/pull/142/files#diff-3> (71)
- *A* reporter/pubsub/pubsub.go
<https://github.com/openzipkin/zipkin-go/pull/142/files#diff-4> (109)
- *A* reporter/pubsub/pubsub_test.go
<https://github.com/openzipkin/zipkin-go/pull/142/files#diff-5> (81)
Patch Links:
- https://github.com/openzipkin/zipkin-go/pull/142.patch
- https://github.com/openzipkin/zipkin-go/pull/142.diff
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#142?email_source=notifications&email_token=AAAPVVY2D4SHQ5O7FK7PXMTQDE4JXA5CNFSM4IJUCARKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HDSKWZA>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAPVV2NWMZODQK4VFOEFLDQDE4JXANCNFSM4IJUCARA>
.
|
@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) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
ok probably if adding a collector, forking (and raising a pull request) on
zipkin-gcp could be a nice route. the cloud function idea is also neat. I
think span consumption is a neat use case of lambda though there are some
gotchas the main collector code handles.
Assuming we are to merge this, let's make sure this accepts the literally
same data format as other transports (list of json or proto encoded spans).
If you have time, please add/update an issue on zipkin-gcp about the
pub-sub so that this is less tail wagging dog
…On Wed, Aug 7, 2019, 2:37 PM Javier Viera ***@***.***> wrote:
usually we don't add reporters for transports that have no collectors.
this leads to an incomplete feature story and possibly code maintained for
only one user or site. can you mention what you are doing on the other side?
… <#m_3963051830818073207_m_6748561530216320011_m_-2186552932525891970_>
On Tue, Aug 6, 2019, 6:58 PM Javier Viera *@*.***> wrote: Add a new
reporter for GCP streaming service. The idea is tho have pub sub subscriber
as zipkin collector to process the spans ------------------------------ You
can view, comment on, or merge this pull request online at: #142
<#142> Commit Summary - Add
GCP pubsub reporter - Merge remote-tracking branch 'upstream/master' -
Merge remote-tracking branch 'upstream/master' - Add Pubsub dependencies -
Configure topic with env name File Changes - *M* .gitignore
https://github.com/openzipkin/zipkin-go/pull/142/files#diff-0 (1) - *M*
README.md https://github.com/openzipkin/zipkin-go/pull/142/files#diff-1
(3) - *M* go.mod
https://github.com/openzipkin/zipkin-go/pull/142/files#diff-2 (14) - *M*
go.sum https://github.com/openzipkin/zipkin-go/pull/142/files#diff-3 (71)
- *A* reporter/pubsub/pubsub.go
https://github.com/openzipkin/zipkin-go/pull/142/files#diff-4 (109) - *A*
reporter/pubsub/pubsub_test.go
https://github.com/openzipkin/zipkin-go/pull/142/files#diff-5 (81) Patch
Links: - https://github.com/openzipkin/zipkin-go/pull/142.patch -
https://github.com/openzipkin/zipkin-go/pull/142.diff — You are receiving
this because you are subscribed to this thread. Reply to this email
directly, view it on GitHub <#142
<#142>?email_source=notifications&email_token=AAAPVVY2D4SHQ5O7FK7PXMTQDE4JXA5CNFSM4IJUCARKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HDSKWZA>,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAPVV2NWMZODQK4VFOEFLDQDE4JXANCNFSM4IJUCARA
.
@adriancole <https://github.com/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)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#142?email_source=notifications&email_token=AAAPVV3MFE7BPCVVWBT37WTQDJUTPA5CNFSM4IJUCARKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3XLTLA#issuecomment-518961580>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAPVV5CHM67DJS74Q5IOK3QDJUTPANCNFSM4IJUCARA>
.
|
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? |
@javierviera basically that. You create a goroutine when starting the
reporter and listen to a channel signal and a termination signal sent by
the *Close* method.
|
@javierviera I just raised this issue openzipkin/zipkin-gcp#132 |
@jcchavezs is there anything pending in the PR? |
} | ||
|
||
_, err = client.CreateTopic(ctx, topicID) | ||
if err != nil { |
There was a problem hiding this comment.
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 err
s is not nil
.
What do you think?
There was a problem hiding this comment.
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...
Hi @javierviera sorry for the late response. I added a couple of comments, I think we are very close. Great work! |
@javierviera Any updates? If you don't have time, I can help you:) |
That would be awesome @keke
|
Hi folks, I just improved the unit tests as required. Please check. |
Add a new reporter for GCP streaming service.
The idea is to have pub sub subscriber as zipkin collector to process the spans