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

Introduce OpenTelemetry collector #2086

Merged
merged 4 commits into from
Mar 23, 2020

Conversation

pavolloffay
Copy link
Member

@pavolloffay pavolloffay requested a review from a team as a code owner February 25, 2020 15:59

// TODO caused compilation issues due to refactoring in https://github.com/jaegertracing/jaeger/pull/2060
// TODO app/HandlerConfig moved to app/handler/HandlerConfig
//cmpts, err := defaults.Components()
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 could not initialize all default components (importers, processors, exporters) because Jaeger importer imports jaeger/collector/app and there was a breaking change #2060

Copy link
Member Author

Choose a reason for hiding this comment

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

Once open-telemetry/opentelemetry-collector#570 is merged we should be able to use defaults.components()

Copy link
Contributor

Choose a reason for hiding this comment

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

I commented on open-telemetry/opentelemetry-collector#570 and we can merge it quickly if it blocks you.

package main

import (
"github.com/open-telemetry/opentelemetry-collector/config"
Copy link
Member

Choose a reason for hiding this comment

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

there should be a corresponding change in Gopkg.toml

@pavolloffay
Copy link
Member Author

So importing opentelemetry-collector will certainly introduce some complications.

For instance a breaking change in this repo might result in a compilation error (like in https://github.com/jaegertracing/jaeger/pull/2086/files/de7040ace7ce90518b1ff99c32f471a801d6665c#diff-bc7bd0edae17579706fb28fa796dd8cf).

The opposite approach might be to move Jaeger components here and import them in opentelemetry-collector if we assume that OTEL interfaces will not break (I assume they will break less than Jaeger code).

An alternative solution might be to re-implement jaeger components directly here and use those instead. We could just import a shared Jaeger configuration from OTEL (It would have to be moved to a separate package). I frankly don't like this option.

Also Jaeger uses go dep and OTEL go modules. I am not sure if this will cause any problems once we switch Jaeger to go modules #1546.

Any thoughts @yurishkuro @tigrannajaryan?

@tigrannajaryan
Copy link
Contributor

So importing opentelemetry-collector will certainly introduce some complications.

For instance a breaking change in this repo might result in a compilation error (like in https://github.com/jaegertracing/jaeger/pull/2086/files/de7040ace7ce90518b1ff99c32f471a801d6665c#diff-bc7bd0edae17579706fb28fa796dd8cf).

The opposite approach might be to move Jaeger components here and import them in opentelemetry-collector if we assume that OTEL interfaces will not break (I assume they will break less than Jaeger code).

This would mean this repo references opentelemetry-collector and opentelemetry-collector references this repo. I do not know if go modules allow a circular references between repos, but even if it does it will not look nice. I'd rather not do it.

Alternatively we could references Jaeger components located in this repo from opentelemetry-collector-contrib. That would no longer be a circular reference, however it would put Jaeger out of core build, which I would not want to do (among other things we committed to having built-in support for Jaeger in Collector core).

An alternative solution might be to re-implement jaeger components directly here and use those instead. We could just import a shared Jaeger configuration from OTEL (It would have to be moved to a separate package). I frankly don't like this option.

Yeah, this does not sound like a good solution. Lots of code duplication.

Also Jaeger uses go dep and OTEL go modules. I am not sure if this will cause any problems once we switch Jaeger to go modules #1546.

I have no experience mixing the 2 approaches.

@yurishkuro
Copy link
Member

@pavolloffay can you enumerate which parts of Jaeger the OTel Collector imports?

@pavolloffay
Copy link
Member Author

// exporter, receiver
        "github.com/jaegertracing/jaeger/proto-gen/api_v2"
// receiver, translator
	"github.com/jaegertracing/jaeger/thrift-gen/baggage"
	"github.com/jaegertracing/jaeger/thrift-gen/jaeger"
	"github.com/jaegertracing/jaeger/thrift-gen/jaeger"
	"github.com/jaegertracing/jaeger/thrift-gen/sampling"
	"github.com/jaegertracing/jaeger/thrift-gen/zipkincore"

// receiver
	"github.com/jaegertracing/jaeger/cmd/agent/app/configmanager"
	"github.com/jaegertracing/jaeger/cmd/agent/app/configmanager/grpc"
	"github.com/jaegertracing/jaeger/cmd/agent/app/httpserver"
	"github.com/jaegertracing/jaeger/cmd/agent/app/processors"
	"github.com/jaegertracing/jaeger/cmd/agent/app/reporter"
	"github.com/jaegertracing/jaeger/cmd/agent/app/servers"
	"github.com/jaegertracing/jaeger/cmd/agent/app/servers/thriftudp"
	"github.com/jaegertracing/jaeger/cmd/collector/app/handler"
	"github.com/jaegertracing/jaeger/cmd/collector/app/sampling"
	"github.com/jaegertracing/jaeger/plugin/sampling/strategystore/static"

// translator
	"github.com/jaegertracing/jaeger/model"

@annanay25
Copy link
Member

Is it possible to extract the common jaeger components into packages, say at github.com/jaegertracing/jaeger/pkg and have both Jaeger and OTel import these?

@yurishkuro
Copy link
Member

It is possible, but I don’t like it. It will make jaeger development harder by moving critical parts to another repo.

@pavolloffay
Copy link
Member Author

This would mean this repo references opentelemetry-collector and opentelemetry-collector references this repo. I do not know if go modules allow a circular references between repos, but even if it does it will not look nice. I'd rather not do it.

One way or another there will be a cyclic dependency if we want to have the jaeger-opentelemetry-collector in this repository.
I don't know how it exactly works, maybe the cycle is not allowed only per packages and can be used per repositories.

I think it will be better to host as much as possible Jaeger related code in Jaeger repository. We could have OTEL importer, processor, exporter like API implementation in Jaeger (not direct import of OTEL). Then the actual Jaeger importer, processor, exporter will use this package to implement OTEL components. This way if we break API in Jaeger it will not result in a compilation error like it did now. OpenTelemetry will be able to break API too as the jaeger importers, processors will be implemented directly in the OTEL.

@yurishkuro
Copy link
Member

@pavolloffay maybe it’s worth trying these cross-repo imports on a couple toy projects using go mod.

@pavolloffay
Copy link
Member Author

If we agree that Jaeger can be moved to go mod I can try directly with Jaeger and OTEL. Actually I have started some work already for #2019.

@tigrannajaryan
Copy link
Contributor

One way or another there will be a cyclic dependency if we want to have the jaeger-opentelemetry-collector in this repository.
I don't know how it exactly works, maybe the cycle is not allowed only per packages and can be used per repositories.

If you use go.mod then every go.mod containing directory is considered a separate module (minus subdirectories that contain their own go.mod files). So even though it is a circular dependency between repos, it will no longer be considered a circular dependency between go modules if you structure them appropriately (and I think go tooling should be fine with it, but don't trust my word, I never tried this actual setting).

I think it will be better to host as much as possible Jaeger related code in Jaeger repository. We could have OTEL importer, processor, exporter like API implementation in Jaeger (not direct import of OTEL). Then the actual Jaeger importer, processor, exporter will use this package to implement OTEL components. This way if we break API in Jaeger it will not result in a compilation error like it did now. OpenTelemetry will be able to break API too as the jaeger importers, processors will be implemented directly in the OTEL.

Makes sense.

@pavolloffay
Copy link
Member Author

pavolloffay commented Feb 28, 2020

First we should migrate to go modules #2098.

Based on this PR I have tried importing Jaeger in OTEL via override, the build worked and I was able to build Jaeger with imported OTEL (This is the option 2).

Then there are two approaches we can take:

  1. define a separate module for jaeger-otel-collector. This module will import Jaeger and OTEL. So if there are breaking changes in Jaeger we will be able to coordinate fix in OTEL and subsequently build jaeger-otel collector with bumped versions of OTEL and jaeger.

  2. Do not define go module for jaeger-otelcollector and just simply import OTEL in jaeger. This is more dangerous and we could run into build problems. These problems could be minimized by moving most of the Jaeger code from OTEL to Jaeger. Then the Jaeger and OTEL would import this code and use it to implement importers, processors, exporters.

Option 1. seems like a better option to` me. Although, I found several comments on github discouraging this approach especially when the module should serve as a library or API, but we are just trying to use it for the main package mainly. I didn't find any exact reasons why. I will have to experiment more with this.

@yurishkuro
Copy link
Member

define a separate module for jaeger-otel-collector

what do you mean by that?

@pavolloffay
Copy link
Member Author

Use go submodules. Multiple go modules in a single repository.

@pavolloffay pavolloffay force-pushed the import-opentelemetry branch from 5332679 to a17bab7 Compare March 2, 2020 16:34
@@ -0,0 +1,9 @@
module github.com/jaegertracing/jaeger/cmd/opentelemetry-collector
Copy link
Member Author

Choose a reason for hiding this comment

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

@yurishkuro this is an example fo go submodule.

By default Jaeger version would be resolved from OTEL collector, but with replace we are able to point it to the current master/head. If we do a breaking change we can pin the version to a version prior the change and collaborate with OTEL to update the code there.

@pavolloffay pavolloffay force-pushed the import-opentelemetry branch 3 times, most recently from 9e3ac6a to 02304e7 Compare March 19, 2020 11:00
@pavolloffay pavolloffay changed the title WIP: Intoduce OpenTelemetry collector Intoduce OpenTelemetry collector Mar 19, 2020
@pavolloffay
Copy link
Member Author

@yurishkuro we should make progress on this one. The work in https://github.com/jaegertracing/jaeger-opentelemetry-collector will require changes in the core. For instance changing storage writers to work on the batches rather than on a single spans https://github.com/jaegertracing/jaeger-opentelemetry-collector/issues/15.

@yurishkuro
Copy link
Member

is there an open question?

@pavolloffay
Copy link
Member Author

There aren't any open questions. It just needs to be merged if we agree that this can go in.

A separate go module for the otel collector is the safest path for now. There are still breaking changes happening if there wasn't we could import it in the root package.

There was a discussion regarding the versioning. The jaeger-otel collector will follow the version schema for with jaeger binaries, so with regards to this point it is also fine.

@codecov
Copy link

codecov bot commented Mar 19, 2020

Codecov Report

Merging #2086 into master will not change coverage by %.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2086   +/-   ##
=======================================
  Coverage   96.13%   96.13%           
=======================================
  Files         218      218           
  Lines       10564    10564           
=======================================
  Hits        10156    10156           
  Misses        353      353           
  Partials       55       55           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 83b2679...b36d39c. Read the comment docs.

@@ -0,0 +1,50 @@
// Copyright (c) 2020 The Jaeger Authors.
Copy link
Member

Choose a reason for hiding this comment

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

what is the binary file above? probably don't want it checked in.

.travis.yml Outdated
@@ -36,6 +36,9 @@ matrix:
- go: "1.13.x"
env:
- HOTROD=true
- go: "1.13.x"
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need a separate matrix step for it? I'd rather include it in the main build.

Copy link
Member Author

Choose a reason for hiding this comment

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

+1 this was just to quickly test the build. I will remove it

Signed-off-by: Pavol Loffay <ploffay@redhat.com>
@pavolloffay pavolloffay force-pushed the import-opentelemetry branch from 2a7ed3d to 35974f9 Compare March 23, 2020 09:18
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
@pavolloffay pavolloffay changed the title Intoduce OpenTelemetry collector Introduce OpenTelemetry collector Mar 23, 2020
@pavolloffay pavolloffay merged commit 87c466d into jaegertracing:master Mar 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move to jaegertracing/jaeger repo
4 participants