Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 67AA1200C52 for ; Mon, 10 Apr 2017 21:09:16 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 66382160B99; Mon, 10 Apr 2017 19:09:16 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id ADF79160B7F for ; Mon, 10 Apr 2017 21:09:15 +0200 (CEST) Received: (qmail 49271 invoked by uid 500); 10 Apr 2017 19:09:14 -0000 Mailing-List: contact dev-help@brooklyn.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@brooklyn.apache.org Delivered-To: mailing list dev@brooklyn.apache.org Received: (qmail 49260 invoked by uid 99); 10 Apr 2017 19:09:14 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Apr 2017 19:09:14 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 6BCD2DFDAC; Mon, 10 Apr 2017 19:09:14 +0000 (UTC) From: mikezaccardo To: dev@brooklyn.apache.org Reply-To: dev@brooklyn.apache.org References: In-Reply-To: Subject: [GitHub] brooklyn-docs pull request #160: Add separate enrichers page and combine pol... Content-Type: text/plain Message-Id: <20170410190914.6BCD2DFDAC@git1-us-west.apache.org> Date: Mon, 10 Apr 2017 19:09:14 +0000 (UTC) archived-at: Mon, 10 Apr 2017 19:09:16 -0000 Github user mikezaccardo commented on a diff in the pull request: https://github.com/apache/brooklyn-docs/pull/160#discussion_r110738621 --- Diff: guide/java/enrichers.md --- @@ -0,0 +1,150 @@ +--- +title: Enrichers +layout: website-normal +toc: ../guide_toc.json +categories: [use, guide, defining-applications] +--- + +Enrichers provide advanced manipulation of an entity's sensor values. + +#### Transformer + +- org.apache.brooklyn.enricher.stock.Transformer + +Transforms attributes of an entity. + +{% highlight yaml %} +brooklyn.enrichers: +- type: org.apache.brooklyn.enricher.stock.Transformer + brooklyn.config: + enricher.sourceSensor: $brooklyn:sensor("urls.tcp.string") + enricher.targetSensor: $brooklyn:sensor("urls.tcp.withBrackets") + enricher.targetValue: $brooklyn:formatString("[%s]", $brooklyn:attributeWhenReady("urls.tcp.string")) +{% endhighlight %} + +#### Propagator + +- org.apache.brooklyn.enricher.stock.Propagator + +Use propagator to duplicate one sensor as another, giving the supplied sensor mapping. +The other use of Propagator is where you specify a producer (using `$brooklyn:entity(...)` as below) +from which to take sensors; in that mode you can specify `propagate` as a list of sensors whose names are unchanged, +instead of (or in addition to) this map + +{% highlight yaml %} +brooklyn.enrichers: +- type: org.apache.brooklyn.enricher.stock.Propagator + brooklyn.config: + producer: $brooklyn:entity("cluster") +- type: org.apache.brooklyn.enricher.stock.Propagator + brooklyn.config: + sensorMapping: + $brooklyn:sensor("url"): $brooklyn:sensor("org.apache.brooklyn.core.entity.Attributes", "main.uri") +{% endhighlight %} + +#### Custom Aggregating + +- org.apache.brooklyn.enricher.stock.Aggregator + +Aggregates multiple sensor values (usually across a tier, esp. a cluster) and performs a supplied aggregation method to them to return an aggregate figure, e.g. sum, mean, median, etc. + +{% highlight yaml %} +brooklyn.enrichers: +- type: org.apache.brooklyn.enricher.stock.Aggregator + brooklyn.config: + enricher.sourceSensor: $brooklyn:sensor("webapp.reqs.perSec.windowed") + enricher.targetSensor: $brooklyn:sensor("webapp.reqs.perSec.perNode") + enricher.aggregating.fromMembers: true + transformation: average +{% endhighlight %} + +#### Joiner + +- org.apache.brooklyn.enricher.stock.Joiner + +Joins a sensor whose output is a list into a single item joined by a separator. + +{% highlight yaml %} +brooklyn.enrichers: +- type: org.apache.brooklyn.enricher.stock.Joiner + brooklyn.config: + enricher.sourceSensor: $brooklyn:sensor("urls.tcp.list") + enricher.targetSensor: $brooklyn:sensor("urls.tcp.string") + uniqueTag: urls.quoted.string +{% endhighlight %} + +#### Delta Enricher + +- org.apache.brooklyn.policy.enricher.Delta Enricher + +Converts absolute sensor values into a delta. + +#### Time-weighted Delta + +- org.apache.brooklyn.enricher.stock.YamlTimeWeightedDeltaEnricher + +Converts absolute sensor values into a delta/second. + +{% highlight yaml %} +brooklyn.enrichers: +- type: org.apache.brooklyn.enricher.stock.YamlTimeWeightedDeltaEnricher + brooklyn.config: + enricher.sourceSensor: reqs.count + enricher.targetSensor: reqs.per_sec + enricher.delta.period: 1s +{% endhighlight %} + +#### Rolling Mean + +- org.apache.brooklyn.policy.enricher.RollingMeanEnricher + +Converts the last *N* sensor values into a mean. --- End diff -- TODO --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. ---