From 31a11b4c37e38c1c3516a8f5a0c8d8635441f011 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Thu, 21 Nov 2024 11:34:52 -0500 Subject: [PATCH] types --- lib/datadog/di/serializer.rb | 3 ++- sig/datadog/di/probe.rbs | 6 +++++- sig/datadog/di/serializer.rbs | 8 ++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/datadog/di/serializer.rb b/lib/datadog/di/serializer.rb index 0e231f88e51..953e6ec7205 100644 --- a/lib/datadog/di/serializer.rb +++ b/lib/datadog/di/serializer.rb @@ -121,8 +121,9 @@ def serialize_vars(vars, # Respects string length, collection size and traversal depth limits. def serialize_value(value, name: nil, depth: settings.dynamic_instrumentation.max_capture_depth, - attribute_count: settings.dynamic_instrumentation.max_capture_attribute_count, + attribute_count: nil, type: nil) + attribute_count ||= settings.dynamic_instrumentation.max_capture_attribute_count cls = type || value.class begin if redactor.redact_type?(value) diff --git a/sig/datadog/di/probe.rbs b/sig/datadog/di/probe.rbs index d492b650414..39db4113751 100644 --- a/sig/datadog/di/probe.rbs +++ b/sig/datadog/di/probe.rbs @@ -22,7 +22,7 @@ module Datadog @rate_limiter: Datadog::Core::RateLimiter def initialize: (id: String, type: Symbol, ?file: String?, ?line_no: Integer?, ?type_name: String?, ?method_name: String?, ?template: String?, ?capture_snapshot: bool, - ?max_capture_depth: Integer, ?rate_limit: Integer) -> void + ?max_capture_depth: Integer, ?max_capture_attribute_count: Integer?, ?rate_limit: Integer) -> void attr_reader id: String @@ -35,6 +35,10 @@ module Datadog attr_reader type_name: String? attr_reader method_name: String? + + attr_reader max_capture_depth: Integer? + + attr_reader max_capture_attribute_count: Integer? attr_reader template: String attr_reader rate_limiter: Datadog::Core::RateLimiter diff --git a/sig/datadog/di/serializer.rbs b/sig/datadog/di/serializer.rbs index acaacece168..733501ff328 100644 --- a/sig/datadog/di/serializer.rbs +++ b/sig/datadog/di/serializer.rbs @@ -15,12 +15,12 @@ module Datadog attr_reader telemetry: Core::Telemetry::Component - def serialize_args: (untyped args, untyped kwargs) -> untyped - def serialize_vars: (untyped vars) -> untyped - def serialize_value: (untyped value, ?name: String, ?depth: Integer) -> untyped + def serialize_args: (untyped args, untyped kwargs, ?depth: Integer, ?attribute_count: Integer?) -> untyped + def serialize_vars: (untyped vars, ?depth: Integer, ?attribute_count: Integer?) -> untyped + def serialize_value: (untyped value, ?name: String, ?depth: Integer, ?attribute_count: Integer?) -> untyped def self.register: (?condition: Proc) { - (serializer: Serializer, value: untyped, name: Symbol, depth: Integer) -> untyped } -> void + (serializer: Serializer, value: untyped, name: Symbol, depth: Integer, ?attribute_count: Integer?) -> untyped } -> void private def class_name: (untyped cls) -> untyped