Skip to content

Commit

Permalink
Fix some Telemetry.EXISTS-KEY issues
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Nov 29, 2017
1 parent 9179854 commit f3b1289
Showing 1 changed file with 25 additions and 9 deletions.
34 changes: 25 additions & 9 deletions lib/Telemetry.pm6
Expand Up @@ -204,7 +204,9 @@ HEADER
)($!data)
}

method EXISTS-KEY(Str:D $key) { nqp::existskey($dispatch,$key) }
method EXISTS-KEY(Str:D $key) {
nqp::p6bool(nqp::existskey($dispatch,$key))
}

method !snap() is raw {
nqp::stmts(
Expand Down Expand Up @@ -267,7 +269,9 @@ HEADER
)($!data)
}

method EXISTS-KEY(Str:D $key) { nqp::existskey($dispatch,$key) }
method EXISTS-KEY(Str:D $key) {
nqp::p6bool(nqp::existskey($dispatch,$key))
}

method !snap() is raw { Thread.usage }
}
Expand Down Expand Up @@ -344,7 +348,9 @@ class Telemetry::Instrument::ThreadPool does Telemetry::Instrument {
)($!data)
}

method EXISTS-KEY(Str:D $key) { nqp::existskey($dispatch,$key) }
method EXISTS-KEY(Str:D $key) {
nqp::p6bool(nqp::existskey($dispatch,$key))
}

method !snap() is raw {
$*SCHEDULER ?? $*SCHEDULER.usage !! ThreadPoolScheduler.usage
Expand Down Expand Up @@ -416,22 +422,23 @@ class Telemetry::Instrument::AdHoc does Telemetry::Instrument {
}

method AT-KEY(Str:D $key) {
my $i := $!instrument;
nqp::ifnull(
nqp::atkey(
nqp::getattr(
$i,Telemetry::Instrument::AdHoc,'$!dispatch'),
$!instrument,Telemetry::Instrument::AdHoc,'$!dispatch'),
$key
),
-> Mu \data { Nil }
)($!data)
}

method EXISTS-KEY(Str:D $key) {
nqp::existskey(
nqp::getattr(
$!instrument,Telemetry::Instrument::AdHoc,'$!dispatch'),
$key
nqp::p6bool(
nqp::existskey(
nqp::getattr(
$!instrument,Telemetry::Instrument::AdHoc,'$!dispatch'),
$key
)
)
}

Expand Down Expand Up @@ -609,6 +616,15 @@ class Telemetry does Associative {
)($!samples)
}

method EXISTS-KEY($key) {
nqp::p6bool(
nqp::existskey(
nqp::getattr($!sampler,Telemetry::Sampler,'$!dispatcher'),
$key
)
)
}

method FALLBACK(Telemetry:D: $method) is raw {
self.AT-KEY($method)
// X::Method::NotFound.new(:$method,:typename(self.^name)).throw
Expand Down

0 comments on commit f3b1289

Please sign in to comment.