Skip to content

Commit

Permalink
feat(rules): document jfrEventTypeIds function
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores committed Dec 13, 2024
1 parent 236c2cf commit 3d9fcf2
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions guides/_subsections/create-an-automated-rule.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,20 @@ Previously, if we wanted to enable always-on `Continuous` monitoring using **JDK
}
{% endhighlight %}
</figure>
The following functions are also available in the <code>Expression</code> execution context:
<figure>
{% highlight typescript %}
/**
* @param target the target context object
* @returns a list of JFR Event Type IDs
*/
jfrEventTypeIds(target: Target): string[]
{% endhighlight %}
</figure>
See also:
<ul>
<li><a href="#view-jfr-event-types">JFR Event Types</a></li>
</ul>
<p>
The <i>alias, connectUrl, labels, annotations.platform,</i> and <i>annotations.cryostat</i> properties are all guaranteed to be present on the <code>target</code> object. <i>alias</i> and <i>connectUrl</i> will be non-empty strings. The <i>jvmId</i> is a hash string computed by Cryostat after it successfully connects to a <code>target</code> <b>JVM</b> and is used to uniquely identify that <b>JVM</b> instance - it will be empty if <b>Cryostat</b> has not yet connected to that <code>target</code> (for example, if its <a href="#add-a-trusted-certificate"><code>SSL/TLS</code> certificate is not trusted</a> or if <a href="#store-credentials"><b>Cryostat</b> is missing the required credentials</a>) The <i>labels</i> and <i>platform annotations</i> may be empty — in <b>OpenShift</b> or <b>Kubernetes</b>, these are populated from the labels and annotations applied to the <code>target</code>’s pod, if any. The <b>Cryostat</b> annotations map will vary per platform, but on <b>OpenShift</b> or <b>Kubernetes</b> you can expect the <i>HOST, PORT, NAMESPACE,</i> and <i>POD_NAME</i> keys to be present and non-empty. Take care to use the `has` or `in` operators when dealing with the <i>labels</i> and <i>annotations</i> map structures where specific keys may not exist.

Expand All @@ -105,6 +119,8 @@ has(target.annotations.cryostat.PORT) && 'io.kubernetes/annotation' in target.an
!('io.kubernetes/annotation' in target.annotations.platform)

target.alias.matches("^customer-login[0-9]\*$")

jfrEventTypeIds(target).exists(x, x.startsWith("myOrg.prefix."))
{% endhighlight %}

</figure>
Expand Down

0 comments on commit 3d9fcf2

Please # to comment.