diff --git a/docs/api-reference/apidocs.swagger.json b/docs/api-reference/apidocs.swagger.json index 254bf9bd8..30de791da 100644 --- a/docs/api-reference/apidocs.swagger.json +++ b/docs/api-reference/apidocs.swagger.json @@ -3,7 +3,7 @@ "info": { "title": "Permify API", "description": "Permify is an open source authorization service for creating fine-grained and scalable authorization systems.", - "version": "v1.1.9", + "version": "v1.2.0", "contact": { "name": "API Support", "url": "https://github.com/Permify/permify/issues", diff --git a/docs/api-reference/openapiv2/apidocs.swagger.json b/docs/api-reference/openapiv2/apidocs.swagger.json index 15cf23526..88f95bef3 100644 --- a/docs/api-reference/openapiv2/apidocs.swagger.json +++ b/docs/api-reference/openapiv2/apidocs.swagger.json @@ -3,7 +3,7 @@ "info": { "title": "Permify API", "description": "Permify is an open source authorization service for creating fine-grained and scalable authorization systems.", - "version": "v1.1.9", + "version": "v1.2.0", "contact": { "name": "API Support", "url": "https://github.com/Permify/permify/issues", diff --git a/internal/engines/cache/check.go b/internal/engines/cache/check.go index 98b96f66b..24f0a3c7e 100644 --- a/internal/engines/cache/check.go +++ b/internal/engines/cache/check.go @@ -3,7 +3,6 @@ package cache import ( "context" "encoding/hex" - "time" api "go.opentelemetry.io/otel/metric" @@ -26,8 +25,7 @@ type CheckEngineWithCache struct { cache cache.Cache // Metrics - cacheCounter api.Int64Counter - cacheHitDurationHistogram api.Int64Histogram + cacheHitHistogram api.Int64Histogram } // NewCheckEngineWithCache creates a new instance of EngineKeyManager by initializing an EngineKeys @@ -38,11 +36,10 @@ func NewCheckEngineWithCache( cache cache.Cache, ) invoke.Check { return &CheckEngineWithCache{ - schemaReader: schemaReader, - checker: checker, - cache: cache, - cacheCounter: telemetry.NewCounter(internal.Meter, "cache_check_count", "Number of permission cached checks performed"), - cacheHitDurationHistogram: telemetry.NewHistogram(internal.Meter, "cache_hit_duration", "microseconds", "Duration of cache hits in microseconds"), + schemaReader: schemaReader, + checker: checker, + cache: cache, + cacheHitHistogram: telemetry.NewHistogram(internal.Meter, "cache_hit", "amount", "Number of cache hits"), } } @@ -67,15 +64,8 @@ func (c *CheckEngineWithCache) Check(ctx context.Context, request *base.Permissi // If a cached result is found, handle exclusion and return the result. if found { - ctx, span := internal.Tracer.Start(ctx, "hit") - defer span.End() - start := time.Now() - - // Increase the check count in the metrics. - c.cacheCounter.Add(ctx, 1) - - duration := time.Now().Sub(start) - c.cacheHitDurationHistogram.Record(ctx, duration.Microseconds()) + // Increase the hit count in the metrics. + c.cacheHitHistogram.Record(ctx, 1) // If the request doesn't have the exclusion flag set, return the cached result. return &base.PermissionCheckResponse{ diff --git a/internal/engines/cache/check_test.go b/internal/engines/cache/check_test.go index e099cfb22..5f57b1ca7 100644 --- a/internal/engines/cache/check_test.go +++ b/internal/engines/cache/check_test.go @@ -41,7 +41,7 @@ var _ = Describe("cache", func() { Expect(err).ShouldNot(HaveOccurred()) // Initialize a new EngineKeys struct with a new cache.Cache instance - engineKeys := CheckEngineWithCache{nil, nil, cache, nil, nil} + engineKeys := CheckEngineWithCache{nil, nil, cache, nil} // Create a new PermissionCheckRequest and PermissionCheckResponse checkReq := &base.PermissionCheckRequest{ @@ -91,7 +91,7 @@ var _ = Describe("cache", func() { Expect(err).ShouldNot(HaveOccurred()) // Initialize a new EngineKeys struct with a new cache.Cache instance - engineKeys := CheckEngineWithCache{nil, nil, cache, nil, nil} + engineKeys := CheckEngineWithCache{nil, nil, cache, nil} // Create a new PermissionCheckRequest and PermissionCheckResponse checkReq := &base.PermissionCheckRequest{ @@ -141,7 +141,7 @@ var _ = Describe("cache", func() { Expect(err).ShouldNot(HaveOccurred()) // Initialize a new EngineKeys struct with a new cache.Cache instance - engineKeys := CheckEngineWithCache{nil, nil, cache, nil, nil} + engineKeys := CheckEngineWithCache{nil, nil, cache, nil} // Create a new PermissionCheckRequest and PermissionCheckResponse checkReq := &base.PermissionCheckRequest{ @@ -285,7 +285,7 @@ var _ = Describe("cache", func() { Expect(err).ShouldNot(HaveOccurred()) // Initialize a new EngineKeys struct with a new cache.Cache instance - engineKeys := CheckEngineWithCache{nil, nil, cache, nil, nil} + engineKeys := CheckEngineWithCache{nil, nil, cache, nil} // Create a new PermissionCheckRequest checkReq := &base.PermissionCheckRequest{ @@ -320,7 +320,7 @@ var _ = Describe("cache", func() { Expect(err).ShouldNot(HaveOccurred()) // Initialize a new EngineKeys struct with a new cache.Cache instance - engineKeys := CheckEngineWithCache{nil, nil, cache, nil, nil} + engineKeys := CheckEngineWithCache{nil, nil, cache, nil} // Create some new PermissionCheckRequests and PermissionCheckResponses checkReq1 := &base.PermissionCheckRequest{ diff --git a/internal/info.go b/internal/info.go index eda0cab7a..4ee7f3b0d 100644 --- a/internal/info.go +++ b/internal/info.go @@ -23,7 +23,7 @@ var Identifier = "" */ const ( // Version is the last release of the Permify (e.g. v0.1.0) - Version = "v1.1.9" + Version = "v1.2.0" ) // Function to create a single line of the ASCII art with centered content and color diff --git a/internal/invoke/invoke.go b/internal/invoke/invoke.go index 37bc72de5..065e250fe 100644 --- a/internal/invoke/invoke.go +++ b/internal/invoke/invoke.go @@ -3,10 +3,10 @@ package invoke import ( "context" "sync/atomic" - "time" "go.opentelemetry.io/otel/attribute" otelCodes "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/metric" api "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/trace" @@ -68,16 +68,10 @@ type DirectInvoker struct { // LookupSubject sp SubjectPermission - // Metrics - checkCounter api.Int64Counter - lookupEntityCounter api.Int64Counter - lookupSubjectCounter api.Int64Counter - subjectPermissionCounter api.Int64Counter - - checkDurationHistogram api.Int64Histogram - lookupEntityDurationHistogram api.Int64Histogram - lookupSubjectDurationHistogram api.Int64Histogram - subjectPermissionDurationHistogram api.Int64Histogram + checkHistogram api.Int64Histogram + lookupEntityHistogram api.Int64Histogram + lookupSubjectHistogram api.Int64Histogram + subjectPermissionHistogram api.Int64Histogram } // NewDirectInvoker is a constructor for DirectInvoker. @@ -92,20 +86,17 @@ func NewDirectInvoker( sp SubjectPermission, ) *DirectInvoker { return &DirectInvoker{ - schemaReader: schemaReader, - dataReader: dataReader, - cc: cc, - ec: ec, - lo: lo, - sp: sp, - checkCounter: telemetry.NewCounter(internal.Meter, "check_count", "Number of permission checks performed"), - lookupEntityCounter: telemetry.NewCounter(internal.Meter, "lookup_entity_count", "Number of permission lookup entity performed"), - lookupSubjectCounter: telemetry.NewCounter(internal.Meter, "lookup_subject_count", "Number of permission lookup subject performed"), - subjectPermissionCounter: telemetry.NewCounter(internal.Meter, "subject_permission_count", "Number of subject permission performed"), - checkDurationHistogram: telemetry.NewHistogram(internal.Meter, "check_duration", "microseconds", "Duration of checks in microseconds"), - lookupEntityDurationHistogram: telemetry.NewHistogram(internal.Meter, "lookup_entity_duration", "microseconds", "Duration of lookup entity duration in microseconds"), - lookupSubjectDurationHistogram: telemetry.NewHistogram(internal.Meter, "lookup_subject_duration", "microseconds", "Duration of lookup subject duration in microseconds"), - subjectPermissionDurationHistogram: telemetry.NewHistogram(internal.Meter, "subject_permission_duration", "microseconds", "Duration of subject permission duration in microseconds"), + schemaReader: schemaReader, + dataReader: dataReader, + cc: cc, + ec: ec, + lo: lo, + sp: sp, + checkHistogram: telemetry.NewHistogram(internal.Meter, "check", "amount", "Number of checks"), + + lookupEntityHistogram: telemetry.NewHistogram(internal.Meter, "lookup_entity", "amount", "Number of lookup entity"), + lookupSubjectHistogram: telemetry.NewHistogram(internal.Meter, "lookup_subject", "amount", "Number of lookup subject"), + subjectPermissionHistogram: telemetry.NewHistogram(internal.Meter, "subject_permission", "amount", "Number of subject permission"), } } @@ -120,8 +111,13 @@ func (invoker *DirectInvoker) Check(ctx context.Context, request *base.Permissio attribute.KeyValue{Key: "subject", Value: attribute.StringValue(tuple.SubjectToString(request.GetSubject()))}, )) defer span.End() - - start := time.Now() + invoker.checkHistogram.Record(ctx, 1, + metric.WithAttributeSet( + attribute.NewSet( + attribute.KeyValue{Key: "subject_id", Value: attribute.StringValue(request.GetSubject().GetId())}, + attribute.KeyValue{Key: "subject_type", Value: attribute.StringValue(request.GetSubject().GetType())}, + )), + ) // Validate the depth of the request. err = checkDepth(request) @@ -186,15 +182,10 @@ func (invoker *DirectInvoker) Check(ctx context.Context, request *base.Permissio }, }, err } - duration := time.Since(start) - invoker.checkDurationHistogram.Record(ctx, duration.Microseconds()) // increaseCheckCount increments the CheckCount value in the response metadata by 1. atomic.AddInt32(&response.GetMetadata().CheckCount, +1) - // Increase the check count in the metrics. - invoker.checkCounter.Add(ctx, 1) - span.SetAttributes(attribute.KeyValue{Key: "can", Value: attribute.StringValue(response.GetCan().String())}) return } @@ -245,8 +236,6 @@ func (invoker *DirectInvoker) LookupEntity(ctx context.Context, request *base.Pe )) defer span.End() - start := time.Now() - // Set SnapToken if not provided if request.GetMetadata().GetSnapToken() == "" { // Check if the request has a SnapToken. var st token.SnapToken @@ -271,11 +260,7 @@ func (invoker *DirectInvoker) LookupEntity(ctx context.Context, request *base.Pe resp, err := invoker.lo.LookupEntity(ctx, request) - duration := time.Since(start) - invoker.lookupEntityDurationHistogram.Record(ctx, duration.Microseconds()) - - // Increase the lookup entity count in the metrics. - invoker.lookupEntityCounter.Add(ctx, 1) + invoker.lookupEntityHistogram.Record(ctx, 1) return resp, err } @@ -292,8 +277,6 @@ func (invoker *DirectInvoker) LookupEntityStream(ctx context.Context, request *b )) defer span.End() - start := time.Now() - // Set SnapToken if not provided if request.GetMetadata().GetSnapToken() == "" { // Check if the request has a SnapToken. var st token.SnapToken @@ -318,11 +301,7 @@ func (invoker *DirectInvoker) LookupEntityStream(ctx context.Context, request *b resp := invoker.lo.LookupEntityStream(ctx, request, server) - duration := time.Since(start) - invoker.lookupEntityDurationHistogram.Record(ctx, duration.Microseconds()) - - // Increase the lookup entity count in the metrics. - invoker.lookupEntityCounter.Add(ctx, 1) + invoker.lookupEntityHistogram.Record(ctx, 1) return resp } @@ -338,8 +317,6 @@ func (invoker *DirectInvoker) LookupSubject(ctx context.Context, request *base.P )) defer span.End() - start := time.Now() - // Check if the request has a SnapToken. If not, a SnapToken is set. if request.GetMetadata().GetSnapToken() == "" { // Create an instance of SnapToken @@ -370,11 +347,7 @@ func (invoker *DirectInvoker) LookupSubject(ctx context.Context, request *base.P resp, err := invoker.lo.LookupSubject(ctx, request) - duration := time.Now().Sub(start) - invoker.lookupSubjectDurationHistogram.Record(ctx, duration.Microseconds()) - - // Increase the lookup subject count in the metrics. - invoker.lookupSubjectCounter.Add(ctx, 1) + invoker.lookupSubjectHistogram.Record(ctx, 1) // Call the LookupSubject function of the ls field in the invoker, pass the context and request, // and return its response and error @@ -391,8 +364,6 @@ func (invoker *DirectInvoker) SubjectPermission(ctx context.Context, request *ba )) defer span.End() - start := time.Now() - // Check if the request has a SnapToken. If not, a SnapToken is set. if request.GetMetadata().GetSnapToken() == "" { // Create an instance of SnapToken @@ -422,11 +393,7 @@ func (invoker *DirectInvoker) SubjectPermission(ctx context.Context, request *ba } resp, err := invoker.sp.SubjectPermission(ctx, request) - duration := time.Now().Sub(start) - invoker.subjectPermissionDurationHistogram.Record(ctx, duration.Microseconds()) - - // Increase the subject permission count in the metrics. - invoker.subjectPermissionCounter.Add(ctx, 1) + invoker.subjectPermissionHistogram.Record(ctx, 1) // Call the SubjectPermission function of the ls field in the invoker, pass the context and request, // and return its response and error diff --git a/internal/servers/dataServer.go b/internal/servers/dataServer.go index d1ee0b164..33e678a9f 100644 --- a/internal/servers/dataServer.go +++ b/internal/servers/dataServer.go @@ -2,7 +2,6 @@ package servers import ( "log/slog" - "time" otelCodes "go.opentelemetry.io/otel/codes" api "go.opentelemetry.io/otel/metric" @@ -48,13 +47,13 @@ func NewDataServer( dw: dw, br: br, sr: sr, - writeDataHistogram: telemetry.NewHistogram(internal.Meter, "write_data", "microseconds", "Duration of writing data in microseconds"), - deleteDataHistogram: telemetry.NewHistogram(internal.Meter, "delete_data", "microseconds", "Duration of deleting data in microseconds"), - readAttributesHistogram: telemetry.NewHistogram(internal.Meter, "read_attributes", "microseconds", "Duration of reading attributes in microseconds"), - readRelationshipsHistogram: telemetry.NewHistogram(internal.Meter, "read_relationships", "microseconds", "Duration of reading relationships in microseconds"), - writeRelationshipsHistogram: telemetry.NewHistogram(internal.Meter, "write_relationships", "microseconds", "Duration of writing relationships in microseconds"), - deleteRelationshipsHistogram: telemetry.NewHistogram(internal.Meter, "delete_relationships", "microseconds", "Duration of deleting relationships in microseconds"), - runBundleHistogram: telemetry.NewHistogram(internal.Meter, "delete_relationships", "run_bundle", "Duration of running bunble in microseconds"), + writeDataHistogram: telemetry.NewHistogram(internal.Meter, "write_data", "amount", "Number of writing data"), + deleteDataHistogram: telemetry.NewHistogram(internal.Meter, "delete_data", "amount", "Number of deleting data"), + readAttributesHistogram: telemetry.NewHistogram(internal.Meter, "read_attributes", "amount", "Number of reading attributes"), + readRelationshipsHistogram: telemetry.NewHistogram(internal.Meter, "read_relationships", "amount", "Number of reading relationships"), + writeRelationshipsHistogram: telemetry.NewHistogram(internal.Meter, "write_relationships", "amount", "Number of writing relationships"), + deleteRelationshipsHistogram: telemetry.NewHistogram(internal.Meter, "delete_relationships", "amount", "Number of deleting relationships"), + runBundleHistogram: telemetry.NewHistogram(internal.Meter, "run_bundle", "amount", "Number of running bunble"), } } @@ -62,7 +61,6 @@ func NewDataServer( func (r *DataServer) ReadRelationships(ctx context.Context, request *v1.RelationshipReadRequest) (*v1.RelationshipReadResponse, error) { ctx, span := internal.Tracer.Start(ctx, "data.read.relationships") defer span.End() - start := time.Now() size := request.GetPageSize() if size == 0 { @@ -100,8 +98,7 @@ func (r *DataServer) ReadRelationships(ctx context.Context, request *v1.Relation return nil, status.Error(GetStatus(err), err.Error()) } - duration := time.Since(start) - r.readRelationshipsHistogram.Record(ctx, duration.Microseconds()) + r.readRelationshipsHistogram.Record(ctx, 1) return &v1.RelationshipReadResponse{ Tuples: collection.GetTuples(), @@ -113,7 +110,6 @@ func (r *DataServer) ReadRelationships(ctx context.Context, request *v1.Relation func (r *DataServer) ReadAttributes(ctx context.Context, request *v1.AttributeReadRequest) (*v1.AttributeReadResponse, error) { ctx, span := internal.Tracer.Start(ctx, "data.read.attributes") defer span.End() - start := time.Now() size := request.GetPageSize() if size == 0 { @@ -151,8 +147,7 @@ func (r *DataServer) ReadAttributes(ctx context.Context, request *v1.AttributeRe return nil, status.Error(GetStatus(err), err.Error()) } - duration := time.Since(start) - r.readAttributesHistogram.Record(ctx, duration.Microseconds()) + r.readAttributesHistogram.Record(ctx, 1) return &v1.AttributeReadResponse{ Attributes: collection.GetAttributes(), @@ -164,7 +159,6 @@ func (r *DataServer) ReadAttributes(ctx context.Context, request *v1.AttributeRe func (r *DataServer) Write(ctx context.Context, request *v1.DataWriteRequest) (*v1.DataWriteResponse, error) { ctx, span := internal.Tracer.Start(ctx, "data.write") defer span.End() - start := time.Now() v := request.Validate() if v != nil { @@ -251,8 +245,7 @@ func (r *DataServer) Write(ctx context.Context, request *v1.DataWriteRequest) (* return nil, status.Error(GetStatus(err), err.Error()) } - duration := time.Since(start) - r.writeDataHistogram.Record(ctx, duration.Microseconds()) + r.writeDataHistogram.Record(ctx, 1) return &v1.DataWriteResponse{ SnapToken: snap.String(), @@ -263,7 +256,6 @@ func (r *DataServer) Write(ctx context.Context, request *v1.DataWriteRequest) (* func (r *DataServer) WriteRelationships(ctx context.Context, request *v1.RelationshipWriteRequest) (*v1.RelationshipWriteResponse, error) { ctx, span := internal.Tracer.Start(ctx, "relationships.write") defer span.End() - start := time.Now() v := request.Validate() if v != nil { @@ -320,8 +312,7 @@ func (r *DataServer) WriteRelationships(ctx context.Context, request *v1.Relatio return nil, status.Error(GetStatus(err), err.Error()) } - duration := time.Now().Sub(start) - r.writeRelationshipsHistogram.Record(ctx, duration.Microseconds()) + r.writeRelationshipsHistogram.Record(ctx, 1) return &v1.RelationshipWriteResponse{ SnapToken: snap.String(), @@ -332,7 +323,6 @@ func (r *DataServer) WriteRelationships(ctx context.Context, request *v1.Relatio func (r *DataServer) Delete(ctx context.Context, request *v1.DataDeleteRequest) (*v1.DataDeleteResponse, error) { ctx, span := internal.Tracer.Start(ctx, "data.delete") defer span.End() - start := time.Now() v := request.Validate() if v != nil { @@ -352,8 +342,7 @@ func (r *DataServer) Delete(ctx context.Context, request *v1.DataDeleteRequest) return nil, status.Error(GetStatus(err), err.Error()) } - duration := time.Now().Sub(start) - r.deleteDataHistogram.Record(ctx, duration.Microseconds()) + r.deleteDataHistogram.Record(ctx, 1) return &v1.DataDeleteResponse{ SnapToken: snap.String(), @@ -364,7 +353,6 @@ func (r *DataServer) Delete(ctx context.Context, request *v1.DataDeleteRequest) func (r *DataServer) DeleteRelationships(ctx context.Context, request *v1.RelationshipDeleteRequest) (*v1.RelationshipDeleteResponse, error) { ctx, span := internal.Tracer.Start(ctx, "relationships.delete") defer span.End() - start := time.Now() v := request.Validate() if v != nil { @@ -384,8 +372,7 @@ func (r *DataServer) DeleteRelationships(ctx context.Context, request *v1.Relati return nil, status.Error(GetStatus(err), err.Error()) } - duration := time.Now().Sub(start) - r.deleteRelationshipsHistogram.Record(ctx, duration.Microseconds()) + r.deleteRelationshipsHistogram.Record(ctx, 1) return &v1.RelationshipDeleteResponse{ SnapToken: snap.String(), @@ -396,7 +383,6 @@ func (r *DataServer) DeleteRelationships(ctx context.Context, request *v1.Relati func (r *DataServer) RunBundle(ctx context.Context, request *v1.BundleRunRequest) (*v1.BundleRunResponse, error) { ctx, span := internal.Tracer.Start(ctx, "bundle.run") defer span.End() - start := time.Now() v := request.Validate() if v != nil { @@ -424,8 +410,7 @@ func (r *DataServer) RunBundle(ctx context.Context, request *v1.BundleRunRequest return nil, status.Error(GetStatus(err), err.Error()) } - duration := time.Now().Sub(start) - r.runBundleHistogram.Record(ctx, duration.Microseconds()) + r.runBundleHistogram.Record(ctx, 1) return &v1.BundleRunResponse{ SnapToken: snap.String(), diff --git a/internal/servers/schemaServer.go b/internal/servers/schemaServer.go index 46a512965..b22edf848 100644 --- a/internal/servers/schemaServer.go +++ b/internal/servers/schemaServer.go @@ -3,7 +3,6 @@ package servers import ( "log/slog" "strings" - "time" "github.com/rs/xid" api "go.opentelemetry.io/otel/metric" @@ -37,9 +36,9 @@ func NewSchemaServer(sw storage.SchemaWriter, sr storage.SchemaReader) *SchemaSe return &SchemaServer{ sw: sw, sr: sr, - writeSchemaHistogram: telemetry.NewHistogram(internal.Meter, "write_schema", "microseconds", "Duration of writing schema in microseconds"), - readSchemaHistogram: telemetry.NewHistogram(internal.Meter, "read_schema", "microseconds", "Duration of reading schema in microseconds"), - listSchemaHistogram: telemetry.NewHistogram(internal.Meter, "list_schema", "microseconds", "Duration of listing schema in microseconds"), + writeSchemaHistogram: telemetry.NewHistogram(internal.Meter, "write_schema", "amount", "Number of writing schema in"), + readSchemaHistogram: telemetry.NewHistogram(internal.Meter, "read_schema", "amount", "Number of reading schema"), + listSchemaHistogram: telemetry.NewHistogram(internal.Meter, "list_schema", "amount", "Number of listing schema"), } } @@ -47,7 +46,6 @@ func NewSchemaServer(sw storage.SchemaWriter, sr storage.SchemaReader) *SchemaSe func (r *SchemaServer) Write(ctx context.Context, request *v1.SchemaWriteRequest) (*v1.SchemaWriteResponse, error) { ctx, span := internal.Tracer.Start(ctx, "schemas.write") defer span.End() - start := time.Now() sch, err := parser.NewParser(request.GetSchema()).Parse() if err != nil { @@ -83,8 +81,7 @@ func (r *SchemaServer) Write(ctx context.Context, request *v1.SchemaWriteRequest return nil, status.Error(GetStatus(err), err.Error()) } - duration := time.Now().Sub(start) - r.writeSchemaHistogram.Record(ctx, duration.Microseconds()) + r.writeSchemaHistogram.Record(ctx, 1) return &v1.SchemaWriteResponse{ SchemaVersion: version, @@ -206,7 +203,6 @@ func (r *SchemaServer) PartialWrite(ctx context.Context, request *v1.SchemaParti func (r *SchemaServer) Read(ctx context.Context, request *v1.SchemaReadRequest) (*v1.SchemaReadResponse, error) { ctx, span := internal.Tracer.Start(ctx, "schemas.read") defer span.End() - start := time.Now() version := request.GetMetadata().GetSchemaVersion() if version == "" { @@ -225,8 +221,7 @@ func (r *SchemaServer) Read(ctx context.Context, request *v1.SchemaReadRequest) return nil, status.Error(GetStatus(err), err.Error()) } - duration := time.Now().Sub(start) - r.readSchemaHistogram.Record(ctx, duration.Microseconds()) + r.readSchemaHistogram.Record(ctx, 1) return &v1.SchemaReadResponse{ Schema: response, @@ -237,7 +232,6 @@ func (r *SchemaServer) Read(ctx context.Context, request *v1.SchemaReadRequest) func (r *SchemaServer) List(ctx context.Context, request *v1.SchemaListRequest) (*v1.SchemaListResponse, error) { ctx, span := internal.Tracer.Start(ctx, "schemas.list") defer span.End() - start := time.Now() schemas, ct, err := r.sr.ListSchemas(ctx, request.GetTenantId(), database.NewPagination(database.Size(request.GetPageSize()), database.Token(request.GetContinuousToken()))) if err != nil { @@ -252,8 +246,7 @@ func (r *SchemaServer) List(ctx context.Context, request *v1.SchemaListRequest) return nil, status.Error(GetStatus(err), err.Error()) } - duration := time.Now().Sub(start) - r.listSchemaHistogram.Record(ctx, duration.Microseconds()) + r.listSchemaHistogram.Record(ctx, 1) return &v1.SchemaListResponse{ Head: head, diff --git a/pkg/pb/base/v1/openapi.pb.go b/pkg/pb/base/v1/openapi.pb.go index 591ef4f4e..6c842e832 100644 --- a/pkg/pb/base/v1/openapi.pb.go +++ b/pkg/pb/base/v1/openapi.pb.go @@ -46,7 +46,7 @@ var file_base_v1_openapi_proto_rawDesc = []byte{ 0x2f, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x66, 0x79, 0x2f, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x66, 0x79, 0x2f, 0x62, 0x6c, 0x6f, 0x62, 0x2f, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x2f, 0x4c, 0x49, 0x43, 0x45, 0x4e, 0x53, 0x45, - 0x32, 0x06, 0x76, 0x31, 0x2e, 0x31, 0x2e, 0x39, 0x2a, 0x01, 0x02, 0x32, 0x10, 0x61, 0x70, 0x70, + 0x32, 0x06, 0x76, 0x31, 0x2e, 0x32, 0x2e, 0x30, 0x2a, 0x01, 0x02, 0x32, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x5a, 0x23, 0x0a, 0x21, 0x0a, 0x0a, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x41, 0x75, 0x74, 0x68, 0x12, diff --git a/proto/base/v1/openapi.proto b/proto/base/v1/openapi.proto index d716be833..10904f47b 100644 --- a/proto/base/v1/openapi.proto +++ b/proto/base/v1/openapi.proto @@ -9,7 +9,7 @@ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: { title: "Permify API"; description: "Permify is an open source authorization service for creating fine-grained and scalable authorization systems."; - version: "v1.1.9"; + version: "v1.2.0"; contact: { name: "API Support"; url: "https://github.com/Permify/permify/issues";