Skip to content
This repository was archived by the owner on Apr 21, 2025. It is now read-only.

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.

*/

/*
* 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 :)

ByteString byteString = ByteString.copyFrom(distributionValue.getValue().array());
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. 👍

ByteString byteString = ByteString.copyFrom(distributionValue.getValue().array());
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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants