Can I use an MSSQL Datasource for a Traces Panel

Grafana Version 9.0.2

I am trying to “fool” the traces panel into displaying data from an MSSQL query. I thought this panel would be good for displaying a MSSQL sessions blocking tree if I can reformat the data into what the panel expects.

I’ve created a dummy table in my database with the following columns:

traceID
parentSpanID
startTime
operationName
logs
warnings
references
serviceName
duration
spanID
errorIconColor
serviceTags
stackTraces
tags

I got this list from here: TraceSpanRow

The logs and references columns seem to be my main issue at the moment. For example the logs column is a type of TraceLog. I’ve tried formatting is as follows:

[
		{
			"timestamp" : "15131543651", 
			"fields" : [
					{
					"key":"1",
					"value":"2"
					},
					{
					"key":"2",
					"value":"22"
					}
				    ]
		}
		]

but get an error “n.map is not a function”.

Not sure if I’m close to cracking this or completely off the mark or its just impossible :slight_smile:

could you please provide DDL and sample DML for this table?

ddl

create table traceLogs(

dml

insert into traceLogs

or maybe even a simple fake select statement with data

select 1 as traceID, 22 parentSpanID, 23232 startTime  --etc

This is the create table statement:

CREATE TABLE [dbo].[tracesTest](
	[traceID] [varchar](20) NOT NULL,
	[parentSpanID] [varchar](20) NULL,
	[startTime] [datetime] NOT NULL,
	[operationName] [varchar](20) NULL,
	[logs] [varchar](max) NULL,
	[warnings] [varchar](20) NULL,
	[references] [varchar](20) NULL,
	[serviceName] [varchar](20) NULL,
	[duration] [numeric](18, 0) NULL,
	[spanID] [varchar](20) NULL,
	[errorIconColor] [varchar](20) NULL,
	[serviceTags] [varchar](20) NULL,
	[stackTraces] [varchar](20) NULL,
	[tags] [varchar](20) NULL,
	[combined] [varchar](max) NULL
)

I just have some dummy data in there at the moment while I try to get it to work:

traceID:         	111
parentSpanID	    NULL
startTime	        29/06/2022 12:59
operationName	INSERT
logs	        [{   "timestamp" : "15131543651",    "fields" : [{"key":"1","value":"2"},{"key":"2","value":"22"}]  }]
warnings	    running
references	    SOS_SCHEDULER_YIELD
serviceName	    DRDBADW
duration	    0
spanID	        297
errorIconColor	NULL
serviceTags	    NULL
stackTraces	    ["st_1","st_2"]
tags	        NULL

1 Like

and which plugin are you using? Grafana Enterprise Traces?

The Traces panel that comes with v9…?

1 Like