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

support for encoding to oc protos and exporting to agent #1

Merged
merged 7 commits into from
Feb 10, 2019

Conversation

tsloughter
Copy link
Member

This needs to wait for a new grpcbox which I'll cut once a new gpb is released. But the actual code for review is ready for reviewing.

- rebar3/compile
- rebar3/ct:
requires:
- rebar3/compile
Copy link
Member

Choose a reason for hiding this comment

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

I think we should also check if the generated proto modules are up to date.


init(_Opts) ->
%% in case this is called before the app has booted
application:ensure_all_started(opencensus_service).
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we check on return value here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Probably not necessary. It'll be started by the release and fail there and be handled.

Copy link
Member

Choose a reason for hiding this comment

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

Then I would not try to launch it again in init/1. instead just let it fail if someone didn't configured it properly.

Copy link
Member Author

Choose a reason for hiding this comment

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

Eh, why make it more complicated and potentially confusing. If there was a builtin way to set these sorts of dynamic dependencies I'd agree.

src/oc_reporter_client.erl Outdated Show resolved Hide resolved
test/opencensus_service_SUITE.erl Outdated Show resolved Hide resolved
trace_id=30880772589364415633133741367674805915,
span_id=8257235887736323202,
start_time={-576460693321990995, 2091207418848923700},
end_time={-576460679697900156, 2091207418848923700}},
Copy link
Member

Choose a reason for hiding this comment

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

Maybe it would be worth to property test this exporter?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yea, probably all of them could benefit from that.

src/oc_reporter_service.erl Outdated Show resolved Hide resolved
load_module => #{module => trunc_string(Module)
%% build_id => undefined
}
%% source_version => undefined
Copy link
Member

Choose a reason for hiding this comment

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

Testing leftovers or unimplemented features?

Copy link
Member Author

Choose a reason for hiding this comment

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

Unimplemented. Not sure what they should actually be yet.

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess build_id could be the beam module checksum... source_version would end up being the same I think, since rare that anyone puts a vsn attribute in their modules.

Copy link
Member

Choose a reason for hiding this comment

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

I would go with application:get_key(App, vsn) instead of module checksum, at least for source_version.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hm, yea, I was thinking it meant the module version, now I'm not sure.

And we'd need to track what application a module is in, I don't think there is an efficient way to check that, maybe there is.

Copy link
Member

Choose a reason for hiding this comment

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

Even if so, the version should be bound to user root application, not to application that issued the span. Otherwise we would need to spawn one OpenCensus instance per application to track all relations between applications as well. Remember that Erlang application is something different from the "application" used by all other OpenCensus libraries.

Copy link
Member Author

Choose a reason for hiding this comment

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

The source version here should be for whatever source the frame of the stacktrace relates to. If it was meant to be a source version that relates to a root application it wouldn't be in each frame.

Copy link
Member

Choose a reason for hiding this comment

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

AFAIK there is no way to know which application given module belongs to. If there is a way, then we could utilise that. Alternative solution is to allow setting that value in the config to release version, because this is what I believe was the "original meaning" in OpenCensus specification.

Copy link
Member Author

Choose a reason for hiding this comment

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

Right, that is what I said earlier. Lets just leave them undefined for the time being, the docs on the proto can barely even describe what they are.

Copy link
Member

Choose a reason for hiding this comment

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

@tsloughter if we would add application:get_application/0 return value to the metadata by default (and this would need to be done by default) then we could handle that.

src/oc_reporter_client.erl Show resolved Hide resolved
@tsloughter
Copy link
Member Author

I've updated the grpcbox dep so think this is ready to go except for a few outstanding review discussions.

config/example.config Outdated Show resolved Hide resolved
@tsloughter
Copy link
Member Author

@hauleth @deadtrickster this ok to merge? Can always make changes on top of it later.

@tsloughter tsloughter merged commit 5477d83 into opencensus-beam:master Feb 10, 2019
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.

3 participants