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

pointers for getting started #101

Closed
geib opened this issue Aug 21, 2018 · 16 comments
Closed

pointers for getting started #101

geib opened this issue Aug 21, 2018 · 16 comments

Comments

@geib
Copy link

geib commented Aug 21, 2018

I am very interested in evaluating opencensus, but need a couple of quick pointers. I plan to create a few spans, some with children spans, and use zipkin for visualizing the spans, etc. I think I have the span creation understood sufficiently, but how I report these to zipkin escapes me. For this eval I want to see every span, so I am using the oc_sampler_always, but I don't see how to report anything to zipkin. Is this done by my code, or a service in opencensus, i.e., do I need to make some call periodically to report spans to zipkin.

Thanks in advance, this looks very exciting.

@deadtrickster
Copy link
Member

Hi Mark,

I don't have a complete example, so will answer just zipkin part.

    {opencensus, [
        {reporter, {oc_reporter_sequential, [
          {oc_reporter_zipkin, [
            {address, "http://localhost:9411/api/v2/spans"},
            {local_endpoint, #{<<"serviceName">> => <<"your_service_name">>}}
          ]},
          {oc_reporter_prometheus, [{type, histogram},
                                    {name, span_histogram_seconds},
                                    {buckets, [0, 1, 2]}]}
        ]}},
        {sampler, {oc_sampler_period_or_count, [
            {period, 10}, %% one trace in 10 second
            {count, 1000} %% or each 1000'th trace
        ]}}
    ]}

this is an excerpt from our config.

@geib
Copy link
Author

geib commented Oct 2, 2018

Thanks for the help. I have made good progress.

However, I am struggling to add an annotation to a span and have it show up in zipkin.
I am basically doing something like:
ReceiveCtx = oc_trace:start_span(<<"json received from broker">>, BrokerCtx),
Annotation = oc_trace:annotation(<<"http post status">>, #{<<"status">> => <<"200">>}),
oc_trace:add_time_event(Annotation, ReceiveCtx),
oc_trace:finish_span(ReceiveCtx),

But I never see the annotation in zipkin. Any ideas.??

Thanks. Mark.

@tsloughter
Copy link
Member

@geib so the span shows up in zipkin but without the annotation?

@geib
Copy link
Author

geib commented Oct 2, 2018

@tsloughter Yes, and I see attributes as well, just no annotations.

@tsloughter
Copy link
Member

Haven't had a chance to try reproducing. I'll will try to get to it today or tomorrow. I don't have anything writing to zipkin anymore after switching jobs :).

@deadtrickster
Copy link
Member

we use zipkin. works fine

@geib
Copy link
Author

geib commented Oct 4, 2018

@deadtrickster Are you using process-dict contexts or ctx contexts? I am using ctx contexts.

@geib
Copy link
Author

geib commented Oct 4, 2018

So simple test:
ocp:with_child_span(<<"ocp_span">>),
Annotation = oc_span:annotation( <<"description">>, #{<<"key1">> => <<"value1">>}),
ocp:add_time_event(Annotation),
ocp:put_attribute(<<"key2">>, <<"value2">>),
ocp:finish_span(),

And in zipkin I see the attached.
screen shot 2018-10-04 at 2 01 45 pm

@tsloughter
Copy link
Member

I'm working on reproducing right now.

@tsloughter
Copy link
Member

So yea, I also don't see the annotation time event in zipkin. With the stdout reporter I do see that it is correctly added to the span:

{span,<<"ocp_span">>,280635656483728841932765992442195678041,
      17877493671662627446,undefined,1,'SPAN_KIND_UNSPECIFIED',
      {-576460748414685405,2115306767761664881},
      {-576460748413695173,2115306767761664881},
      #{<<"key2">> => <<"value2">>},
      undefined,[],
      [{{-576460748413792303,2115306767761664881},
        {annotation,<<"description">>,#{<<"key1">> => <<"value1">>}}}],
      undefined,undefined,undefined}

Guessing it is in the zipkin conversion that we might be losing it. I'm continuing to investigate.

@tsloughter
Copy link
Member

@tsloughter
Copy link
Member

@geib ok, I have a patch #104

@deadtrickster
Copy link
Member

heh, looks like we use our custom branch for too long

@geib
Copy link
Author

geib commented Oct 8, 2018

@tsloughter I have the patch now and the changes are working. Thanks.

Question: Does the opencensus spec specifiy that the attributes in an annotation are tagged with the string "Attributes". At least in zipkin I expected to see the description, then the attributes as simple key=value pairs.

@tsloughter
Copy link
Member

@geib the spec was started thanks to this ticket :). census-instrumentation/opencensus-specs#193

So it is still in flux. We discussed it briefly in the opencensus gitter channel.

@odeke-em
Copy link
Member

odeke-em commented Dec 2, 2018

@geib, @tsloughter recently sent this change to the website providing quickstarts, which I believe will solve your original issue. Thank you @tsloughter!

Section URL
Erlang quickstarts https://opencensus.io/quickstart/erlang/
Erlang Metrics https://opencensus.io/quickstart/erlang/metrics/
Erlang Tracing https://opencensus.io/quickstart/erlang/tracing/

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

No branches or pull requests

4 participants