influxdata / influxdata/telegraf

sqlserver input: change statement_text from a tag to a field

Open
#6,976 23 comments 0 reactions 0 assignees View on GitHub
area/sqlserver feature request
Dominant language
Go
Stars
17.8k
Forks
5.8k
Avg merge
1d 20h
Merged PRs (30d)
161

Description

### Relevant telegraf.conf:
default sqlserver setup, query_version=2

### System info:

Telegraf 1.13.2 for Ubuntu
SQL Server 2017 server

### Steps to reproduce:

1. Configure Telegraf to connect to mssql server with default settings
2. Examine the data stored in measurement sqlserver_requests, tag statement_text

### Expected behavior:

data to be stored without escape characters, for example:
`select @par = parfrom [server].[db].dbo.table where id = @p_par_id and ([dbid] = @p_db_id or [db_id] = 0 `

### Actual behavior:

data is stored with \n, \t, \r characters:
`select @par = par\r\n\t\tfrom [server].[db].dbo.table\r\n\t\twhere id = @p_par_id and \r\n\t\t\t([dbid] = @p_db_id or [db_id] = 0
`

Contributor guide

Open the contributing guide

Research direction

Start at the Telegraf SQL Server input and trace how the sqlserver_requests measurement records statement_text. Compare the current tag output with the requested field representation, then verify that statement_text is stored without escaped newline, tab, and carriage-return characters.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, sql
Domain
databases
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.