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 distribution support to FastForward client #13

Merged
merged 3 commits into from
Aug 18, 2020
Merged

Add distribution support to FastForward client #13

merged 3 commits into from
Aug 18, 2020

Conversation

ao2017
Copy link
Contributor

@ao2017 ao2017 commented Aug 13, 2020

This change overload FastForward client send method.

Why do we need this change ?
This change is needed to add distribution support to Semantic Metric.

Are heroic users affected by this change ?
No, Heroic users won't be affected by this change.

@project-bot project-bot bot added this to In progress in Observability Kanban Aug 13, 2020
@@ -18,24 +18,6 @@
* -/-/-
*/

/*
* FastForward Client
Copy link
Member

Choose a reason for hiding this comment

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

I believe this needs to be at the top of all our open source files, would be good to add back

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure what's happening, but if you check the actual file you will see the header.

}

@Test
public void testSerializeDisTributionValue() throws InvalidProtocolBufferException {
Copy link
Member

Choose a reason for hiding this comment

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

testSerializeDistributionValue

Copy link
Contributor Author

Choose a reason for hiding this comment

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

:) will fix.

public void send(Metric metric) throws IOException {
sendFrame(metric.serialize());
Copy link
Member

Choose a reason for hiding this comment

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

should both of these send functions just be combined into one that takes in 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.

Are you thinking about something like this send(Metric metric , Version v1) ?if not, Give me the signature of the combine function you have in mind.

Copy link
Member

@lmuhlha lmuhlha Aug 17, 2020

Choose a reason for hiding this comment

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

I guess I'm a little confused by both send functions having the same name but maybe that's how it needs to be written and I'm missing something. Was thinking something like public void send(Metric metric, version) but since it's two different types of metrics, maybe we can just be explicit with the names if possible?

  public void sendV0(Metric metric) throws IOException {
    sendFrame(metric.serialize(), Version.V0);
  }

  public void sendV1(com.spotify.ffwd.v1.Metric metric) throws IOException {
    sendFrame(metric.serialize(), Version.V1);
  }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I see your point now. We are not using a different name because we don't want to change ForwardClient public interface. With different names such as sendV1 or sendV0, users will have to make a code change whether they are using distribution or not. This is something we want to avoid.
With the overload approach (using the same name), you don't have to change anything if you are not using distribution.

Copy link
Member

Choose a reason for hiding this comment

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

Okay cool, thank you for clarifying :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great! can you merge it for me.

Copy link
Member

Choose a reason for hiding this comment

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

I'll get you permissions 👍

Copy link
Member

Choose a reason for hiding this comment

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

You should be able to merge now :)

builder.setValue(Protocol1.Value.newBuilder().setDistributionValue(byteString));
} else {
throw new IllegalArgumentException("Failed to identify distribution type" + value);

Choose a reason for hiding this comment

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

nit pick - space needed after word "type"

@@ -80,7 +62,7 @@ public Metric(
this.has = has;

Choose a reason for hiding this comment

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

@lmuhlha @sjoeboo
I don't see has() method in this class to set that field and I have a suspicion we are not using it.
I for sure knew about "proc" field and it's gone. I think we could clean it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is probably safe to keep it for now.
In the context of Metric class, it is used to determine which attribute is set.

Choose a reason for hiding this comment

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

got it. I didn't see that. 👍

@malish8632 malish8632 moved this from In progress to Waiting for review in Observability Kanban Aug 14, 2020
@lmuhlha lmuhlha merged commit 9bd9957 into spotify:master Aug 18, 2020
Observability Kanban automation moved this from Waiting for review to Ready to deploy Aug 18, 2020
@ao2017 ao2017 deleted the adele/ffw-client-distribution branch August 18, 2020 16:59
@lmuhlha lmuhlha moved this from Ready to deploy to Done in Observability Kanban Aug 24, 2020
builder.setValue(Protocol1.Value.newBuilder().setDistributionValue(byteString));
} else {
throw new IllegalArgumentException("Failed to identify distribution type : [" + value
Copy link
Member

Choose a reason for hiding this comment

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

Why does the error message say "distribution type" instead of "value type"?

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

Successfully merging this pull request may close these issues.

None yet

4 participants