Skip to content

Commit

Permalink
format with new formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitpatel96 committed Dec 2, 2024
1 parent 0f2a55c commit 5b49e9f
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ func TestMetricDataPointAttributesTransformer(t *testing.T) {
err = metricDataPointAttributeTransformer.Do(migrate.StateSelectorApply, metric)
require.NoError(t, err)
assertAttributeEquals(t, item.Attributes(), "service.version", "1.0.0")

})
}
}
Expand All @@ -108,5 +107,4 @@ func TestSpanConditionalAttributeTransformer(t *testing.T) {
err = spanConditionalAttributeTransformer.Do(migrate.StateSelectorApply, span)
require.NoError(t, err)
assertAttributeEquals(t, span.Attributes(), "service.version", "1.0.0")

}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ func TestSpanEventConditionalAttributeTransformer(t *testing.T) {
return span
},
changed: false,
}, {
},
{
name: "bothnamematches",
span: func() ptrace.Span {
span := ptrace.NewSpan()
Expand Down
3 changes: 0 additions & 3 deletions processor/schemaprocessor/internal/translation/revision_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ func NewRevision(ver *Version, def ast.VersionDef) *RevisionV1 {
for _, change := range def.Logs.Changes {
//nolint:gosimple
logChanges.Changes = append(logChanges.Changes, ast.AttributeChange{RenameAttributes: change.RenameAttributes})

}
return &RevisionV1{
ver: ver,
Expand All @@ -47,7 +46,6 @@ func NewRevision(ver *Version, def ast.VersionDef) *RevisionV1 {
metrics: newMetricChangeList(def.Metrics),
logs: newLogsChangelist(def.Logs),
}

}

func (r RevisionV1) Version() *Version {
Expand Down Expand Up @@ -87,7 +85,6 @@ func newSpanChangeList(spans ast.Spans) *changelist.ChangeList {
}
}
return &changelist.ChangeList{Migrators: values}

}

func newMetricChangeList(metrics ast.Metrics) *changelist.ChangeList {
Expand Down
118 changes: 60 additions & 58 deletions processor/schemaprocessor/internal/translation/revision_v1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,65 +148,66 @@ func TestNewRevisionV1(t *testing.T) {
},
expect: &RevisionV1{
ver: &Version{1, 0, 0},
all: &changelist.ChangeList{Migrators: []migrate.Migrator{
transformer.AllAttributes{
// initialize one of each transformer with the attribute set
MetricAttributes: transformer.MetricAttributes{
AttributeChange: migrate.NewAttributeChangeSet(map[string]string{
"state": "status",
}),
},
LogAttributes: transformer.LogAttributes{
AttributeChange: migrate.NewAttributeChangeSet(map[string]string{
"state": "status",
}),
},
SpanAttributes: transformer.SpanAttributes{
AttributeChange: migrate.NewAttributeChangeSet(map[string]string{
"state": "status",
}),
},
SpanEventAttributes: transformer.SpanEventAttributes{
AttributeChange: migrate.NewAttributeChangeSet(map[string]string{
"state": "status",
}),
},
ResourceAttributes: transformer.ResourceAttributes{
AttributeChange: migrate.NewAttributeChangeSet(map[string]string{
"state": "status",
}),
},
},
transformer.AllAttributes{
// initialize one of each transformer with the attribute set
MetricAttributes: transformer.MetricAttributes{
AttributeChange: migrate.NewAttributeChangeSet(map[string]string{
"status": "state",
}),
},
LogAttributes: transformer.LogAttributes{
AttributeChange: migrate.NewAttributeChangeSet(map[string]string{
"status": "state",
}),
},
SpanAttributes: transformer.SpanAttributes{
AttributeChange: migrate.NewAttributeChangeSet(map[string]string{
"status": "state",
}),
},
SpanEventAttributes: transformer.SpanEventAttributes{
AttributeChange: migrate.NewAttributeChangeSet(map[string]string{
"status": "state",
}),
all: &changelist.ChangeList{
Migrators: []migrate.Migrator{
transformer.AllAttributes{
// initialize one of each transformer with the attribute set
MetricAttributes: transformer.MetricAttributes{
AttributeChange: migrate.NewAttributeChangeSet(map[string]string{
"state": "status",
}),
},
LogAttributes: transformer.LogAttributes{
AttributeChange: migrate.NewAttributeChangeSet(map[string]string{
"state": "status",
}),
},
SpanAttributes: transformer.SpanAttributes{
AttributeChange: migrate.NewAttributeChangeSet(map[string]string{
"state": "status",
}),
},
SpanEventAttributes: transformer.SpanEventAttributes{
AttributeChange: migrate.NewAttributeChangeSet(map[string]string{
"state": "status",
}),
},
ResourceAttributes: transformer.ResourceAttributes{
AttributeChange: migrate.NewAttributeChangeSet(map[string]string{
"state": "status",
}),
},
},
ResourceAttributes: transformer.ResourceAttributes{
AttributeChange: migrate.NewAttributeChangeSet(map[string]string{
"status": "state",
}),
transformer.AllAttributes{
// initialize one of each transformer with the attribute set
MetricAttributes: transformer.MetricAttributes{
AttributeChange: migrate.NewAttributeChangeSet(map[string]string{
"status": "state",
}),
},
LogAttributes: transformer.LogAttributes{
AttributeChange: migrate.NewAttributeChangeSet(map[string]string{
"status": "state",
}),
},
SpanAttributes: transformer.SpanAttributes{
AttributeChange: migrate.NewAttributeChangeSet(map[string]string{
"status": "state",
}),
},
SpanEventAttributes: transformer.SpanEventAttributes{
AttributeChange: migrate.NewAttributeChangeSet(map[string]string{
"status": "state",
}),
},
ResourceAttributes: transformer.ResourceAttributes{
AttributeChange: migrate.NewAttributeChangeSet(map[string]string{
"status": "state",
}),
},
},
},
},
},
resources: &changelist.ChangeList{Migrators: []migrate.Migrator{
transformer.ResourceAttributes{AttributeChange: migrate.NewAttributeChangeSet(
map[string]string{"service_name": "service.name"},
Expand Down Expand Up @@ -247,9 +248,10 @@ func TestNewRevisionV1(t *testing.T) {
)},
}},
logs: &changelist.ChangeList{Migrators: []migrate.Migrator{
transformer.LogAttributes{AttributeChange: migrate.NewAttributeChangeSet(map[string]string{
"ERROR": "error",
}),
transformer.LogAttributes{
AttributeChange: migrate.NewAttributeChangeSet(map[string]string{
"ERROR": "error",
}),
},
}},
},
Expand Down

0 comments on commit 5b49e9f

Please sign in to comment.