From ca72ec3589a8e5de5e3add4ffd0088254547f957 Mon Sep 17 00:00:00 2001 From: ko_oler <kooler89@gmail.com> Date: Wed, 21 Feb 2024 16:15:03 +0300 Subject: [PATCH] =?UTF-8?q?=D0=92=D0=BD=D0=B5=D1=81=D0=B5=D0=BD=D1=8B=20?= =?UTF-8?q?=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B2?= =?UTF-8?q?=20Log=20SDK,=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B8=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=D0=B2=D0=B0=D0=BD=20=D0=BF=D0=B0=D0=BA=D0=B5=D1=82?= =?UTF-8?q?=20=D0=BD=D0=B0=20logs,=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B3=D0=B5?= =?UTF-8?q?=D0=BD=D0=B5=D1=80=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=BD?= =?UTF-8?q?=D1=8B=20grpc-=D0=BA=D0=BB=D0=B8=D0=B5=D0=BD=D1=82=D1=8B=20?= =?UTF-8?q?=D0=BF=D0=BE=D1=81=D0=BB=D0=B5=20=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20proto?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- log/middleware/telemetry_middleware.go | 221 ------------- {log => logs}/client.go | 4 +- {log => logs}/log.go | 4 +- {log => logs}/log_test.go | 2 +- .../middleware/error_logging_middleware.go | 18 +- .../middleware/logging_middleware.go | 18 +- {log => logs}/middleware/middleware.go | 8 +- .../middleware/recovering_middleware.go | 18 +- logs/middleware/telemetry_middleware.go | 151 +++++++++ {log => logs}/mocks/Service.go | 2 +- {log => logs}/mocks/Storage.go | 2 +- {log => logs}/service.go | 4 +- {log => logs}/storage.go | 2 +- {log => logs}/zap/buffered_write_syncer.go | 26 +- .../zap/buffered_write_syncer_test.go | 26 +- {log => logs}/zap/core.go | 14 +- {log => logs}/zap/core_test.go | 8 +- {log => logs}/zap/example_test.go | 14 +- perxis-proto | 2 +- .../middleware/logging_middleware.go | 2 +- proto/{log => logs}/log.pb.go | 153 ++++----- proto/{log => logs}/log_service.pb.go | 293 +++++++++--------- proto/{log => logs}/log_service_grpc.pb.go | 14 +- zap/filter_core.go | 4 +- 24 files changed, 471 insertions(+), 539 deletions(-) delete mode 100644 log/middleware/telemetry_middleware.go rename {log => logs}/client.go (96%) rename {log => logs}/log.go (98%) rename {log => logs}/log_test.go (99%) rename {log => logs}/middleware/error_logging_middleware.go (69%) rename {log => logs}/middleware/logging_middleware.go (84%) rename {log => logs}/middleware/middleware.go (57%) rename {log => logs}/middleware/recovering_middleware.go (72%) create mode 100644 logs/middleware/telemetry_middleware.go rename {log => logs}/mocks/Service.go (98%) rename {log => logs}/mocks/Storage.go (98%) rename {log => logs}/service.go (96%) rename {log => logs}/storage.go (96%) rename {log => logs}/zap/buffered_write_syncer.go (90%) rename {log => logs}/zap/buffered_write_syncer_test.go (77%) rename {log => logs}/zap/core.go (87%) rename {log => logs}/zap/core_test.go (92%) rename {log => logs}/zap/example_test.go (90%) rename proto/{log => logs}/log.pb.go (63%) rename proto/{log => logs}/log_service.pb.go (56%) rename proto/{log => logs}/log_service_grpc.pb.go (95%) diff --git a/log/middleware/telemetry_middleware.go b/log/middleware/telemetry_middleware.go deleted file mode 100644 index f5ba0676..00000000 --- a/log/middleware/telemetry_middleware.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by gowrap. DO NOT EDIT. -// template: ..\..\..\assets\templates\middleware\telemetry -// gowrap: http://github.com/hexdigest/gowrap - -package middleware - -//go:generate gowrap gen -p git.perx.ru/perxis/perxis-go/pkg/collaborators -i log -i Service -t ../../assets/templates/middleware/telemetry -o telemetry_middleware.go -l "" - -// source template: https://github.com/hexdigest/gowrap/blob/master/templates/opentelemetry - -import ( - "context" - "time" - - "git.perx.ru/perxis/perxis-go/pkg/collaborators" - "git.perx.ru/perxis/perxis-go/pkg/telemetry/metrics" - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/attribute" - otelmetric "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/trace" -) - -// telemetryMiddleware implements collaborators.Collaborators interface instrumented with opentracing spans -type telemetryMiddleware struct { - collaborators.Collaborators - _instance string - requestMetrics *metrics.RequestMetrics - _spanDecorator func(span trace.Span, params, results map[string]interface{}) -} - -// TelemetryMiddleware returns telemetryMiddleware -func TelemetryMiddleware(base collaborators.Collaborators, instance string, spanDecorator ...func(span trace.Span, params, results map[string]interface{})) telemetryMiddleware { - requestMetrics, err := metrics.GetRequestMetrics() - if err != nil { - panic(err) - } - - d := telemetryMiddleware{ - Collaborators: base, - _instance: instance, - requestMetrics: requestMetrics, - } - - if len(spanDecorator) > 0 && spanDecorator[0] != nil { - d._spanDecorator = spanDecorator[0] - } - - return d -} - -// Get implements collaborators.Collaborators -func (_d telemetryMiddleware) Get(ctx context.Context, spaceId string, subject string) (role string, err error) { - attributes := otelmetric.WithAttributeSet(attribute.NewSet( - attribute.String("service", "Collaborators"), - attribute.String("method", "Get"), - )) - - _d.requestMetrics.Total.Add(ctx, 1, attributes) - - start := time.Now() - ctx, _span := otel.Tracer(_d._instance).Start(ctx, "Collaborators.Get") - - defer func() { - _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - - if _d._spanDecorator != nil { - _d._spanDecorator(_span, map[string]interface{}{ - "ctx": ctx, - "spaceId": spaceId, - "subject": subject}, map[string]interface{}{ - "role": role, - "err": err}) - } else if err != nil { - _d.requestMetrics.FailedTotal.Add(ctx, 1, attributes) - - _span.RecordError(err) - _span.SetAttributes(attribute.String("event", "error")) - _span.SetAttributes(attribute.String("message", err.Error())) - } - - _span.End() - }() - return _d.Collaborators.Get(ctx, spaceId, subject) -} - -// ListCollaborators implements collaborators.Collaborators -func (_d telemetryMiddleware) ListCollaborators(ctx context.Context, spaceId string) (collaborators []*collaborators.Collaborator, err error) { - attributes := otelmetric.WithAttributeSet(attribute.NewSet( - attribute.String("service", "Collaborators"), - attribute.String("method", "ListCollaborators"), - )) - - _d.requestMetrics.Total.Add(ctx, 1, attributes) - - start := time.Now() - ctx, _span := otel.Tracer(_d._instance).Start(ctx, "Collaborators.ListCollaborators") - - defer func() { - _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - - if _d._spanDecorator != nil { - _d._spanDecorator(_span, map[string]interface{}{ - "ctx": ctx, - "spaceId": spaceId}, map[string]interface{}{ - "collaborators": collaborators, - "err": err}) - } else if err != nil { - _d.requestMetrics.FailedTotal.Add(ctx, 1, attributes) - - _span.RecordError(err) - _span.SetAttributes(attribute.String("event", "error")) - _span.SetAttributes(attribute.String("message", err.Error())) - } - - _span.End() - }() - return _d.Collaborators.ListCollaborators(ctx, spaceId) -} - -// ListSpaces implements collaborators.Collaborators -func (_d telemetryMiddleware) ListSpaces(ctx context.Context, subject string) (spaces []*collaborators.Collaborator, err error) { - attributes := otelmetric.WithAttributeSet(attribute.NewSet( - attribute.String("service", "Collaborators"), - attribute.String("method", "ListSpaces"), - )) - - _d.requestMetrics.Total.Add(ctx, 1, attributes) - - start := time.Now() - ctx, _span := otel.Tracer(_d._instance).Start(ctx, "Collaborators.ListSpaces") - - defer func() { - _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - - if _d._spanDecorator != nil { - _d._spanDecorator(_span, map[string]interface{}{ - "ctx": ctx, - "subject": subject}, map[string]interface{}{ - "spaces": spaces, - "err": err}) - } else if err != nil { - _d.requestMetrics.FailedTotal.Add(ctx, 1, attributes) - - _span.RecordError(err) - _span.SetAttributes(attribute.String("event", "error")) - _span.SetAttributes(attribute.String("message", err.Error())) - } - - _span.End() - }() - return _d.Collaborators.ListSpaces(ctx, subject) -} - -// Remove implements collaborators.Collaborators -func (_d telemetryMiddleware) Remove(ctx context.Context, spaceId string, subject string) (err error) { - attributes := otelmetric.WithAttributeSet(attribute.NewSet( - attribute.String("service", "Collaborators"), - attribute.String("method", "Remove"), - )) - - _d.requestMetrics.Total.Add(ctx, 1, attributes) - - start := time.Now() - ctx, _span := otel.Tracer(_d._instance).Start(ctx, "Collaborators.Remove") - - defer func() { - _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - - if _d._spanDecorator != nil { - _d._spanDecorator(_span, map[string]interface{}{ - "ctx": ctx, - "spaceId": spaceId, - "subject": subject}, map[string]interface{}{ - "err": err}) - } else if err != nil { - _d.requestMetrics.FailedTotal.Add(ctx, 1, attributes) - - _span.RecordError(err) - _span.SetAttributes(attribute.String("event", "error")) - _span.SetAttributes(attribute.String("message", err.Error())) - } - - _span.End() - }() - return _d.Collaborators.Remove(ctx, spaceId, subject) -} - -// Set implements collaborators.Collaborators -func (_d telemetryMiddleware) Set(ctx context.Context, spaceId string, subject string, role string) (err error) { - attributes := otelmetric.WithAttributeSet(attribute.NewSet( - attribute.String("service", "Collaborators"), - attribute.String("method", "Set"), - )) - - _d.requestMetrics.Total.Add(ctx, 1, attributes) - - start := time.Now() - ctx, _span := otel.Tracer(_d._instance).Start(ctx, "Collaborators.Set") - - defer func() { - _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) - - if _d._spanDecorator != nil { - _d._spanDecorator(_span, map[string]interface{}{ - "ctx": ctx, - "spaceId": spaceId, - "subject": subject, - "role": role}, map[string]interface{}{ - "err": err}) - } else if err != nil { - _d.requestMetrics.FailedTotal.Add(ctx, 1, attributes) - - _span.RecordError(err) - _span.SetAttributes(attribute.String("event", "error")) - _span.SetAttributes(attribute.String("message", err.Error())) - } - - _span.End() - }() - return _d.Collaborators.Set(ctx, spaceId, subject, role) -} diff --git a/log/client.go b/logs/client.go similarity index 96% rename from log/client.go rename to logs/client.go index 65413f4f..b4d384b7 100644 --- a/log/client.go +++ b/logs/client.go @@ -1,11 +1,11 @@ -package log +package logs import ( "context" errorsgrpc "git.perx.ru/perxis/perxis-go/pkg/errors/grpc" "git.perx.ru/perxis/perxis-go/pkg/options" - pb "git.perx.ru/perxis/perxis-go/proto/log" + pb "git.perx.ru/perxis/perxis-go/proto/logs" "google.golang.org/grpc" ) diff --git a/log/log.go b/logs/log.go similarity index 98% rename from log/log.go rename to logs/log.go index 05aff704..2bc9dedf 100644 --- a/log/log.go +++ b/logs/log.go @@ -1,10 +1,10 @@ -package log +package logs import ( "time" "git.perx.ru/perxis/perxis-go/id" - pb "git.perx.ru/perxis/perxis-go/proto/log" + pb "git.perx.ru/perxis/perxis-go/proto/logs" "google.golang.org/protobuf/types/known/timestamppb" ) diff --git a/log/log_test.go b/logs/log_test.go similarity index 99% rename from log/log_test.go rename to logs/log_test.go index 72ab7d3c..9ccb7e70 100644 --- a/log/log_test.go +++ b/logs/log_test.go @@ -1,4 +1,4 @@ -package log +package logs import ( "testing" diff --git a/log/middleware/error_logging_middleware.go b/logs/middleware/error_logging_middleware.go similarity index 69% rename from log/middleware/error_logging_middleware.go rename to logs/middleware/error_logging_middleware.go index de13dcc4..5d6ab710 100644 --- a/log/middleware/error_logging_middleware.go +++ b/logs/middleware/error_logging_middleware.go @@ -4,25 +4,25 @@ package middleware -//go:generate gowrap gen -p git.perx.ru/perxis/perxis-go/log -i Service -t ../../assets/templates/middleware/error_log -o error_logging_middleware.go -l "" +//go:generate gowrap gen -p git.perx.ru/perxis/perxis-go/logs -i Service -t ../../assets/templates/middleware/error_log -o error_logging_middleware.go -l "" import ( "context" - "git.perx.ru/perxis/perxis-go/log" + "git.perx.ru/perxis/perxis-go/logs" "git.perx.ru/perxis/perxis-go/pkg/options" "go.uber.org/zap" ) -// errorLoggingMiddleware implements log.Service that is instrumented with logging +// errorLoggingMiddleware implements logs.Service that is instrumented with logging type errorLoggingMiddleware struct { logger *zap.Logger - next log.Service + next logs.Service } -// ErrorLoggingMiddleware instruments an implementation of the log.Service with simple logging +// ErrorLoggingMiddleware instruments an implementation of the logs.Service with simple logging func ErrorLoggingMiddleware(logger *zap.Logger) Middleware { - return func(next log.Service) log.Service { + return func(next logs.Service) logs.Service { return &errorLoggingMiddleware{ next: next, logger: logger, @@ -30,7 +30,7 @@ func ErrorLoggingMiddleware(logger *zap.Logger) Middleware { } } -func (m *errorLoggingMiddleware) Delete(ctx context.Context, filter *log.Filter) (err error) { +func (m *errorLoggingMiddleware) Delete(ctx context.Context, filter *logs.Filter) (err error) { logger := m.logger defer func() { if err != nil { @@ -40,7 +40,7 @@ func (m *errorLoggingMiddleware) Delete(ctx context.Context, filter *log.Filter) return m.next.Delete(ctx, filter) } -func (m *errorLoggingMiddleware) Find(ctx context.Context, filter *log.Filter, options *options.FindOptions) (fp1 *log.FindResult, err error) { +func (m *errorLoggingMiddleware) Find(ctx context.Context, filter *logs.Filter, options *options.FindOptions) (fp1 *logs.FindResult, err error) { logger := m.logger defer func() { if err != nil { @@ -50,7 +50,7 @@ func (m *errorLoggingMiddleware) Find(ctx context.Context, filter *log.Filter, o return m.next.Find(ctx, filter, options) } -func (m *errorLoggingMiddleware) Log(ctx context.Context, entries []*log.Entry) (err error) { +func (m *errorLoggingMiddleware) Log(ctx context.Context, entries []*logs.Entry) (err error) { logger := m.logger defer func() { if err != nil { diff --git a/log/middleware/logging_middleware.go b/logs/middleware/logging_middleware.go similarity index 84% rename from log/middleware/logging_middleware.go rename to logs/middleware/logging_middleware.go index f693795b..008f1251 100644 --- a/log/middleware/logging_middleware.go +++ b/logs/middleware/logging_middleware.go @@ -4,29 +4,29 @@ package middleware -//go:generate gowrap gen -p git.perx.ru/perxis/perxis-go/log -i Service -t ../../assets/templates/middleware/access_log -o logging_middleware.go -l "" +//go:generate gowrap gen -p git.perx.ru/perxis/perxis-go/logs -i Service -t ../../assets/templates/middleware/access_log -o logging_middleware.go -l "" import ( "context" "fmt" "time" - "git.perx.ru/perxis/perxis-go/log" + "git.perx.ru/perxis/perxis-go/logs" "git.perx.ru/perxis/perxis-go/pkg/auth" "git.perx.ru/perxis/perxis-go/pkg/options" "go.uber.org/zap" "go.uber.org/zap/zapcore" ) -// loggingMiddleware implements log.Service that is instrumented with logging +// loggingMiddleware implements logs.Service that is instrumented with logging type loggingMiddleware struct { logger *zap.Logger - next log.Service + next logs.Service } -// LoggingMiddleware instruments an implementation of the log.Service with simple logging +// LoggingMiddleware instruments an implementation of the logs.Service with simple logging func LoggingMiddleware(logger *zap.Logger) Middleware { - return func(next log.Service) log.Service { + return func(next logs.Service) logs.Service { return &loggingMiddleware{ next: next, logger: logger, @@ -34,7 +34,7 @@ func LoggingMiddleware(logger *zap.Logger) Middleware { } } -func (m *loggingMiddleware) Delete(ctx context.Context, filter *log.Filter) (err error) { +func (m *loggingMiddleware) Delete(ctx context.Context, filter *logs.Filter) (err error) { begin := time.Now() var fields []zapcore.Field for k, v := range map[string]interface{}{ @@ -70,7 +70,7 @@ func (m *loggingMiddleware) Delete(ctx context.Context, filter *log.Filter) (err return err } -func (m *loggingMiddleware) Find(ctx context.Context, filter *log.Filter, options *options.FindOptions) (fp1 *log.FindResult, err error) { +func (m *loggingMiddleware) Find(ctx context.Context, filter *logs.Filter, options *options.FindOptions) (fp1 *logs.FindResult, err error) { begin := time.Now() var fields []zapcore.Field for k, v := range map[string]interface{}{ @@ -108,7 +108,7 @@ func (m *loggingMiddleware) Find(ctx context.Context, filter *log.Filter, option return fp1, err } -func (m *loggingMiddleware) Log(ctx context.Context, entries []*log.Entry) (err error) { +func (m *loggingMiddleware) Log(ctx context.Context, entries []*logs.Entry) (err error) { begin := time.Now() var fields []zapcore.Field for k, v := range map[string]interface{}{ diff --git a/log/middleware/middleware.go b/logs/middleware/middleware.go similarity index 57% rename from log/middleware/middleware.go rename to logs/middleware/middleware.go index 2fa83f77..bb9dfaf9 100644 --- a/log/middleware/middleware.go +++ b/logs/middleware/middleware.go @@ -4,16 +4,16 @@ package middleware -//go:generate gowrap gen -p git.perx.ru/perxis/perxis-go/log -i Service -t ../../assets/templates/middleware/middleware -o middleware.go -l "" +//go:generate gowrap gen -p git.perx.ru/perxis/perxis-go/logs -i Service -t ../../assets/templates/middleware/middleware -o middleware.go -l "" import ( - "git.perx.ru/perxis/perxis-go/log" + "git.perx.ru/perxis/perxis-go/logs" "go.uber.org/zap" ) -type Middleware func(log.Service) log.Service +type Middleware func(logs.Service) logs.Service -func WithLog(s log.Service, logger *zap.Logger, log_access bool) log.Service { +func WithLog(s logs.Service, logger *zap.Logger, log_access bool) logs.Service { if logger == nil { logger = zap.NewNop() } diff --git a/log/middleware/recovering_middleware.go b/logs/middleware/recovering_middleware.go similarity index 72% rename from log/middleware/recovering_middleware.go rename to logs/middleware/recovering_middleware.go index b8b3de39..950963db 100644 --- a/log/middleware/recovering_middleware.go +++ b/logs/middleware/recovering_middleware.go @@ -4,26 +4,26 @@ package middleware -//go:generate gowrap gen -p git.perx.ru/perxis/perxis-go/log -i Service -t ../../assets/templates/middleware/recovery -o recovering_middleware.go -l "" +//go:generate gowrap gen -p git.perx.ru/perxis/perxis-go/logs -i Service -t ../../assets/templates/middleware/recovery -o recovering_middleware.go -l "" import ( "context" "fmt" - "git.perx.ru/perxis/perxis-go/log" + "git.perx.ru/perxis/perxis-go/logs" "git.perx.ru/perxis/perxis-go/pkg/options" "go.uber.org/zap" ) -// recoveringMiddleware implements log.Service that is instrumented with logging +// recoveringMiddleware implements logs.Service that is instrumented with logging type recoveringMiddleware struct { logger *zap.Logger - next log.Service + next logs.Service } -// RecoveringMiddleware instruments an implementation of the log.Service with simple logging +// RecoveringMiddleware instruments an implementation of the logs.Service with simple logging func RecoveringMiddleware(logger *zap.Logger) Middleware { - return func(next log.Service) log.Service { + return func(next logs.Service) logs.Service { return &recoveringMiddleware{ next: next, logger: logger, @@ -31,7 +31,7 @@ func RecoveringMiddleware(logger *zap.Logger) Middleware { } } -func (m *recoveringMiddleware) Delete(ctx context.Context, filter *log.Filter) (err error) { +func (m *recoveringMiddleware) Delete(ctx context.Context, filter *logs.Filter) (err error) { logger := m.logger defer func() { if r := recover(); r != nil { @@ -43,7 +43,7 @@ func (m *recoveringMiddleware) Delete(ctx context.Context, filter *log.Filter) ( return m.next.Delete(ctx, filter) } -func (m *recoveringMiddleware) Find(ctx context.Context, filter *log.Filter, options *options.FindOptions) (fp1 *log.FindResult, err error) { +func (m *recoveringMiddleware) Find(ctx context.Context, filter *logs.Filter, options *options.FindOptions) (fp1 *logs.FindResult, err error) { logger := m.logger defer func() { if r := recover(); r != nil { @@ -55,7 +55,7 @@ func (m *recoveringMiddleware) Find(ctx context.Context, filter *log.Filter, opt return m.next.Find(ctx, filter, options) } -func (m *recoveringMiddleware) Log(ctx context.Context, entries []*log.Entry) (err error) { +func (m *recoveringMiddleware) Log(ctx context.Context, entries []*logs.Entry) (err error) { logger := m.logger defer func() { if r := recover(); r != nil { diff --git a/logs/middleware/telemetry_middleware.go b/logs/middleware/telemetry_middleware.go new file mode 100644 index 00000000..2aebc795 --- /dev/null +++ b/logs/middleware/telemetry_middleware.go @@ -0,0 +1,151 @@ +// Code generated by gowrap. DO NOT EDIT. +// template: ../../assets/templates/middleware/telemetry +// gowrap: http://github.com/hexdigest/gowrap + +package middleware + +//go:generate gowrap gen -p git.perx.ru/perxis/perxis-go/logs -i Service -t ../../assets/templates/middleware/telemetry -o telemetry_middleware.go -l "" + +// source template: https://github.com/hexdigest/gowrap/blob/master/templates/opentelemetry + +import ( + "context" + "time" + + "git.perx.ru/perxis/perxis-go/logs" + "git.perx.ru/perxis/perxis-go/pkg/options" + "git.perx.ru/perxis/perxis-go/pkg/telemetry/metrics" + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" + otelmetric "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/trace" +) + +// telemetryMiddleware implements logs.Service interface instrumented with opentracing spans +type telemetryMiddleware struct { + logs.Service + _instance string + requestMetrics *metrics.RequestMetrics + _spanDecorator func(span trace.Span, params, results map[string]interface{}) +} + +// TelemetryMiddleware returns telemetryMiddleware +func TelemetryMiddleware(base logs.Service, instance string, spanDecorator ...func(span trace.Span, params, results map[string]interface{})) telemetryMiddleware { + requestMetrics, err := metrics.GetRequestMetrics() + if err != nil { + panic(err) + } + + d := telemetryMiddleware{ + Service: base, + _instance: instance, + requestMetrics: requestMetrics, + } + + if len(spanDecorator) > 0 && spanDecorator[0] != nil { + d._spanDecorator = spanDecorator[0] + } + + return d +} + +// Delete implements logs.Service +func (_d telemetryMiddleware) Delete(ctx context.Context, filter *logs.Filter) (err error) { + attributes := otelmetric.WithAttributeSet(attribute.NewSet( + attribute.String("service", "Service"), + attribute.String("method", "Delete"), + )) + + _d.requestMetrics.Total.Add(ctx, 1, attributes) + + start := time.Now() + ctx, _span := otel.Tracer(_d._instance).Start(ctx, "Service.Delete") + + defer func() { + _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) + + if _d._spanDecorator != nil { + _d._spanDecorator(_span, map[string]interface{}{ + "ctx": ctx, + "filter": filter}, map[string]interface{}{ + "err": err}) + } else if err != nil { + _d.requestMetrics.FailedTotal.Add(ctx, 1, attributes) + + _span.RecordError(err) + _span.SetAttributes(attribute.String("event", "error")) + _span.SetAttributes(attribute.String("message", err.Error())) + } + + _span.End() + }() + return _d.Service.Delete(ctx, filter) +} + +// Find implements logs.Service +func (_d telemetryMiddleware) Find(ctx context.Context, filter *logs.Filter, options *options.FindOptions) (fp1 *logs.FindResult, err error) { + attributes := otelmetric.WithAttributeSet(attribute.NewSet( + attribute.String("service", "Service"), + attribute.String("method", "Find"), + )) + + _d.requestMetrics.Total.Add(ctx, 1, attributes) + + start := time.Now() + ctx, _span := otel.Tracer(_d._instance).Start(ctx, "Service.Find") + + defer func() { + _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) + + if _d._spanDecorator != nil { + _d._spanDecorator(_span, map[string]interface{}{ + "ctx": ctx, + "filter": filter, + "options": options}, map[string]interface{}{ + "fp1": fp1, + "err": err}) + } else if err != nil { + _d.requestMetrics.FailedTotal.Add(ctx, 1, attributes) + + _span.RecordError(err) + _span.SetAttributes(attribute.String("event", "error")) + _span.SetAttributes(attribute.String("message", err.Error())) + } + + _span.End() + }() + return _d.Service.Find(ctx, filter, options) +} + +// Log implements logs.Service +func (_d telemetryMiddleware) Log(ctx context.Context, entries []*logs.Entry) (err error) { + attributes := otelmetric.WithAttributeSet(attribute.NewSet( + attribute.String("service", "Service"), + attribute.String("method", "Log"), + )) + + _d.requestMetrics.Total.Add(ctx, 1, attributes) + + start := time.Now() + ctx, _span := otel.Tracer(_d._instance).Start(ctx, "Service.Log") + + defer func() { + _d.requestMetrics.DurationMilliseconds.Record(ctx, time.Since(start).Milliseconds(), attributes) + + if _d._spanDecorator != nil { + _d._spanDecorator(_span, map[string]interface{}{ + "ctx": ctx, + "entries": entries}, map[string]interface{}{ + "err": err}) + } else if err != nil { + _d.requestMetrics.FailedTotal.Add(ctx, 1, attributes) + + _span.RecordError(err) + _span.SetAttributes(attribute.String("event", "error")) + _span.SetAttributes(attribute.String("message", err.Error())) + } + + _span.End() + }() + return _d.Service.Log(ctx, entries) +} diff --git a/log/mocks/Service.go b/logs/mocks/Service.go similarity index 98% rename from log/mocks/Service.go rename to logs/mocks/Service.go index 2957bf02..af4da73b 100644 --- a/log/mocks/Service.go +++ b/logs/mocks/Service.go @@ -5,7 +5,7 @@ package mocks import ( context "context" - log2 "git.perx.ru/perxis/perxis-go/log" + log2 "git.perx.ru/perxis/perxis-go/logs" mock "github.com/stretchr/testify/mock" options "git.perx.ru/perxis/perxis-go/pkg/options" diff --git a/log/mocks/Storage.go b/logs/mocks/Storage.go similarity index 98% rename from log/mocks/Storage.go rename to logs/mocks/Storage.go index 33b9b97a..87a6376d 100644 --- a/log/mocks/Storage.go +++ b/logs/mocks/Storage.go @@ -5,7 +5,7 @@ package mocks import ( context "context" - log2 "git.perx.ru/perxis/perxis-go/log" + log2 "git.perx.ru/perxis/perxis-go/logs" mock "github.com/stretchr/testify/mock" options "git.perx.ru/perxis/perxis-go/pkg/options" diff --git a/log/service.go b/logs/service.go similarity index 96% rename from log/service.go rename to logs/service.go index 46e30607..34b3b4e6 100644 --- a/log/service.go +++ b/logs/service.go @@ -1,11 +1,11 @@ -package log +package logs import ( "context" itemstransportgrpc "git.perx.ru/perxis/perxis-go/pkg/items/transport/grpc" "git.perx.ru/perxis/perxis-go/pkg/options" - pb "git.perx.ru/perxis/perxis-go/proto/log" + pb "git.perx.ru/perxis/perxis-go/proto/logs" ) const ServiceName = "logs" diff --git a/log/storage.go b/logs/storage.go similarity index 96% rename from log/storage.go rename to logs/storage.go index fd672e53..e6271dac 100644 --- a/log/storage.go +++ b/logs/storage.go @@ -1,4 +1,4 @@ -package log +package logs import ( "context" diff --git a/log/zap/buffered_write_syncer.go b/logs/zap/buffered_write_syncer.go similarity index 90% rename from log/zap/buffered_write_syncer.go rename to logs/zap/buffered_write_syncer.go index b6149240..e862a79d 100644 --- a/log/zap/buffered_write_syncer.go +++ b/logs/zap/buffered_write_syncer.go @@ -5,7 +5,7 @@ import ( "sync" "time" - "git.perx.ru/perxis/perxis-go/log" + "git.perx.ru/perxis/perxis-go/logs" "git.perx.ru/perxis/perxis-go/pkg/auth" "git.perx.ru/perxis/perxis-go/pkg/errors" ) @@ -18,9 +18,9 @@ const ( var SyncQueueOverflow = errors.New("sync queue overflow") -// BufferedWriteSyncer это WriteSyncer, который отправляет записи в log.Service. +// BufferedWriteSyncer это WriteSyncer, который отправляет записи в logs.Service. // Когда количество буферизированных записей достигает некоторого предела или проходит определенный фиксированный интервал, -// записи отправляются в очередь для синхронизации с log.Service. +// записи отправляются в очередь для синхронизации с logs.Service. type BufferedWriteSyncer struct { // FlushInterval устанавливает интервал, через который буферизированные записи будут отправлены на синхронизацию. // @@ -28,23 +28,23 @@ type BufferedWriteSyncer struct { FlushInterval time.Duration // MaxBufferSize устанавливает максимальное количество записей, которые могут быть буферизованы. - // Когда количество буферизованных записей превысит этот порог, они будут отправлены на синхронизацию в log.Service. + // Когда количество буферизованных записей превысит этот порог, они будут отправлены на синхронизацию в logs.Service. // // Значение по умолчанию для этого параметра равно 1000. MaxBufferSize int - // MaxSyncQueueSize устанавливает максимальный размер очереди записей на синхронизацию с log.Service. + // MaxSyncQueueSize устанавливает максимальный размер очереди записей на синхронизацию с logs.Service. // // Значение по умолчанию для этого параметра равно 16. MaxSyncQueueSize int // Service сервис для хранения записей - Service log.Service + Service logs.Service wg sync.WaitGroup mu sync.RWMutex - buffer []*log.Entry - syncQueue chan []*log.Entry + buffer []*logs.Entry + syncQueue chan []*logs.Entry flushStop chan struct{} // flushStop закрывается, когда flushLoop должен быть остановлен started bool // started указывает, был ли выполнен Start @@ -68,8 +68,8 @@ func (ws *BufferedWriteSyncer) start() { ws.MaxSyncQueueSize = defaultMaxSyncQueueSize } - ws.buffer = make([]*log.Entry, 0, ws.MaxBufferSize) - ws.syncQueue = make(chan []*log.Entry, ws.MaxSyncQueueSize) + ws.buffer = make([]*logs.Entry, 0, ws.MaxBufferSize) + ws.syncQueue = make(chan []*logs.Entry, ws.MaxSyncQueueSize) ws.flushStop = make(chan struct{}) ws.wg.Add(2) @@ -101,7 +101,7 @@ func (ws *BufferedWriteSyncer) Stop() error { // Write отправляет запись в буфер. // Когда количество буферизованных записей превышает максимальный размер буфера, буферизированные записи будут отправлены на синхронизацию. -func (ws *BufferedWriteSyncer) Write(entry *log.Entry) error { +func (ws *BufferedWriteSyncer) Write(entry *logs.Entry) error { ws.mu.Lock() defer ws.mu.Unlock() @@ -149,7 +149,7 @@ func (ws *BufferedWriteSyncer) flush() error { } ws.syncQueue <- ws.buffer - ws.buffer = make([]*log.Entry, 0, ws.MaxBufferSize) + ws.buffer = make([]*logs.Entry, 0, ws.MaxBufferSize) return nil } @@ -172,7 +172,7 @@ func (ws *BufferedWriteSyncer) flushLoop() { } } -// syncLoop синхронизирует записи с log.Service. +// syncLoop синхронизирует записи с logs.Service. func (ws *BufferedWriteSyncer) syncLoop() { defer ws.wg.Done() diff --git a/log/zap/buffered_write_syncer_test.go b/logs/zap/buffered_write_syncer_test.go similarity index 77% rename from log/zap/buffered_write_syncer_test.go rename to logs/zap/buffered_write_syncer_test.go index 58d64fa9..77b6ca24 100644 --- a/log/zap/buffered_write_syncer_test.go +++ b/logs/zap/buffered_write_syncer_test.go @@ -5,8 +5,8 @@ import ( "testing" "time" - "git.perx.ru/perxis/perxis-go/log" - logmocks "git.perx.ru/perxis/perxis-go/log/mocks" + "git.perx.ru/perxis/perxis-go/logs" + logmocks "git.perx.ru/perxis/perxis-go/logs/mocks" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" @@ -17,17 +17,17 @@ func TestBufferedWriteSyncer_Write(t *testing.T) { service.On("Log", mock.Anything, mock.Anything). Return(nil). Run(func(args mock.Arguments) { - entries := args.Get(1).([]*log.Entry) + entries := args.Get(1).([]*logs.Entry) require.Equal(t, 2, len(entries)) }). Once() ws := &BufferedWriteSyncer{Service: service} - err := ws.Write(&log.Entry{Message: "first log message"}) + err := ws.Write(&logs.Entry{Message: "first logs message"}) require.NoError(t, err) - err = ws.Write(&log.Entry{Message: "second log message"}) + err = ws.Write(&logs.Entry{Message: "second logs message"}) require.NoError(t, err) err = ws.Stop() @@ -41,7 +41,7 @@ func TestBufferedWriteSyncer_Write_Concurrent(t *testing.T) { service.On("Log", mock.Anything, mock.Anything). Return(nil). Run(func(args mock.Arguments) { - entries := args.Get(1).([]*log.Entry) + entries := args.Get(1).([]*logs.Entry) require.Equal(t, 100, len(entries)) }). Once() @@ -53,7 +53,7 @@ func TestBufferedWriteSyncer_Write_Concurrent(t *testing.T) { wg.Add(1) go func(wg *sync.WaitGroup) { defer wg.Done() - require.NoError(t, ws.Write(&log.Entry{Message: "log message"})) + require.NoError(t, ws.Write(&logs.Entry{Message: "logs message"})) }(&wg) } @@ -68,7 +68,7 @@ func TestBufferedWriteSyncer_Flush(t *testing.T) { service.On("Log", mock.Anything, mock.Anything). Return(nil). Run(func(args mock.Arguments) { - entries := args.Get(1).([]*log.Entry) + entries := args.Get(1).([]*logs.Entry) require.Equal(t, 10, len(entries)) }). Times(10) @@ -77,7 +77,7 @@ func TestBufferedWriteSyncer_Flush(t *testing.T) { for i := 0; i < 10; i++ { for j := 0; j < 10; j++ { - require.NoError(t, ws.Write(&log.Entry{Message: "log message"})) + require.NoError(t, ws.Write(&logs.Entry{Message: "logs message"})) } require.NoError(t, ws.Sync()) } @@ -92,7 +92,7 @@ func TestBufferedWriteSyncer_MaxBufferSize(t *testing.T) { service.On("Log", mock.Anything, mock.Anything). Return(nil). Run(func(args mock.Arguments) { - entries := args.Get(1).([]*log.Entry) + entries := args.Get(1).([]*logs.Entry) assert.Equal(t, 10, len(entries)) }). Times(10) @@ -100,7 +100,7 @@ func TestBufferedWriteSyncer_MaxBufferSize(t *testing.T) { ws := &BufferedWriteSyncer{Service: service, MaxBufferSize: 10} for i := 0; i < 100; i++ { - require.NoError(t, ws.Write(&log.Entry{Message: "log message"})) + require.NoError(t, ws.Write(&logs.Entry{Message: "logs message"})) } require.NoError(t, ws.Stop()) @@ -113,7 +113,7 @@ func TestBufferedWriteSyncer_FlushInterval(t *testing.T) { service.On("Log", mock.Anything, mock.Anything). Return(nil). Run(func(args mock.Arguments) { - entries := args.Get(1).([]*log.Entry) + entries := args.Get(1).([]*logs.Entry) assert.Equal(t, 10, len(entries)) }). Once() @@ -121,7 +121,7 @@ func TestBufferedWriteSyncer_FlushInterval(t *testing.T) { ws := &BufferedWriteSyncer{Service: service, FlushInterval: time.Second} for j := 0; j < 10; j++ { - require.NoError(t, ws.Write(&log.Entry{Message: "log message"})) + require.NoError(t, ws.Write(&logs.Entry{Message: "logs message"})) } time.Sleep(3 * time.Second) // ждем, пока сработает интервал diff --git a/log/zap/core.go b/logs/zap/core.go similarity index 87% rename from log/zap/core.go rename to logs/zap/core.go index 070e6fb8..3b0c3305 100644 --- a/log/zap/core.go +++ b/logs/zap/core.go @@ -4,19 +4,19 @@ import ( "fmt" oid "git.perx.ru/perxis/perxis-go/id" - "git.perx.ru/perxis/perxis-go/log" + "git.perx.ru/perxis/perxis-go/logs" "git.perx.ru/perxis/perxis-go/pkg/id" "go.uber.org/zap" "go.uber.org/zap/zapcore" ) -// WriteSyncer отвечает за хранение и синхронизацию log.Entry +// WriteSyncer отвечает за хранение и синхронизацию logs.Entry type WriteSyncer interface { - Write(entry *log.Entry) error + Write(entry *logs.Entry) error Sync() error } -// Core кодирует zapcore.Entry в log.Entry и отправляет их в WriteSyncer +// Core кодирует zapcore.Entry в logs.Entry и отправляет их в WriteSyncer type Core struct { zapcore.LevelEnabler @@ -54,7 +54,7 @@ func (core *Core) Sync() error { return core.writeSyncer.Sync() } -func (core *Core) getEntry(entry zapcore.Entry, fields []zapcore.Field) *log.Entry { +func (core *Core) getEntry(entry zapcore.Entry, fields []zapcore.Field) *logs.Entry { if len(core.fields) > 0 { fields = append(fields, core.fields...) } @@ -64,10 +64,10 @@ func (core *Core) getEntry(entry zapcore.Entry, fields []zapcore.Field) *log.Ent field.AddTo(enc) } - ent := &log.Entry{ + ent := &logs.Entry{ ID: id.GenerateNewID(), Timestamp: entry.Time, - LogLevel: log.Level(entry.Level), + LogLevel: logs.Level(entry.Level), Message: entry.Message, } diff --git a/log/zap/core_test.go b/logs/zap/core_test.go similarity index 92% rename from log/zap/core_test.go rename to logs/zap/core_test.go index 8b2d64d7..aabe9cea 100644 --- a/log/zap/core_test.go +++ b/logs/zap/core_test.go @@ -4,7 +4,7 @@ import ( "testing" "git.perx.ru/perxis/perxis-go/id" - "git.perx.ru/perxis/perxis-go/log" + "git.perx.ru/perxis/perxis-go/logs" logzap "git.perx.ru/perxis/perxis-go/zap" "github.com/stretchr/testify/require" "go.uber.org/zap" @@ -20,7 +20,7 @@ func TestCore_getEntry(t *testing.T) { entry zapcore.Entry fields []zapcore.Field } - want *log.Entry + want *logs.Entry }{ { name: "simple", @@ -40,8 +40,8 @@ func TestCore_getEntry(t *testing.T) { logzap.Tags("tag1", "tag2", "tag3"), }, }, - want: &log.Entry{ - LogLevel: log.Level(zapcore.InfoLevel), + want: &logs.Entry{ + LogLevel: logs.Level(zapcore.InfoLevel), Message: "создан элемент коллекции", Category: "create", Component: "Items.Service", diff --git a/log/zap/example_test.go b/logs/zap/example_test.go similarity index 90% rename from log/zap/example_test.go rename to logs/zap/example_test.go index 1c506d15..9dfd0aaa 100644 --- a/log/zap/example_test.go +++ b/logs/zap/example_test.go @@ -7,8 +7,8 @@ import ( "testing" "git.perx.ru/perxis/perxis-go/id" - "git.perx.ru/perxis/perxis-go/log" - logmocks "git.perx.ru/perxis/perxis-go/log/mocks" + "git.perx.ru/perxis/perxis-go/logs" + logmocks "git.perx.ru/perxis/perxis-go/logs/mocks" "git.perx.ru/perxis/perxis-go/pkg/auth" "git.perx.ru/perxis/perxis-go/pkg/items" "git.perx.ru/perxis/perxis-go/pkg/users" @@ -24,9 +24,9 @@ func TestExample(t *testing.T) { item := items.NewItem("WPNN", "9VGP", "GxNv", "W0fl", nil, nil) user := &users.User{ID: "294de355"} - wantEntries := []*log.Entry{ + wantEntries := []*logs.Entry{ { - LogLevel: log.Level(zapcore.InfoLevel), + LogLevel: logs.Level(zapcore.InfoLevel), Message: "Successfully created", Component: "Items", Event: items.EventCreateItem, @@ -35,7 +35,7 @@ func TestExample(t *testing.T) { Tags: []string{"tag1", "tag2", "tag3"}, }, { - LogLevel: log.Level(zapcore.WarnLevel), + LogLevel: logs.Level(zapcore.WarnLevel), Message: "Successfully updated", Component: "Items", Event: items.EventUpdateItem, @@ -49,8 +49,8 @@ func TestExample(t *testing.T) { service.On("Log", mock.Anything, mock.Anything). Return(nil). Run(func(args mock.Arguments) { - entries := args.Get(1).([]*log.Entry) - require.True(t, slices.EqualFunc(wantEntries, entries, func(wantEntry, gotEntry *log.Entry) bool { + entries := args.Get(1).([]*logs.Entry) + require.True(t, slices.EqualFunc(wantEntries, entries, func(wantEntry, gotEntry *logs.Entry) bool { require.NotEmpty(t, gotEntry.ID) require.NotEmpty(t, gotEntry.Timestamp) gotEntry.ID = wantEntry.ID // игнорируем ID diff --git a/perxis-proto b/perxis-proto index 78fe6a1e..133d1dc3 160000 --- a/perxis-proto +++ b/perxis-proto @@ -1 +1 @@ -Subproject commit 78fe6a1ea7e2fe588e4107bf14ac85293b201163 +Subproject commit 133d1dc30c1d8503e6fe6bedaa628a7e64db71ef diff --git a/pkg/collections/middleware/logging_middleware.go b/pkg/collections/middleware/logging_middleware.go index c5e2e2fb..1827c96b 100644 --- a/pkg/collections/middleware/logging_middleware.go +++ b/pkg/collections/middleware/logging_middleware.go @@ -1,5 +1,5 @@ // Code generated by gowrap. DO NOT EDIT. -// template: ../../../assets/templates/middleware/log.tmpl +// template: ../../../assets/templates/middleware/logs.tmpl // gowrap: http://github.com/hexdigest/gowrap package middleware diff --git a/proto/log/log.pb.go b/proto/logs/log.pb.go similarity index 63% rename from proto/log/log.pb.go rename to proto/logs/log.pb.go index e25f0159..8beabf96 100644 --- a/proto/log/log.pb.go +++ b/proto/logs/log.pb.go @@ -2,9 +2,9 @@ // versions: // protoc-gen-go v1.31.0 // protoc v4.25.1 -// source: log/log.proto +// source: logs/log.proto -package log +package logs import ( _ "git.perx.ru/perxis/perxis-go/proto/common" @@ -68,11 +68,11 @@ func (x LogLevel) String() string { } func (LogLevel) Descriptor() protoreflect.EnumDescriptor { - return file_log_log_proto_enumTypes[0].Descriptor() + return file_logs_log_proto_enumTypes[0].Descriptor() } func (LogLevel) Type() protoreflect.EnumType { - return &file_log_log_proto_enumTypes[0] + return &file_logs_log_proto_enumTypes[0] } func (x LogLevel) Number() protoreflect.EnumNumber { @@ -81,7 +81,7 @@ func (x LogLevel) Number() protoreflect.EnumNumber { // Deprecated: Use LogLevel.Descriptor instead. func (LogLevel) EnumDescriptor() ([]byte, []int) { - return file_log_log_proto_rawDescGZIP(), []int{0} + return file_logs_log_proto_rawDescGZIP(), []int{0} } // LogEntry представляет собой структуру данных для хранения информации о журнале. @@ -94,7 +94,7 @@ type LogEntry struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // timestamp указывает на временную метку, указывающую когда было создано данное сообщение. Timestamp *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - Level LogLevel `protobuf:"varint,3,opt,name=level,proto3,enum=log.LogLevel" json:"level,omitempty"` // message это основное сообщение, которое требуется записать в лог. + Level LogLevel `protobuf:"varint,3,opt,name=level,proto3,enum=logs.LogLevel" json:"level,omitempty"` // message это основное сообщение, которое требуется записать в лог. Message string `protobuf:"bytes,4,opt,name=message,proto3" json:"message,omitempty"` // category указывает на категорию события. // Примеры: @@ -151,7 +151,7 @@ type LogEntry struct { func (x *LogEntry) Reset() { *x = LogEntry{} if protoimpl.UnsafeEnabled { - mi := &file_log_log_proto_msgTypes[0] + mi := &file_logs_log_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -164,7 +164,7 @@ func (x *LogEntry) String() string { func (*LogEntry) ProtoMessage() {} func (x *LogEntry) ProtoReflect() protoreflect.Message { - mi := &file_log_log_proto_msgTypes[0] + mi := &file_logs_log_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -177,7 +177,7 @@ func (x *LogEntry) ProtoReflect() protoreflect.Message { // Deprecated: Use LogEntry.ProtoReflect.Descriptor instead. func (*LogEntry) Descriptor() ([]byte, []int) { - return file_log_log_proto_rawDescGZIP(), []int{0} + return file_logs_log_proto_rawDescGZIP(), []int{0} } func (x *LogEntry) GetId() string { @@ -257,71 +257,72 @@ func (x *LogEntry) GetTags() []string { return nil } -var File_log_log_proto protoreflect.FileDescriptor - -var file_log_log_proto_rawDesc = []byte{ - 0x0a, 0x0d, 0x6c, 0x6f, 0x67, 0x2f, 0x6c, 0x6f, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x03, 0x6c, 0x6f, 0x67, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x12, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xdb, 0x02, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x45, 0x6e, 0x74, 0x72, - 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, - 0x64, 0x12, 0x38, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, - 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x23, 0x0a, 0x05, 0x6c, - 0x65, 0x76, 0x65, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x6c, 0x6f, 0x67, - 0x2e, 0x4c, 0x6f, 0x67, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x52, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, - 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x61, - 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x61, - 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, - 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x6f, 0x6d, 0x70, 0x6f, - 0x6e, 0x65, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x18, 0x07, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x6f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x61, 0x6c, 0x6c, 0x65, - 0x72, 0x5f, 0x69, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x61, 0x6c, 0x6c, - 0x65, 0x72, 0x49, 0x64, 0x12, 0x28, 0x0a, 0x04, 0x61, 0x74, 0x74, 0x72, 0x18, 0x0a, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x61, 0x74, 0x74, 0x72, 0x12, 0x12, - 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x74, 0x61, - 0x67, 0x73, 0x2a, 0x45, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x08, - 0x0a, 0x04, 0x49, 0x4e, 0x46, 0x4f, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x57, 0x41, 0x52, 0x4e, - 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x02, - 0x12, 0x0c, 0x0a, 0x08, 0x43, 0x52, 0x49, 0x54, 0x49, 0x43, 0x41, 0x4c, 0x10, 0x03, 0x12, 0x09, - 0x0a, 0x05, 0x46, 0x41, 0x54, 0x41, 0x4c, 0x10, 0x04, 0x42, 0x2c, 0x5a, 0x2a, 0x67, 0x69, 0x74, - 0x2e, 0x70, 0x65, 0x72, 0x78, 0x2e, 0x72, 0x75, 0x2f, 0x70, 0x65, 0x72, 0x78, 0x69, 0x73, 0x2f, - 0x70, 0x65, 0x72, 0x78, 0x69, 0x73, 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, - 0x6c, 0x6f, 0x67, 0x3b, 0x6c, 0x6f, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +var File_logs_log_proto protoreflect.FileDescriptor + +var file_logs_log_proto_rawDesc = []byte{ + 0x0a, 0x0e, 0x6c, 0x6f, 0x67, 0x73, 0x2f, 0x6c, 0x6f, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x12, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x65, 0x72, 0x72, 0x6f, 0x72, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xdc, 0x02, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x02, 0x69, 0x64, 0x12, 0x38, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x24, 0x0a, + 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x6c, + 0x6f, 0x67, 0x73, 0x2e, 0x4c, 0x6f, 0x67, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x52, 0x05, 0x6c, 0x65, + 0x76, 0x65, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, + 0x08, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x6d, + 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x6f, + 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, + 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x1b, 0x0a, + 0x09, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x61, + 0x6c, 0x6c, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, + 0x61, 0x6c, 0x6c, 0x65, 0x72, 0x49, 0x64, 0x12, 0x28, 0x0a, 0x04, 0x61, 0x74, 0x74, 0x72, 0x18, + 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x61, 0x74, 0x74, + 0x72, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x04, 0x74, 0x61, 0x67, 0x73, 0x2a, 0x45, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x4c, 0x65, 0x76, 0x65, + 0x6c, 0x12, 0x08, 0x0a, 0x04, 0x49, 0x4e, 0x46, 0x4f, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x57, + 0x41, 0x52, 0x4e, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, + 0x52, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x43, 0x52, 0x49, 0x54, 0x49, 0x43, 0x41, 0x4c, 0x10, + 0x03, 0x12, 0x09, 0x0a, 0x05, 0x46, 0x41, 0x54, 0x41, 0x4c, 0x10, 0x04, 0x42, 0x2e, 0x5a, 0x2c, + 0x67, 0x69, 0x74, 0x2e, 0x70, 0x65, 0x72, 0x78, 0x2e, 0x72, 0x75, 0x2f, 0x70, 0x65, 0x72, 0x78, + 0x69, 0x73, 0x2f, 0x70, 0x65, 0x72, 0x78, 0x69, 0x73, 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2f, 0x6c, 0x6f, 0x67, 0x73, 0x3b, 0x6c, 0x6f, 0x67, 0x73, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( - file_log_log_proto_rawDescOnce sync.Once - file_log_log_proto_rawDescData = file_log_log_proto_rawDesc + file_logs_log_proto_rawDescOnce sync.Once + file_logs_log_proto_rawDescData = file_logs_log_proto_rawDesc ) -func file_log_log_proto_rawDescGZIP() []byte { - file_log_log_proto_rawDescOnce.Do(func() { - file_log_log_proto_rawDescData = protoimpl.X.CompressGZIP(file_log_log_proto_rawDescData) +func file_logs_log_proto_rawDescGZIP() []byte { + file_logs_log_proto_rawDescOnce.Do(func() { + file_logs_log_proto_rawDescData = protoimpl.X.CompressGZIP(file_logs_log_proto_rawDescData) }) - return file_log_log_proto_rawDescData + return file_logs_log_proto_rawDescData } -var file_log_log_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_log_log_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_log_log_proto_goTypes = []interface{}{ - (LogLevel)(0), // 0: log.LogLevel - (*LogEntry)(nil), // 1: log.LogEntry +var file_logs_log_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_logs_log_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_logs_log_proto_goTypes = []interface{}{ + (LogLevel)(0), // 0: logs.LogLevel + (*LogEntry)(nil), // 1: logs.LogEntry (*timestamppb.Timestamp)(nil), // 2: google.protobuf.Timestamp (*anypb.Any)(nil), // 3: google.protobuf.Any } -var file_log_log_proto_depIdxs = []int32{ - 2, // 0: log.LogEntry.timestamp:type_name -> google.protobuf.Timestamp - 0, // 1: log.LogEntry.level:type_name -> log.LogLevel - 3, // 2: log.LogEntry.attr:type_name -> google.protobuf.Any +var file_logs_log_proto_depIdxs = []int32{ + 2, // 0: logs.LogEntry.timestamp:type_name -> google.protobuf.Timestamp + 0, // 1: logs.LogEntry.level:type_name -> logs.LogLevel + 3, // 2: logs.LogEntry.attr:type_name -> google.protobuf.Any 3, // [3:3] is the sub-list for method output_type 3, // [3:3] is the sub-list for method input_type 3, // [3:3] is the sub-list for extension type_name @@ -329,13 +330,13 @@ var file_log_log_proto_depIdxs = []int32{ 0, // [0:3] is the sub-list for field type_name } -func init() { file_log_log_proto_init() } -func file_log_log_proto_init() { - if File_log_log_proto != nil { +func init() { file_logs_log_proto_init() } +func file_logs_log_proto_init() { + if File_logs_log_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_log_log_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_logs_log_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LogEntry); i { case 0: return &v.state @@ -352,19 +353,19 @@ func file_log_log_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_log_log_proto_rawDesc, + RawDescriptor: file_logs_log_proto_rawDesc, NumEnums: 1, NumMessages: 1, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_log_log_proto_goTypes, - DependencyIndexes: file_log_log_proto_depIdxs, - EnumInfos: file_log_log_proto_enumTypes, - MessageInfos: file_log_log_proto_msgTypes, + GoTypes: file_logs_log_proto_goTypes, + DependencyIndexes: file_logs_log_proto_depIdxs, + EnumInfos: file_logs_log_proto_enumTypes, + MessageInfos: file_logs_log_proto_msgTypes, }.Build() - File_log_log_proto = out.File - file_log_log_proto_rawDesc = nil - file_log_log_proto_goTypes = nil - file_log_log_proto_depIdxs = nil + File_logs_log_proto = out.File + file_logs_log_proto_rawDesc = nil + file_logs_log_proto_goTypes = nil + file_logs_log_proto_depIdxs = nil } diff --git a/proto/log/log_service.pb.go b/proto/logs/log_service.pb.go similarity index 56% rename from proto/log/log_service.pb.go rename to proto/logs/log_service.pb.go index 02d2c107..09497166 100644 --- a/proto/log/log_service.pb.go +++ b/proto/logs/log_service.pb.go @@ -2,9 +2,9 @@ // versions: // protoc-gen-go v1.31.0 // protoc v4.25.1 -// source: log/log_service.proto +// source: logs/log_service.proto -package log +package logs import ( common "git.perx.ru/perxis/perxis-go/proto/common" @@ -35,7 +35,7 @@ type LogRequest struct { func (x *LogRequest) Reset() { *x = LogRequest{} if protoimpl.UnsafeEnabled { - mi := &file_log_log_service_proto_msgTypes[0] + mi := &file_logs_log_service_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -48,7 +48,7 @@ func (x *LogRequest) String() string { func (*LogRequest) ProtoMessage() {} func (x *LogRequest) ProtoReflect() protoreflect.Message { - mi := &file_log_log_service_proto_msgTypes[0] + mi := &file_logs_log_service_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -61,7 +61,7 @@ func (x *LogRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use LogRequest.ProtoReflect.Descriptor instead. func (*LogRequest) Descriptor() ([]byte, []int) { - return file_log_log_service_proto_rawDescGZIP(), []int{0} + return file_logs_log_service_proto_rawDescGZIP(), []int{0} } func (x *LogRequest) GetEntries() []*LogEntry { @@ -84,7 +84,7 @@ type LogResponse struct { func (x *LogResponse) Reset() { *x = LogResponse{} if protoimpl.UnsafeEnabled { - mi := &file_log_log_service_proto_msgTypes[1] + mi := &file_logs_log_service_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -97,7 +97,7 @@ func (x *LogResponse) String() string { func (*LogResponse) ProtoMessage() {} func (x *LogResponse) ProtoReflect() protoreflect.Message { - mi := &file_log_log_service_proto_msgTypes[1] + mi := &file_logs_log_service_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -110,7 +110,7 @@ func (x *LogResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use LogResponse.ProtoReflect.Descriptor instead. func (*LogResponse) Descriptor() ([]byte, []int) { - return file_log_log_service_proto_rawDescGZIP(), []int{1} + return file_logs_log_service_proto_rawDescGZIP(), []int{1} } func (x *LogResponse) GetError() *common.Error { @@ -137,7 +137,7 @@ type Filter struct { func (x *Filter) Reset() { *x = Filter{} if protoimpl.UnsafeEnabled { - mi := &file_log_log_service_proto_msgTypes[2] + mi := &file_logs_log_service_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -150,7 +150,7 @@ func (x *Filter) String() string { func (*Filter) ProtoMessage() {} func (x *Filter) ProtoReflect() protoreflect.Message { - mi := &file_log_log_service_proto_msgTypes[2] + mi := &file_logs_log_service_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -163,7 +163,7 @@ func (x *Filter) ProtoReflect() protoreflect.Message { // Deprecated: Use Filter.ProtoReflect.Descriptor instead. func (*Filter) Descriptor() ([]byte, []int) { - return file_log_log_service_proto_rawDescGZIP(), []int{2} + return file_logs_log_service_proto_rawDescGZIP(), []int{2} } func (x *Filter) GetQ() []string { @@ -188,7 +188,7 @@ type FindRequest struct { func (x *FindRequest) Reset() { *x = FindRequest{} if protoimpl.UnsafeEnabled { - mi := &file_log_log_service_proto_msgTypes[3] + mi := &file_logs_log_service_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -201,7 +201,7 @@ func (x *FindRequest) String() string { func (*FindRequest) ProtoMessage() {} func (x *FindRequest) ProtoReflect() protoreflect.Message { - mi := &file_log_log_service_proto_msgTypes[3] + mi := &file_logs_log_service_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -214,7 +214,7 @@ func (x *FindRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use FindRequest.ProtoReflect.Descriptor instead. func (*FindRequest) Descriptor() ([]byte, []int) { - return file_log_log_service_proto_rawDescGZIP(), []int{3} + return file_logs_log_service_proto_rawDescGZIP(), []int{3} } func (x *FindRequest) GetFilter() *Filter { @@ -251,7 +251,7 @@ type FindResult struct { func (x *FindResult) Reset() { *x = FindResult{} if protoimpl.UnsafeEnabled { - mi := &file_log_log_service_proto_msgTypes[4] + mi := &file_logs_log_service_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -264,7 +264,7 @@ func (x *FindResult) String() string { func (*FindResult) ProtoMessage() {} func (x *FindResult) ProtoReflect() protoreflect.Message { - mi := &file_log_log_service_proto_msgTypes[4] + mi := &file_logs_log_service_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -277,7 +277,7 @@ func (x *FindResult) ProtoReflect() protoreflect.Message { // Deprecated: Use FindResult.ProtoReflect.Descriptor instead. func (*FindResult) Descriptor() ([]byte, []int) { - return file_log_log_service_proto_rawDescGZIP(), []int{4} + return file_logs_log_service_proto_rawDescGZIP(), []int{4} } func (x *FindResult) GetEntries() []*LogEntry { @@ -324,7 +324,7 @@ type FindResponse struct { func (x *FindResponse) Reset() { *x = FindResponse{} if protoimpl.UnsafeEnabled { - mi := &file_log_log_service_proto_msgTypes[5] + mi := &file_logs_log_service_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -337,7 +337,7 @@ func (x *FindResponse) String() string { func (*FindResponse) ProtoMessage() {} func (x *FindResponse) ProtoReflect() protoreflect.Message { - mi := &file_log_log_service_proto_msgTypes[5] + mi := &file_logs_log_service_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -350,7 +350,7 @@ func (x *FindResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use FindResponse.ProtoReflect.Descriptor instead. func (*FindResponse) Descriptor() ([]byte, []int) { - return file_log_log_service_proto_rawDescGZIP(), []int{5} + return file_logs_log_service_proto_rawDescGZIP(), []int{5} } func (m *FindResponse) GetResponse() isFindResponse_Response { @@ -405,7 +405,7 @@ type DeleteRequest struct { func (x *DeleteRequest) Reset() { *x = DeleteRequest{} if protoimpl.UnsafeEnabled { - mi := &file_log_log_service_proto_msgTypes[6] + mi := &file_logs_log_service_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -418,7 +418,7 @@ func (x *DeleteRequest) String() string { func (*DeleteRequest) ProtoMessage() {} func (x *DeleteRequest) ProtoReflect() protoreflect.Message { - mi := &file_log_log_service_proto_msgTypes[6] + mi := &file_logs_log_service_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -431,7 +431,7 @@ func (x *DeleteRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead. func (*DeleteRequest) Descriptor() ([]byte, []int) { - return file_log_log_service_proto_rawDescGZIP(), []int{6} + return file_logs_log_service_proto_rawDescGZIP(), []int{6} } func (x *DeleteRequest) GetFilter() *Filter { @@ -454,7 +454,7 @@ type DeleteResponse struct { func (x *DeleteResponse) Reset() { *x = DeleteResponse{} if protoimpl.UnsafeEnabled { - mi := &file_log_log_service_proto_msgTypes[7] + mi := &file_logs_log_service_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -467,7 +467,7 @@ func (x *DeleteResponse) String() string { func (*DeleteResponse) ProtoMessage() {} func (x *DeleteResponse) ProtoReflect() protoreflect.Message { - mi := &file_log_log_service_proto_msgTypes[7] + mi := &file_logs_log_service_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -480,7 +480,7 @@ func (x *DeleteResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteResponse.ProtoReflect.Descriptor instead. func (*DeleteResponse) Descriptor() ([]byte, []int) { - return file_log_log_service_proto_rawDescGZIP(), []int{7} + return file_logs_log_service_proto_rawDescGZIP(), []int{7} } func (x *DeleteResponse) GetError() *common.Error { @@ -490,114 +490,115 @@ func (x *DeleteResponse) GetError() *common.Error { return nil } -var File_log_log_service_proto protoreflect.FileDescriptor - -var file_log_log_service_proto_rawDesc = []byte{ - 0x0a, 0x15, 0x6c, 0x6f, 0x67, 0x2f, 0x6c, 0x6f, 0x67, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x6c, 0x6f, 0x67, 0x1a, 0x13, 0x63, 0x6f, - 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x12, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0d, 0x6c, 0x6f, 0x67, 0x2f, 0x6c, 0x6f, 0x67, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x35, 0x0a, 0x0a, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x6c, 0x6f, 0x67, 0x2e, 0x4c, 0x6f, 0x67, 0x45, 0x6e, - 0x74, 0x72, 0x79, 0x52, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x22, 0x32, 0x0a, 0x0b, - 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x05, 0x65, - 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x63, 0x6f, 0x6d, - 0x6d, 0x6f, 0x6e, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, - 0x22, 0x16, 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x0c, 0x0a, 0x01, 0x71, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x01, 0x71, 0x22, 0x61, 0x0a, 0x0b, 0x46, 0x69, 0x6e, 0x64, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, - 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x6c, 0x6f, 0x67, 0x2e, 0x46, 0x69, - 0x6c, 0x74, 0x65, 0x72, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x2d, 0x0a, 0x07, - 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, - 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x9f, 0x01, 0x0a, 0x0a, - 0x46, 0x69, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x27, 0x0a, 0x07, 0x65, 0x6e, - 0x74, 0x72, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x6c, 0x6f, - 0x67, 0x2e, 0x4c, 0x6f, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x65, 0x6e, 0x74, 0x72, - 0x69, 0x65, 0x73, 0x12, 0x23, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x6c, 0x6f, 0x67, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, - 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x2d, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, - 0x6f, 0x6e, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, - 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x22, 0x6c, 0x0a, - 0x0c, 0x46, 0x69, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, - 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, - 0x6c, 0x6f, 0x67, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x48, 0x00, - 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x25, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, - 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, - 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x48, 0x00, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x42, - 0x0a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x34, 0x0a, 0x0d, 0x44, - 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x06, - 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x6c, - 0x6f, 0x67, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, - 0x72, 0x22, 0x35, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x45, 0x72, 0x72, 0x6f, - 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x32, 0x9c, 0x01, 0x0a, 0x0a, 0x4c, 0x6f, 0x67, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x2a, 0x0a, 0x03, 0x4c, 0x6f, 0x67, 0x12, 0x0f, - 0x2e, 0x6c, 0x6f, 0x67, 0x2e, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x10, 0x2e, 0x6c, 0x6f, 0x67, 0x2e, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x00, 0x12, 0x2d, 0x0a, 0x04, 0x46, 0x69, 0x6e, 0x64, 0x12, 0x10, 0x2e, 0x6c, 0x6f, - 0x67, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, - 0x6c, 0x6f, 0x67, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x00, 0x12, 0x33, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x12, 0x2e, 0x6c, - 0x6f, 0x67, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x13, 0x2e, 0x6c, 0x6f, 0x67, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x2c, 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x2e, 0x70, - 0x65, 0x72, 0x78, 0x2e, 0x72, 0x75, 0x2f, 0x70, 0x65, 0x72, 0x78, 0x69, 0x73, 0x2f, 0x70, 0x65, - 0x72, 0x78, 0x69, 0x73, 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6c, 0x6f, - 0x67, 0x3b, 0x6c, 0x6f, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +var File_logs_log_service_proto protoreflect.FileDescriptor + +var file_logs_log_service_proto_rawDesc = []byte{ + 0x0a, 0x16, 0x6c, 0x6f, 0x67, 0x73, 0x2f, 0x6c, 0x6f, 0x67, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x1a, 0x13, + 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x12, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x65, 0x72, 0x72, 0x6f, + 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0e, 0x6c, 0x6f, 0x67, 0x73, 0x2f, 0x6c, 0x6f, + 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x36, 0x0a, 0x0a, 0x4c, 0x6f, 0x67, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6c, 0x6f, 0x67, 0x73, 0x2e, 0x4c, + 0x6f, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, + 0x22, 0x32, 0x0a, 0x0b, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x23, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, + 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, + 0x72, 0x72, 0x6f, 0x72, 0x22, 0x16, 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x0c, + 0x0a, 0x01, 0x71, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x01, 0x71, 0x22, 0x62, 0x0a, 0x0b, + 0x46, 0x69, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x24, 0x0a, 0x06, 0x66, + 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x6c, 0x6f, + 0x67, 0x73, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, + 0x72, 0x12, 0x2d, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x46, 0x69, 0x6e, 0x64, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x22, 0xa1, 0x01, 0x0a, 0x0a, 0x46, 0x69, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, + 0x28, 0x0a, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x0e, 0x2e, 0x6c, 0x6f, 0x67, 0x73, 0x2e, 0x4c, 0x6f, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x52, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x06, 0x66, 0x69, 0x6c, + 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x6c, 0x6f, 0x67, 0x73, + 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, + 0x2d, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x13, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x14, + 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x74, + 0x6f, 0x74, 0x61, 0x6c, 0x22, 0x6d, 0x0a, 0x0c, 0x46, 0x69, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6c, 0x6f, 0x67, 0x73, 0x2e, 0x46, 0x69, 0x6e, 0x64, + 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x48, 0x00, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, + 0x12, 0x25, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x0d, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x48, 0x00, + 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x42, 0x0a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x35, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x24, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x6c, 0x6f, 0x67, 0x73, 0x2e, 0x46, 0x69, 0x6c, 0x74, + 0x65, 0x72, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x22, 0x35, 0x0a, 0x0e, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x05, + 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x63, 0x6f, + 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, + 0x72, 0x32, 0xa2, 0x01, 0x0a, 0x0a, 0x4c, 0x6f, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x12, 0x2c, 0x0a, 0x03, 0x4c, 0x6f, 0x67, 0x12, 0x10, 0x2e, 0x6c, 0x6f, 0x67, 0x73, 0x2e, 0x4c, + 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x6c, 0x6f, 0x67, 0x73, + 0x2e, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x2f, + 0x0a, 0x04, 0x46, 0x69, 0x6e, 0x64, 0x12, 0x11, 0x2e, 0x6c, 0x6f, 0x67, 0x73, 0x2e, 0x46, 0x69, + 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6c, 0x6f, 0x67, 0x73, + 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x35, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x13, 0x2e, 0x6c, 0x6f, 0x67, 0x73, + 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, + 0x2e, 0x6c, 0x6f, 0x67, 0x73, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x2e, 0x5a, 0x2c, 0x67, 0x69, 0x74, 0x2e, 0x70, 0x65, + 0x72, 0x78, 0x2e, 0x72, 0x75, 0x2f, 0x70, 0x65, 0x72, 0x78, 0x69, 0x73, 0x2f, 0x70, 0x65, 0x72, + 0x78, 0x69, 0x73, 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6c, 0x6f, 0x67, + 0x73, 0x3b, 0x6c, 0x6f, 0x67, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_log_log_service_proto_rawDescOnce sync.Once - file_log_log_service_proto_rawDescData = file_log_log_service_proto_rawDesc + file_logs_log_service_proto_rawDescOnce sync.Once + file_logs_log_service_proto_rawDescData = file_logs_log_service_proto_rawDesc ) -func file_log_log_service_proto_rawDescGZIP() []byte { - file_log_log_service_proto_rawDescOnce.Do(func() { - file_log_log_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_log_log_service_proto_rawDescData) +func file_logs_log_service_proto_rawDescGZIP() []byte { + file_logs_log_service_proto_rawDescOnce.Do(func() { + file_logs_log_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_logs_log_service_proto_rawDescData) }) - return file_log_log_service_proto_rawDescData -} - -var file_log_log_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8) -var file_log_log_service_proto_goTypes = []interface{}{ - (*LogRequest)(nil), // 0: log.LogRequest - (*LogResponse)(nil), // 1: log.LogResponse - (*Filter)(nil), // 2: log.Filter - (*FindRequest)(nil), // 3: log.FindRequest - (*FindResult)(nil), // 4: log.FindResult - (*FindResponse)(nil), // 5: log.FindResponse - (*DeleteRequest)(nil), // 6: log.DeleteRequest - (*DeleteResponse)(nil), // 7: log.DeleteResponse - (*LogEntry)(nil), // 8: log.LogEntry + return file_logs_log_service_proto_rawDescData +} + +var file_logs_log_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_logs_log_service_proto_goTypes = []interface{}{ + (*LogRequest)(nil), // 0: logs.LogRequest + (*LogResponse)(nil), // 1: logs.LogResponse + (*Filter)(nil), // 2: logs.Filter + (*FindRequest)(nil), // 3: logs.FindRequest + (*FindResult)(nil), // 4: logs.FindResult + (*FindResponse)(nil), // 5: logs.FindResponse + (*DeleteRequest)(nil), // 6: logs.DeleteRequest + (*DeleteResponse)(nil), // 7: logs.DeleteResponse + (*LogEntry)(nil), // 8: logs.LogEntry (*common.Error)(nil), // 9: common.Error (*common.FindOptions)(nil), // 10: common.FindOptions } -var file_log_log_service_proto_depIdxs = []int32{ - 8, // 0: log.LogRequest.entries:type_name -> log.LogEntry - 9, // 1: log.LogResponse.error:type_name -> common.Error - 2, // 2: log.FindRequest.filter:type_name -> log.Filter - 10, // 3: log.FindRequest.options:type_name -> common.FindOptions - 8, // 4: log.FindResult.entries:type_name -> log.LogEntry - 2, // 5: log.FindResult.filter:type_name -> log.Filter - 10, // 6: log.FindResult.options:type_name -> common.FindOptions - 4, // 7: log.FindResponse.result:type_name -> log.FindResult - 9, // 8: log.FindResponse.error:type_name -> common.Error - 2, // 9: log.DeleteRequest.filter:type_name -> log.Filter - 9, // 10: log.DeleteResponse.error:type_name -> common.Error - 0, // 11: log.LogService.Log:input_type -> log.LogRequest - 3, // 12: log.LogService.Find:input_type -> log.FindRequest - 6, // 13: log.LogService.Delete:input_type -> log.DeleteRequest - 1, // 14: log.LogService.Log:output_type -> log.LogResponse - 5, // 15: log.LogService.Find:output_type -> log.FindResponse - 7, // 16: log.LogService.Delete:output_type -> log.DeleteResponse +var file_logs_log_service_proto_depIdxs = []int32{ + 8, // 0: logs.LogRequest.entries:type_name -> logs.LogEntry + 9, // 1: logs.LogResponse.error:type_name -> common.Error + 2, // 2: logs.FindRequest.filter:type_name -> logs.Filter + 10, // 3: logs.FindRequest.options:type_name -> common.FindOptions + 8, // 4: logs.FindResult.entries:type_name -> logs.LogEntry + 2, // 5: logs.FindResult.filter:type_name -> logs.Filter + 10, // 6: logs.FindResult.options:type_name -> common.FindOptions + 4, // 7: logs.FindResponse.result:type_name -> logs.FindResult + 9, // 8: logs.FindResponse.error:type_name -> common.Error + 2, // 9: logs.DeleteRequest.filter:type_name -> logs.Filter + 9, // 10: logs.DeleteResponse.error:type_name -> common.Error + 0, // 11: logs.LogService.Log:input_type -> logs.LogRequest + 3, // 12: logs.LogService.Find:input_type -> logs.FindRequest + 6, // 13: logs.LogService.Delete:input_type -> logs.DeleteRequest + 1, // 14: logs.LogService.Log:output_type -> logs.LogResponse + 5, // 15: logs.LogService.Find:output_type -> logs.FindResponse + 7, // 16: logs.LogService.Delete:output_type -> logs.DeleteResponse 14, // [14:17] is the sub-list for method output_type 11, // [11:14] is the sub-list for method input_type 11, // [11:11] is the sub-list for extension type_name @@ -605,14 +606,14 @@ var file_log_log_service_proto_depIdxs = []int32{ 0, // [0:11] is the sub-list for field type_name } -func init() { file_log_log_service_proto_init() } -func file_log_log_service_proto_init() { - if File_log_log_service_proto != nil { +func init() { file_logs_log_service_proto_init() } +func file_logs_log_service_proto_init() { + if File_logs_log_service_proto != nil { return } - file_log_log_proto_init() + file_logs_log_proto_init() if !protoimpl.UnsafeEnabled { - file_log_log_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_logs_log_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LogRequest); i { case 0: return &v.state @@ -624,7 +625,7 @@ func file_log_log_service_proto_init() { return nil } } - file_log_log_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_logs_log_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LogResponse); i { case 0: return &v.state @@ -636,7 +637,7 @@ func file_log_log_service_proto_init() { return nil } } - file_log_log_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_logs_log_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Filter); i { case 0: return &v.state @@ -648,7 +649,7 @@ func file_log_log_service_proto_init() { return nil } } - file_log_log_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_logs_log_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FindRequest); i { case 0: return &v.state @@ -660,7 +661,7 @@ func file_log_log_service_proto_init() { return nil } } - file_log_log_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_logs_log_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FindResult); i { case 0: return &v.state @@ -672,7 +673,7 @@ func file_log_log_service_proto_init() { return nil } } - file_log_log_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_logs_log_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FindResponse); i { case 0: return &v.state @@ -684,7 +685,7 @@ func file_log_log_service_proto_init() { return nil } } - file_log_log_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_logs_log_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DeleteRequest); i { case 0: return &v.state @@ -696,7 +697,7 @@ func file_log_log_service_proto_init() { return nil } } - file_log_log_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_logs_log_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DeleteResponse); i { case 0: return &v.state @@ -709,7 +710,7 @@ func file_log_log_service_proto_init() { } } } - file_log_log_service_proto_msgTypes[5].OneofWrappers = []interface{}{ + file_logs_log_service_proto_msgTypes[5].OneofWrappers = []interface{}{ (*FindResponse_Result)(nil), (*FindResponse_Error)(nil), } @@ -717,18 +718,18 @@ func file_log_log_service_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_log_log_service_proto_rawDesc, + RawDescriptor: file_logs_log_service_proto_rawDesc, NumEnums: 0, NumMessages: 8, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_log_log_service_proto_goTypes, - DependencyIndexes: file_log_log_service_proto_depIdxs, - MessageInfos: file_log_log_service_proto_msgTypes, + GoTypes: file_logs_log_service_proto_goTypes, + DependencyIndexes: file_logs_log_service_proto_depIdxs, + MessageInfos: file_logs_log_service_proto_msgTypes, }.Build() - File_log_log_service_proto = out.File - file_log_log_service_proto_rawDesc = nil - file_log_log_service_proto_goTypes = nil - file_log_log_service_proto_depIdxs = nil + File_logs_log_service_proto = out.File + file_logs_log_service_proto_rawDesc = nil + file_logs_log_service_proto_goTypes = nil + file_logs_log_service_proto_depIdxs = nil } diff --git a/proto/log/log_service_grpc.pb.go b/proto/logs/log_service_grpc.pb.go similarity index 95% rename from proto/log/log_service_grpc.pb.go rename to proto/logs/log_service_grpc.pb.go index d9dfda0b..a0af05d3 100644 --- a/proto/log/log_service_grpc.pb.go +++ b/proto/logs/log_service_grpc.pb.go @@ -2,9 +2,9 @@ // versions: // - protoc-gen-go-grpc v1.3.0 // - protoc v4.25.1 -// source: log/log_service.proto +// source: logs/log_service.proto -package log +package logs import ( context "context" @@ -19,9 +19,9 @@ import ( const _ = grpc.SupportPackageIsVersion7 const ( - LogService_Log_FullMethodName = "/log.LogService/Log" - LogService_Find_FullMethodName = "/log.LogService/Find" - LogService_Delete_FullMethodName = "/log.LogService/Delete" + LogService_Log_FullMethodName = "/logs.LogService/Log" + LogService_Find_FullMethodName = "/logs.LogService/Find" + LogService_Delete_FullMethodName = "/logs.LogService/Delete" ) // LogServiceClient is the client API for LogService service. @@ -168,7 +168,7 @@ func _LogService_Delete_Handler(srv interface{}, ctx context.Context, dec func(i // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var LogService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "log.LogService", + ServiceName: "logs.LogService", HandlerType: (*LogServiceServer)(nil), Methods: []grpc.MethodDesc{ { @@ -185,5 +185,5 @@ var LogService_ServiceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "log/log_service.proto", + Metadata: "logs/log_service.proto", } diff --git a/zap/filter_core.go b/zap/filter_core.go index 7e99d942..8f92b800 100644 --- a/zap/filter_core.go +++ b/zap/filter_core.go @@ -67,8 +67,8 @@ type filterCore struct { // core = WithFilters(core, ContainsField(zap.Int("a", 5))) // // logger := zap.New(core) -// logger.Info("Test log") // НЕ будет записан -// logger.Info("Test log", zap.Int("a", 5)) // будет записан +// logger.Info("Test logs") // НЕ будет записан +// logger.Info("Test logs", zap.Int("a", 5)) // будет записан func WithFilters(core zapcore.Core, filters ...FilterFunc) zapcore.Core { return &filterCore{ Core: core, -- GitLab