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

Created telset for remote-storage component #5731

Merged
merged 42 commits into from
Jul 13, 2024
Merged
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
51487a4
Draft Changes to Query using telset
Wise-Wizard Jul 2, 2024
59aa43a
Changed all-in-one code
Wise-Wizard Jul 2, 2024
59111ab
Update pkg/telemetery/settings.go
Wise-Wizard Jul 3, 2024
5ba546b
Made sugessted Changes
Wise-Wizard Jul 3, 2024
1894931
Merge branch 'main' into OTEL/Telemetery
Wise-Wizard Jul 3, 2024
1cfca71
Fix error
Wise-Wizard Jul 3, 2024
5a63b73
Update pkg/telemetery/settings.go
Wise-Wizard Jul 3, 2024
bba59f8
Merge branch 'main' into OTEL/Telemetery
Wise-Wizard Jul 3, 2024
18fdc2d
Refactored telset init in all-in-one
Wise-Wizard Jul 3, 2024
0c933b0
Merge branch 'main' into OTEL/Telemetery
Wise-Wizard Jul 3, 2024
c769b44
Created Healthcheck Adapter
Wise-Wizard Jul 3, 2024
e132adb
Updated ReportStatus to use OTEL's StatusEvent
Wise-Wizard Jul 4, 2024
69876c7
Prototype Impl of Tracer
Wise-Wizard Jul 4, 2024
3ec9594
Added suggested Changes
Wise-Wizard Jul 4, 2024
0002dc6
Changed V2 to accept OTEL's Telset
Wise-Wizard Jul 4, 2024
32d921c
Refactored to accept trace.TracerProvider
Wise-Wizard Jul 5, 2024
57602b5
Merge branch 'main' into OTEL/Telemetery
Wise-Wizard Jul 5, 2024
e5fa271
Temporary fix to failing CI
Wise-Wizard Jul 5, 2024
2396ca5
Made suggested changes
Wise-Wizard Jul 5, 2024
2abe801
Reduced number of ReportStatus calls
Wise-Wizard Jul 5, 2024
ca9950c
Update cmd/query/app/server.go
Wise-Wizard Jul 5, 2024
44638d9
Merge branch 'main' into OTEL/Telemetery
Wise-Wizard Jul 5, 2024
a297feb
Cleaned up COde
Wise-Wizard Jul 5, 2024
6680ea3
Pass telset to struct
Wise-Wizard Jul 5, 2024
bc958c2
Made suggested changes
Wise-Wizard Jul 5, 2024
8654a32
Worked on Test
Wise-Wizard Jul 5, 2024
db18701
Cleaned up Test File
Wise-Wizard Jul 6, 2024
45a1ba3
Fix Linter Errors
Wise-Wizard Jul 6, 2024
65ecbd3
Fix goleak
Wise-Wizard Jul 6, 2024
74403ee
Added Tests
Wise-Wizard Jul 7, 2024
3d9ba04
Ran make lint
Wise-Wizard Jul 7, 2024
160663e
Update cmd/jaeger/internal/extension/jaegerquery/server.go
Wise-Wizard Jul 9, 2024
3de30a1
Merge branch 'main' into OTEL/Telemetery
Wise-Wizard Jul 9, 2024
70d4b10
Fixed Error
Wise-Wizard Jul 9, 2024
25f8d10
Fix nil pointer error
Wise-Wizard Jul 9, 2024
2437f2d
Merge branch 'jaegertracing:main' into OTEL/Telemetery
Wise-Wizard Jul 9, 2024
9b3c4c3
Added remote-storage telset
Wise-Wizard Jul 10, 2024
07a834d
Merge branch 'main' into OTEL/Telemetery
Wise-Wizard Jul 10, 2024
0886afd
Merge branch 'main' into OTEL/Telemetery
Wise-Wizard Jul 12, 2024
7109231
Merge branch 'main' into OTEL/Telemetery
Wise-Wizard Jul 12, 2024
8c9486a
Update cmd/remote-storage/app/server_test.go
Wise-Wizard Jul 13, 2024
20ee219
Made changes
Wise-Wizard Jul 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions cmd/remote-storage/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ import (
"net"
"sync"

"go.opentelemetry.io/collector/component"
"go.uber.org/zap"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/health"
"google.golang.org/grpc/reflection"

"github.com/jaegertracing/jaeger/cmd/query/app/querysvc"
"github.com/jaegertracing/jaeger/pkg/healthcheck"
"github.com/jaegertracing/jaeger/pkg/telemetery"
"github.com/jaegertracing/jaeger/pkg/tenancy"
"github.com/jaegertracing/jaeger/plugin/storage/grpc/shared"
"github.com/jaegertracing/jaeger/storage"
Expand All @@ -36,32 +37,30 @@ import (

// Server runs a gRPC server
type Server struct {
logger *zap.Logger
healthcheck *healthcheck.HealthCheck
opts *Options
opts *Options

grpcConn net.Listener
grpcServer *grpc.Server
wg sync.WaitGroup
telemetery.Setting
}

// NewServer creates and initializes Server.
func NewServer(options *Options, storageFactory storage.Factory, tm *tenancy.Manager, logger *zap.Logger, healthcheck *healthcheck.HealthCheck) (*Server, error) {
handler, err := createGRPCHandler(storageFactory, logger)
func NewServer(options *Options, storageFactory storage.Factory, tm *tenancy.Manager, telset telemetery.Setting) (*Server, error) {
handler, err := createGRPCHandler(storageFactory, telset.Logger)
if err != nil {
return nil, err
}

grpcServer, err := createGRPCServer(options, tm, handler, logger)
grpcServer, err := createGRPCServer(options, tm, handler, telset.Logger)
if err != nil {
return nil, err
}

return &Server{
logger: logger,
healthcheck: healthcheck,
opts: options,
grpcServer: grpcServer,
opts: options,
grpcServer: grpcServer,
Setting: telset,
}, nil
}

Expand Down Expand Up @@ -129,15 +128,15 @@ func (s *Server) Start() error {
if err != nil {
return err
}
s.logger.Info("Starting GRPC server", zap.Stringer("addr", listener.Addr()))
s.Logger.Info("Starting GRPC server", zap.Stringer("addr", listener.Addr()))
s.grpcConn = listener
s.wg.Add(1)
go func() {
defer s.wg.Done()
if err := s.grpcServer.Serve(s.grpcConn); err != nil {
s.logger.Error("GRPC server exited", zap.Error(err))
s.Logger.Error("GRPC server exited", zap.Error(err))
s.ReportStatus(component.NewFatalErrorEvent(err))
}
s.healthcheck.Set(healthcheck.Unavailable)
Wise-Wizard marked this conversation as resolved.
Show resolved Hide resolved
}()

return nil
Expand Down
31 changes: 21 additions & 10 deletions cmd/remote-storage/app/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
"github.com/jaegertracing/jaeger/internal/grpctest"
"github.com/jaegertracing/jaeger/pkg/config/tlscfg"
"github.com/jaegertracing/jaeger/pkg/healthcheck"
"github.com/jaegertracing/jaeger/pkg/telemetery"
"github.com/jaegertracing/jaeger/pkg/tenancy"
"github.com/jaegertracing/jaeger/ports"
"github.com/jaegertracing/jaeger/proto-gen/storage_v1"
Expand All @@ -51,14 +52,16 @@ func TestNewServer_CreateStorageErrors(t *testing.T) {
factory.On("CreateSpanWriter").Return(nil, nil)
factory.On("CreateDependencyReader").Return(nil, errors.New("no deps")).Once()
factory.On("CreateDependencyReader").Return(nil, nil)

telset := telemetery.Setting{
Logger: zap.NewNop(),
ReportStatus: telemetery.HCAdapter(healthcheck.New()),
Wise-Wizard marked this conversation as resolved.
Show resolved Hide resolved
}
f := func() (*Server, error) {
return NewServer(
&Options{GRPCHostPort: ":0"},
factory,
tenancy.NewManager(&tenancy.Options{}),
zap.NewNop(),
healthcheck.New(),
telset,
)
}
_, err := f()
Expand Down Expand Up @@ -123,13 +126,16 @@ func TestNewServer_TLSConfigError(t *testing.T) {
KeyPath: "invalid/path",
ClientCAPath: "invalid/path",
}
telset := telemetery.Setting{
Logger: zap.NewNop(),
ReportStatus: telemetery.HCAdapter(healthcheck.New()),
}
storageMocks := newStorageMocks()
_, err := NewServer(
&Options{GRPCHostPort: ":8081", TLSGRPC: tlsCfg},
storageMocks.factory,
tenancy.NewManager(&tenancy.Options{}),
zap.NewNop(),
healthcheck.New(),
telset,
)
require.Error(t, err)
assert.Contains(t, err.Error(), "invalid TLS config")
Expand Down Expand Up @@ -334,12 +340,15 @@ func TestServerGRPCTLS(t *testing.T) {
storageMocks.reader.On("GetServices", mock.AnythingOfType("*context.valueCtx")).Return(expectedServices, nil)

tm := tenancy.NewManager(&tenancy.Options{Enabled: true})
telset := telemetery.Setting{
Logger: flagsSvc.Logger,
ReportStatus: telemetery.HCAdapter(flagsSvc.HC()),
}
server, err := NewServer(
serverOptions,
storageMocks.factory,
tm,
flagsSvc.Logger,
flagsSvc.HC(),
telset,
)
require.NoError(t, err)
require.NoError(t, server.Start())
Expand Down Expand Up @@ -380,13 +389,15 @@ func TestServerHandlesPortZero(t *testing.T) {
zapCore, logs := observer.New(zap.InfoLevel)
flagsSvc.Logger = zap.New(zapCore)
storageMocks := newStorageMocks()

telset := telemetery.Setting{
Logger: flagsSvc.Logger,
ReportStatus: telemetery.HCAdapter(flagsSvc.HC()),
}
server, err := NewServer(
&Options{GRPCHostPort: ":0"},
storageMocks.factory,
tenancy.NewManager(&tenancy.Options{}),
flagsSvc.Logger,
flagsSvc.HC(),
telset,
)
require.NoError(t, err)

Expand Down
7 changes: 6 additions & 1 deletion cmd/remote-storage/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"github.com/jaegertracing/jaeger/cmd/remote-storage/app"
"github.com/jaegertracing/jaeger/pkg/config"
"github.com/jaegertracing/jaeger/pkg/metrics"
"github.com/jaegertracing/jaeger/pkg/telemetery"
"github.com/jaegertracing/jaeger/pkg/tenancy"
"github.com/jaegertracing/jaeger/pkg/version"
"github.com/jaegertracing/jaeger/plugin/storage"
Expand Down Expand Up @@ -77,7 +78,11 @@ func main() {
}

tm := tenancy.NewManager(&opts.Tenancy)
server, err := app.NewServer(opts, storageFactory, tm, svc.Logger, svc.HC())
telset := telemetery.Setting{
Logger: svc.Logger,
ReportStatus: telemetery.HCAdapter(svc.HC()),
}
server, err := app.NewServer(opts, storageFactory, tm, telset)
if err != nil {
logger.Fatal("Failed to create server", zap.Error(err))
}
Expand Down
7 changes: 6 additions & 1 deletion plugin/storage/integration/remote_memory_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/jaegertracing/jaeger/pkg/config"
"github.com/jaegertracing/jaeger/pkg/healthcheck"
"github.com/jaegertracing/jaeger/pkg/metrics"
"github.com/jaegertracing/jaeger/pkg/telemetery"
"github.com/jaegertracing/jaeger/pkg/tenancy"
"github.com/jaegertracing/jaeger/plugin/storage"
"github.com/jaegertracing/jaeger/ports"
Expand Down Expand Up @@ -47,7 +48,11 @@ func StartNewRemoteMemoryStorage(t *testing.T) *RemoteMemoryStorage {
require.NoError(t, storageFactory.Initialize(metrics.NullFactory, logger))

t.Logf("Starting in-process remote storage server on %s", opts.GRPCHostPort)
server, err := app.NewServer(opts, storageFactory, tm, logger, healthcheck.New())
telset := telemetery.Setting{
Logger: logger,
ReportStatus: telemetery.HCAdapter(healthcheck.New()),
}
server, err := app.NewServer(opts, storageFactory, tm, telset)
require.NoError(t, err)
require.NoError(t, server.Start())

Expand Down
Loading