@@ -299,7 +299,7 @@ func TestAdjustKey(t *testing.T) {
299299 },
300300 expectedKey : telemetrytypes.TelemetryFieldKey {
301301 Name : "trace_id" ,
302- FieldContext : telemetrytypes .FieldContextLog , // Use intrinsic field context
302+ FieldContext : telemetrytypes .FieldContextLog , // Use intrinsic field context
303303 FieldDataType : telemetrytypes .FieldDataTypeString , // Use intrinsic field data type
304304 },
305305 expectedActions : []string {
@@ -364,14 +364,43 @@ func TestAdjustKey(t *testing.T) {
364364 expectedKey : telemetrytypes.TelemetryFieldKey {
365365 Name : "custom_field" ,
366366 FieldContext : telemetrytypes .FieldContextAttribute , // Use attribute field context
367- FieldDataType : telemetrytypes .FieldDataTypeString , // Use attribute field data type
367+ FieldDataType : telemetrytypes .FieldDataTypeString , // Use attribute field data type
368368 Materialized : true ,
369369 },
370370 expectedActions : []string {
371371 "Adjusting key name=custom_field to name=custom_field,context=attribute,datatype=string,materialized=true" ,
372372 },
373373 description : "Single matching attribute key should use its properties" ,
374374 },
375+ {
376+ name : "non-intrinsic field with attribute prefix as matching key" ,
377+ key : telemetrytypes.TelemetryFieldKey {
378+ Name : "custom_field" ,
379+ FieldContext : telemetrytypes .FieldContextLog ,
380+ FieldDataType : telemetrytypes .FieldDataTypeUnspecified ,
381+ },
382+ keys : map [string ][]* telemetrytypes.TelemetryFieldKey {
383+ "log.custom_field" : {
384+ {
385+ Name : "log.custom_field" ,
386+ FieldContext : telemetrytypes .FieldContextAttribute ,
387+ FieldDataType : telemetrytypes .FieldDataTypeString ,
388+ Materialized : true ,
389+ },
390+ },
391+ },
392+ intrinsicOrCalculatedField : nil ,
393+ expectedKey : telemetrytypes.TelemetryFieldKey {
394+ Name : "log.custom_field" ,
395+ FieldContext : telemetrytypes .FieldContextAttribute , // Use attribute field context
396+ FieldDataType : telemetrytypes .FieldDataTypeString , // Use attribute field data type
397+ Materialized : true ,
398+ },
399+ expectedActions : []string {
400+ "Adjusting key name=custom_field,context=log to name=log.custom_field,context=attribute,datatype=string,materialized=true" ,
401+ },
402+ description : "Single matching attribute key should use its properties" ,
403+ },
375404 {
376405 name : "non-intrinsic field with no matching attribute keys" ,
377406 key : telemetrytypes.TelemetryFieldKey {
0 commit comments