fix: small improvements
This commit is contained in:
parent
8343ebd635
commit
45e37dfda7
4 changed files with 18 additions and 30 deletions
|
|
@ -443,18 +443,14 @@ sub get_ssl_socket {
|
||||||
sub get_attr {
|
sub get_attr {
|
||||||
my($attr, $type, $obj) = @_;
|
my($attr, $type, $obj) = @_;
|
||||||
|
|
||||||
for (keys %{$obj}) {
|
my ($res) = grep {
|
||||||
if ($_ =~ /^attribute\d+/) {
|
$_ =~ /^attribute\d+/ && $$obj{$_}{key} eq '"' . $attr . '"'
|
||||||
if ($$obj{$_}{key} eq '"' . $attr . '"') {
|
} keys %{$obj};
|
||||||
if ($type eq 'string_value') {
|
|
||||||
$$obj{$_}{value}{$type} =~ s/(^\")|(\"$)//g;
|
|
||||||
}
|
|
||||||
return $$obj{$_}{value}{$type}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return undef;
|
$$obj{$res}{value}{$type} =~ s/(^\")|(\"$)//g
|
||||||
|
if $res && $type eq 'string_value';
|
||||||
|
|
||||||
|
return $$obj{$res}{value}{$type};
|
||||||
}
|
}
|
||||||
|
|
||||||
sub decode_protobuf {
|
sub decode_protobuf {
|
||||||
|
|
|
||||||
|
|
@ -449,11 +449,9 @@ sub get_ssl_socket {
|
||||||
sub get_attr {
|
sub get_attr {
|
||||||
my($attr, $type, $obj) = @_;
|
my($attr, $type, $obj) = @_;
|
||||||
|
|
||||||
for (@{$$obj{"attributes"}}) {
|
my ($res) = grep { $$_{"key"} eq $attr } @{$$obj{"attributes"}};
|
||||||
return $$_{"value"}{$type} if ($$_{"key"} eq $attr);
|
|
||||||
}
|
|
||||||
|
|
||||||
return undef;
|
return $res->{"value"}{$type};
|
||||||
}
|
}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
|
||||||
18
tests/otel.t
18
tests/otel.t
|
|
@ -390,18 +390,14 @@ sub get_ssl_socket {
|
||||||
sub get_attr {
|
sub get_attr {
|
||||||
my($attr, $type, $obj) = @_;
|
my($attr, $type, $obj) = @_;
|
||||||
|
|
||||||
for (keys %{$obj}) {
|
my ($res) = grep {
|
||||||
if ($_ =~ /^attribute\d+/) {
|
$_ =~ /^attribute\d+/ && $$obj{$_}{key} eq '"' . $attr . '"'
|
||||||
if ($$obj{$_}{key} eq '"' . $attr . '"') {
|
} keys %{$obj};
|
||||||
if ($type eq 'string_value') {
|
|
||||||
$$obj{$_}{value}{$type} =~ s/(^\")|(\"$)//g;
|
|
||||||
}
|
|
||||||
return $$obj{$_}{value}{$type}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return undef;
|
$$obj{$res}{value}{$type} =~ s/(^\")|(\"$)//g
|
||||||
|
if $res && $type eq 'string_value';
|
||||||
|
|
||||||
|
return $$obj{$res}{value}{$type};
|
||||||
}
|
}
|
||||||
|
|
||||||
sub decode_protobuf {
|
sub decode_protobuf {
|
||||||
|
|
|
||||||
|
|
@ -394,11 +394,9 @@ sub get_ssl_socket {
|
||||||
sub get_attr {
|
sub get_attr {
|
||||||
my($attr, $type, $obj) = @_;
|
my($attr, $type, $obj) = @_;
|
||||||
|
|
||||||
for (@{$$obj{"attributes"}}) {
|
my ($res) = grep { $$_{"key"} eq $attr } @{$$obj{"attributes"}};
|
||||||
return $$_{"value"}{$type} if ($$_{"key"} eq $attr);
|
|
||||||
}
|
|
||||||
|
|
||||||
return undef;
|
return $res->{"value"}{$type};
|
||||||
}
|
}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue