pipeline: threads: 20 processors: - mapping: 'root = {}' - workflow: meta_path: results order: [ [ dockerhub, github, homebrew ] ] processor_resources: - label: dockerhub branch: request_map: 'root = ""' processors: - try: # Grab docker dl count - http: url: https://hub.docker.com/v2/repositories/jeffail/benthos/ verb: GET retries: 0 headers: Content-Type: application/json - mapping: | root.source = "docker" root.dist = "docker" root.download_count = this.pull_count root.version = "all" - resource: metric_gauge - label: github branch: request_map: 'root = ""' processors: - try: # Grab github latest release dl count - http: url: https://api.github.com/repos/redpanda-data/benthos/releases verb: GET retries: 0 - mapping: | root = this.map_each(release -> release.assets.map_each(asset -> { "source": "github", "dist": asset.name.re_replace_all("^benthos-?((lambda_)|_)[0-9\\.]+(-rc[0-9]+)?_([^\\.]+).*", "$2$4"), "download_count": asset.download_count, "version": release.tag_name.trim("v"), }).filter(asset -> asset.dist != "checksums")).flatten() - unarchive: format: json_array - resource: metric_gauge - mapping: 'root = if batch_index() != 0 { deleted() }' - label: homebrew branch: request_map: 'root = ""' processors: - try: - http: url: https://formulae.brew.sh/api/formula/benthos.json verb: GET retries: 0 - mapping: | root.source = "homebrew" root.dist = "brew" root.download_count = this.analytics.install.30d.benthos root.version = "all" - resource: metric_gauge - label: metric_gauge metric: type: gauge name: BenthosDownloadGauge labels: dist: ${! json("dist") } source: ${! json("source") } version: ${! json("version") } value: ${! json("download_count") } metrics: mapping: | # Only emit our custom metric, and no internal Benthos metrics. root = if ![ "BenthosDownloadGauge" ].contains(this) { deleted() } aws_cloudwatch: namespace: BenthosAnalyticsStaging flush_period: 500ms region: eu-west-1