influxdata / influxdata/kapacitor

String concatenation not working in template tasks

Open
#1,406 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
2.4k
Forks
479
Avg merge
4d 16h
Merged PRs (30d)
4

Description

I'm facing some issue in template task.

Below is the template.tick
```
var client string
var app string
var page string

batch
|query('select sum(responseTime)/1000, count(responseTime) from test.autogen.pagedata where client= "' + client + '" and app= "' + app + '" and page=~ /"' + page + '"/')
.period(10m)
.every(1m)
.groupBy(time(1m),'client','app')
.fill('none')
|influxDBOut()
.database('test')
.retentionPolicy('autogen')
.measurement('test1')

```

Below is my template.json
```
{
"client": {"type" : "string", "value" : "QkBank" },
"app": {"type" : "string", "value" : "New Age Retail Banking" },
"page": {"type" : "string", "value" : "Page 1|Page 2" }
}
```

And, below is the template & task define commands
```
kapacitor define-template template -tick template.tick -type batch
kapacitor define template -template-id template -vars template.json -dbrp test.autogen
```
I'm not getting any error nor any compile issues however the output is nothing for this.
Below is the `kapacitor show template` command's output

> ID: template
> Error:
> Template: template
> Type: batch
> Status: enabled
> Executing: true
> Created: 24 May 17 12:06 UTC
> Modified: 25 May 17 05:36 UTC
> LastEnabled: 25 May 17 05:36 UTC
> Databases Retention Policies: ["test"."autogen"]
> TICKscript:
> var client string
>
> var app string
>
> var page string
>
> batch
> |query('select sum(responseTime)/1000, count(responseTime) from test.autogen.pagedata where client= "' + client + '" and app= "' + app + '" and page=~ /"' + page + '"/')
> .period(10m)
> .every(1m)
> .groupBy(time(1m), 'client', 'app')
> .fill('none')
> |influxDBOut()
> .database('test')
> .retentionPolicy('autogen')
> .measurement('test1')
>
> Vars:
> Name Type Value
> app string New Age Retail Banking
> client string QkBank
> page string Home Page|Login Page
> DOT:
> digraph template {
> graph [throughput="0.00 batches/s"];
>
> query1 [avg_exec_time_ns="16.712092ms" batches_queried="0" points_queried="0" query_errors="0" ];
> query1 -> influxdb_out2 [processed="0"];
>
> influxdb_out2 [avg_exec_time_ns="0s" points_written="0" write_errors="0" ];
> }
>

Could you please verify my tick template script is correct or any syntax issues.

Contributor guide

Open the contributing guide

Research direction

Start with template.tick and template.json, then review the kapacitor define-template and define commands used in the report. Reproduce the batch task and inspect whether the rendered query contains the supplied variables and returns points. Done means the template executes successfully and writes the expected results to test.autogen.test1.

Written by the indexing model from the issue text.

Assessment

Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.