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 support for OTLP Exporter Protobuf over HTTP #1868

Merged
merged 31 commits into from
Jul 29, 2021

Conversation

srikanthccv
Copy link
Member

@srikanthccv srikanthccv commented May 23, 2021

Description

Fixes #1106

@codeboten
Copy link
Contributor

@lonewolf3739 is this still work in progress?

@srikanthccv
Copy link
Member Author

@codeboten there were some gaps b/w collector specification and collector implementation. I will check it again and get back to this.

@srikanthccv srikanthccv changed the title [WIP] Add support for OTLP Exporter Protobuf over HTTP Add support for OTLP Exporter Protobuf over HTTP Jun 26, 2021
@srikanthccv srikanthccv marked this pull request as ready for review June 26, 2021 00:53
@srikanthccv srikanthccv requested a review from a team as a code owner June 26, 2021 00:53
Copy link
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

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

Thanks for picking this back up @lonewolf3739! Will review the code further later today. It would be great if you could also add an integration test here

@srikanthccv
Copy link
Member Author

Thanks for picking this back up @lonewolf3739! Will review the code further later today. It would be great if you could also add an integration test here

Sure, block the PR when you review until I add the integration test.

@srikanthccv
Copy link
Member Author

@codeboten Added the integration test. Please take a look.

Copy link
Contributor

@ocelotl ocelotl left a comment

Choose a reason for hiding this comment

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

Minor changes requested 👍

Copy link
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

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

Nice! This PR is great, just a few comments.

self._shutdown = True


def _headers_from_env() -> Optional[Dict[str, str]]:
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to necessarily change this here, but i think we're repeating the pattern of splitting variables by , and = in a few places, might be nice to pull that code into a utility.

Copy link
Member Author

Choose a reason for hiding this comment

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

Agree. Probably some internal only private method in api/sdk.

Copy link
Member

Choose a reason for hiding this comment

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

+1 also what happens if the user wants to put a , or = character in their header/regex whatever. Is an escape sequence documented anywhere?

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 believe it is documented in the 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.

Created an issue here #1949.

@srikanthccv
Copy link
Member Author

List of public symbols

Screenshot 2021-07-03 at 9 23 26 AM

@srikanthccv srikanthccv added the Approve Public API check This label shows that the public symbols added or changed in a PR are strictly necessary label Jul 7, 2021


DEFAULT_COMPRESSION = Compression.NoCompression
DEFAULT_ENDPOINT = "http://localhost:55681/v1/traces"
Copy link
Contributor

Choose a reason for hiding this comment

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

Where is this default defined in the specs?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hm it's not defined yet but it should be 😅 open-telemetry/opentelemetry-specification#1816

timeout: Optional[int] = None,
compression: Optional[Compression] = None,
):
self._endpoint = endpoint or environ.get(
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason why some of these get their own helper functions but others do not for retrieving env vars?

Copy link
Member Author

Choose a reason for hiding this comment

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

No big reason except pulling this small piece of code into separate functions is kind of overkill and some values require extra processing.

OTEL_EXPORTER_OTLP_TRACES_ENDPOINT,
environ.get(OTEL_EXPORTER_OTLP_ENDPOINT, DEFAULT_ENDPOINT),
)
self._certificate_file = certificate_file or environ.get(
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we able to re-use the code in exporter mixin? Seems to be a lot of similarities. Maybe we should extract that code out and share it across all otlp exporters?

Copy link
Member Author

Choose a reason for hiding this comment

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

No that is not possible as of now since both are different packages. When we decided to split the packages we decided we are fine with repetitive code if it is trivial. Probably worth addressing in another PR for all otlp exporters.

platforms = any
license = Apache-2.0
classifiers =
Development Status :: 5 - Production/Stable
Copy link
Contributor

Choose a reason for hiding this comment

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

Might have to have a discussion on whether or not we can mark this as stable since collector is technically not stable (even though otlp grpc is stable). Will talk about it in the SIG.

Copy link
Contributor

@codeboten codeboten Jul 16, 2021

Choose a reason for hiding this comment

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

We didn't get a chance to talk about this in the SIG but I agree w/ @lzchen, we should mark hold off marking this as stable until the port is confirmed. We can then merge this as beta until then.

# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "1.4.0.dev0"
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest we mark this as 0.23.dev0 until the port discussion is sorted in the spec open-telemetry/opentelemetry-specification#1816

Copy link
Member Author

Choose a reason for hiding this comment

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

Issue on collector repo open-telemetry/opentelemetry-collector#3617. I think it will take some to get the port fixed. I will change this to 0.23.dev0.

@srikanthccv
Copy link
Member Author

Marked as 0.23.dev0 and changed status to beta.

Copy link
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

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

Nice! Thanks for addressing my comments

@codeboten
Copy link
Contributor

@lzchen @aabmass please approve if your comments have been addressed.

@codeboten codeboten requested review from lzchen and aabmass July 19, 2021 15:52
@codeboten
Copy link
Contributor

@lonewolf3739 please take a look at the failing test and we can get this merged!

@srikanthccv
Copy link
Member Author

@codeboten will update this once #1985 gets merged.

@srikanthccv
Copy link
Member Author

@codeboten All tests are passing now.

@codeboten
Copy link
Contributor

@lonewolf3739 nice thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Approve Public API check This label shows that the public symbols added or changed in a PR are strictly necessary
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support protobuf over HTTP in OTLP exporter
6 participants