You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
datasource=std.get(signalsJson, 'datasource', if std.get(signalsJson, 'enableLokiLogs', false) then'prometheus_datasource'else'datasource'),
36
+
datasourceLabel=std.get(signalsJson, 'datasourceLabel', if std.get(signalsJson, 'enableLokiLogs', false) then'Prometheus data source'else'Data source'),
datasource=std.get(signalsJson, 'datasource', if std.get(signalsJson, 'enableLokiLogs', false) then'prometheus_datasource'else'datasource'),
91
+
datasourceLabel=std.get(signalsJson, 'datasourceLabel', if std.get(signalsJson, 'enableLokiLogs', false) then'Prometheus data source'else'Data source'),
datasourceLabel::if enableLokiLogs && datasourceLabel == 'Data source'then'Prometheus data source'else datasourceLabel,
184
189
aggLevel:: aggLevel,
185
190
aggKeepLabels:: aggKeepLabels,
186
191
aggFunction:: aggFunction,
@@ -191,10 +196,11 @@ local stub = import './stub.libsonnet';
191
196
groupLabels,
192
197
instanceLabels,
193
198
varMetric=varMetric,
194
-
prometheusDatasourceName=datasource,
195
-
prometheusDatasourceLabel=datasourceLabel,
199
+
prometheusDatasourceName=this.datasource,
200
+
prometheusDatasourceLabel=this.datasourceLabel,
196
201
adHocEnabled=varAdHocEnabled,
197
202
adHocLabels=varAdHocLabels,
203
+
enableLokiLogs=enableLokiLogs,
198
204
),
199
205
// vars are used in templating(legend+expressions)
200
206
templatingVariables: {
@@ -216,7 +222,7 @@ local stub = import './stub.libsonnet';
216
222
grafanaVariables.datasources[type],
217
223
218
224
//name: metric simple name
219
-
//type: counter, gauge, histogram, // TODO: info metric, status_map metric....
225
+
//type: counter, gauge, histogram, raw, info, log
220
226
//unit: simple unit
221
227
//description: metric description
222
228
//exprTemplate: expression template
@@ -246,7 +252,7 @@ local stub = import './stub.libsonnet';
246
252
std.prune(
247
253
{
248
254
checks: [
249
-
if (type != 'gauge' && type != 'histogram' && type != 'counter' && type != 'raw' && type != 'info' && type != 'stub') thenerror"type must be one of 'gauge','histogram','counter','raw','info' Got %s for %s" % [type, name],
255
+
if (type != 'gauge' && type != 'histogram' && type != 'counter' && type != 'raw' && type != 'info' && type != 'stub' && type != 'log') thenerror"type must be one of 'gauge','histogram','counter','raw','info','log'. Got %s for %s" % [type, name],
250
256
if (aggLevel != 'none' && aggLevel != 'instance' && aggLevel != 'group') thenerror"aggLevel must be one of 'group','instance' or 'none'",
251
257
],
252
258
}
@@ -260,7 +266,7 @@ local stub = import './stub.libsonnet';
260
266
description=description,
261
267
aggLevel=aggLevel,
262
268
aggFunction=aggFunction,
263
-
datasource=datasource,
269
+
datasource=this.datasource,
264
270
vars=this.templatingVariables,
265
271
sourceMaps=sourceMaps,
266
272
)
@@ -273,7 +279,7 @@ local stub = import './stub.libsonnet';
273
279
description=description,
274
280
aggLevel=aggLevel,
275
281
aggFunction=aggFunction,
276
-
datasource=datasource,
282
+
datasource=this.datasource,
277
283
vars=this.templatingVariables,
278
284
sourceMaps=sourceMaps,
279
285
)
@@ -286,7 +292,7 @@ local stub = import './stub.libsonnet';
286
292
description=description,
287
293
aggLevel=aggLevel,
288
294
aggFunction=aggFunction,
289
-
datasource=datasource,
295
+
datasource=this.datasource,
290
296
vars=this.templatingVariables,
291
297
sourceMaps=sourceMaps,
292
298
)
@@ -299,7 +305,20 @@ local stub = import './stub.libsonnet';
299
305
description=description,
300
306
aggLevel=aggLevel,
301
307
aggFunction=aggFunction,
302
-
datasource=datasource,
308
+
datasource=this.datasource,
309
+
vars=this.templatingVariables,
310
+
sourceMaps=sourceMaps,
311
+
)
312
+
elseif type == 'log'then
313
+
log.new(
314
+
name=name,
315
+
type=type,
316
+
unit='none',
317
+
nameShort=nameShort,
318
+
description=description,
319
+
aggLevel=aggLevel,
320
+
aggFunction=aggFunction,
321
+
datasource='loki_datasource',
303
322
vars=this.templatingVariables,
304
323
sourceMaps=sourceMaps,
305
324
)
@@ -311,7 +330,7 @@ local stub = import './stub.libsonnet';
0 commit comments