File tree Expand file tree Collapse file tree 1 file changed +27
-1
lines changed
processor/transformprocessor Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -258,13 +258,39 @@ Set attribute `test` to `"pass"` if the attribute `test` does not exist:
258
258
` ` ` yaml
259
259
transform:
260
260
error_mode: ignore
261
- span_statements :
261
+ trace_statements :
262
262
- context: span
263
263
statements:
264
264
# accessing a map with a key that does not exist will return nil.
265
265
- set(attributes["test"], "pass") where attributes["test"] == nil
266
266
` ` `
267
267
268
+ # ## Rename attribute
269
+ There are 2 ways to rename an attribute key :
270
+
271
+ You can either set a new attribute and delete the old :
272
+
273
+ ` ` ` yaml
274
+ transform:
275
+ error_mode: ignore
276
+ trace_statements:
277
+ - context: resource
278
+ statements:
279
+ - set(attributes["namespace"], attributes["k8s.namespace.name"])
280
+ - delete_key(attributes, "k8s.namespace.name")
281
+ ` ` `
282
+
283
+ Or you can update the key using regex :
284
+
285
+ ` ` ` yaml
286
+ transform:
287
+ error_mode: ignore
288
+ trace_statements:
289
+ - context: resource
290
+ statements:
291
+ - replace_all_patterns(attributes, "key", "k8s\\ .namespace\\ .name", "namespace")
292
+ ` ` `
293
+
268
294
# ## Parsing JSON logs
269
295
270
296
Given the following json body
You can’t perform that action at this time.
0 commit comments