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

Update Telemetry format and allow to customize it #195

Merged
merged 4 commits into from
Apr 17, 2019

Conversation

lbalmaceda
Copy link
Contributor

Changes

  • Use the new telemetry format
  • Make Telemetry class public
  • Allow AuthAPI and ManagementAPI clients to set a new custom telemetry instance.

References

SDK-700

Testing

  • This change adds test coverage
  • This change has been tested on the latest version of the platform/language or why not

Checklist

@lbalmaceda lbalmaceda added this to the v1-Next milestone Apr 11, 2019
public Telemetry(String name, String version, String core) {
this.name = name;
this.version = version;
this.core = core;
Copy link
Contributor

Choose a reason for hiding this comment

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

What is core here? If it's used to extend this SDK's telemetry, let's put the SDK name instead to be more clear.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

core for this library is nothing (null). But those libs that use this internally, would expose as core the version of auth0-java (this sdk). In other SDKs we named it "libraryVersion", I can change to that if you agree. Remember though env includes core as per the RFC.

e.g. on android https://github.com/auth0/Lock.Android/blob/eeff3594786520d50ba3938fc9f7ebf2f80588b8/lib/src/main/java/com/auth0/android/lock/Lock.java#L232

Copy link
Contributor

Choose a reason for hiding this comment

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

RFC mentioned core long ago (mostly in the context of libs using auth0.js) but it's not there now. Let's use the library name itself, that will be much clearer when pulling reports. I'l add that to the RFC now.


public String getValue() {
Map<String, String> values = new HashMap<>();
Map<String, Object> values = new HashMap<>();
if (name != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would we ever send telemetry if the name was null? Or the version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The only scenario this would happen is if the user overrides it and sets an explicit null for them. I don't think we should send the telemetry in that case. But then we should change that on the android side as well (PR had the same diff and you approved it) auth0/Auth0.Android#209. Side note, env will always have at least the java version regardless. But again, without name and version it wouldn't make sense. Your call!

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know what the behavior in the reports would be with a blank name or version. Name is the most critical, without that we have nothing to go off of so I would skip sending in that case. For version ... that would likely just be a mistake and if it was a non-Auth0 developer extending for some reason, they wouldn't see the problem. So ... name required, I don't think version needs to be. Thoughts?

Sorry if I missed that in the other library. If there are questions around how the telemetry should behave, can you call that out with a comment next time so it's not missed?

value = tmpValue;
}

public String getName() {
Copy link
Contributor

Choose a reason for hiding this comment

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

When are these getters used? Just for testing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep. I want to expose something so libraries overriding this can check everything is being replaced fine 👍

Copy link
Contributor

@joshcanhelp joshcanhelp left a comment

Choose a reason for hiding this comment

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

See replies

@lbalmaceda lbalmaceda merged commit 4648f6c into master Apr 17, 2019
@lbalmaceda lbalmaceda deleted the update-telemetry branch April 17, 2019 14:02
@lbalmaceda lbalmaceda modified the milestones: v1-Next, 1.12.0 Apr 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants