{"action":"created","issue":{"url":"https://api.github.com/repos/opentracing/opentracing-java/issues/276","repository_url":"https://api.github.com/repos/opentracing/opentracing-java","labels_url":"https://api.github.com/repos/opentracing/opentracing-java/issues/276/labels{/name}","comments_url":"https://api.github.com/repos/opentracing/opentracing-java/issues/276/comments","events_url":"https://api.github.com/repos/opentracing/opentracing-java/issues/276/events","html_url":"https://github.com/opentracing/opentracing-java/pull/276","id":327078473,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkwOTY4OTgy","number":276,"title":"Simple layer on top of ByteBuffer for BINARY format.","user":{"login":"carlosalberto","id":260065,"node_id":"MDQ6VXNlcjI2MDA2NQ==","avatar_url":"https://avatars1.githubusercontent.com/u/260065?v=4","gravatar_id":"","url":"https://api.github.com/users/carlosalberto","html_url":"https://github.com/carlosalberto","followers_url":"https://api.github.com/users/carlosalberto/followers","following_url":"https://api.github.com/users/carlosalberto/following{/other_user}","gists_url":"https://api.github.com/users/carlosalberto/gists{/gist_id}","starred_url":"https://api.github.com/users/carlosalberto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carlosalberto/subscriptions","organizations_url":"https://api.github.com/users/carlosalberto/orgs","repos_url":"https://api.github.com/users/carlosalberto/repos","events_url":"https://api.github.com/users/carlosalberto/events{/privacy}","received_events_url":"https://api.github.com/users/carlosalberto/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-05-28T16:50:58Z","updated_at":"2018-06-02T14:39:09Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/opentracing/opentracing-java/pulls/276","html_url":"https://github.com/opentracing/opentracing-java/pull/276","diff_url":"https://github.com/opentracing/opentracing-java/pull/276.diff","patch_url":"https://github.com/opentracing/opentracing-java/pull/276.patch"},"body":"Provide a simple layout to let users get/set the used ByteBuffer,\r\nas well as hint them about the ByteBuffer length in the case\r\nof injection (as opposed as the current approach, where they\r\nneed to pass a large-enough ByteBuffer when calling `Tracer.inject()`).\r\n\r\nObserve this is merely a thin layer on top of `ByteBuffer`, but with the hint for letting the users know the required length of the buffer used by `inject()`.\r\n"},"comment":{"url":"https://api.github.com/repos/opentracing/opentracing-java/issues/comments/394092109","html_url":"https://github.com/opentracing/opentracing-java/pull/276#issuecomment-394092109","issue_url":"https://api.github.com/repos/opentracing/opentracing-java/issues/276","id":394092109,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NDA5MjEwOQ==","user":{"login":"carlosalberto","id":260065,"node_id":"MDQ6VXNlcjI2MDA2NQ==","avatar_url":"https://avatars1.githubusercontent.com/u/260065?v=4","gravatar_id":"","url":"https://api.github.com/users/carlosalberto","html_url":"https://github.com/carlosalberto","followers_url":"https://api.github.com/users/carlosalberto/followers","following_url":"https://api.github.com/users/carlosalberto/following{/other_user}","gists_url":"https://api.github.com/users/carlosalberto/gists{/gist_id}","starred_url":"https://api.github.com/users/carlosalberto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carlosalberto/subscriptions","organizations_url":"https://api.github.com/users/carlosalberto/orgs","repos_url":"https://api.github.com/users/carlosalberto/repos","events_url":"https://api.github.com/users/carlosalberto/events{/privacy}","received_events_url":"https://api.github.com/users/carlosalberto/received_events","type":"User","site_admin":false},"created_at":"2018-06-02T14:39:09Z","updated_at":"2018-06-02T14:39:09Z","author_association":"CONTRIBUTOR","body":"@hypnoce Hey, `setInjectionBufferLength()` serves for users asking to have a variable-size `ByteBuffer` approach (see for example #99).\r\n\r\nAs the other questions (will write my answers here, but it sounds we should put them in the docs as well ;) )\r\n\r\n> more work on on instrumenters side, since it now has to handle the lifecycle of a ByteBuffer and an additionnal method to implement.\r\n\r\nRelated to the previous point - and users **dont have** to handle the lifecycle of a `ByteBuffer` - we simply provide a default **adapter** for users to want to have a new `ByteBuffer` created for simple calls (maybe for `MockTracer`). In a real world scenario, the user would have a `ByteBuffer` pool and have a `Binary` implementation like this (snippet):\r\n\r\n```java\r\nclass CustomBinary implements Binary\r\n{\r\n  public void setInjectionBufferLength(int length)\r\n  {\r\n    this.buffer = CustomByteBufferPool.getWithLength(length);\r\n  }\r\n  public ByteBuffer injectionBuffer()\r\n  {\r\n    return this.buffer;\r\n  }\r\n}\r\n```\r\n\r\n> more work on the tracer implementers with an aditionnal method setInjectionBufferLength\r\n\r\nImplementing an extra method is less work than implementing, for users, a full `OutputStream` or `InputStream` that has been described in #243, for example :) Also, it serves a specific purpose (and for `Tracer.extract()`, it should be straightforward to use our adapter (which means: no need to write a class for it):\r\n\r\n```java\r\nByte buffer = ...;\r\nSpanContext ctx = tracer.extract(BinaryAdapters.extractionCarrier(buffer));\r\n```\r\n\r\nFor the third point, see my answer to @felixbarny on why we decided to have **that** approach (streaming) as a separate, potential new FORMAT for the future.\r\n\r\n> The previous interface from @yurishkuro did solve the first 2 items.\r\n\r\nWhich one?  #252? I think that's a fine API too, but this is simpler and would work just fine for simpler cases.\r\n"}}
{"actor":{"display_login":"carlosalberto"}}