Skip to content

Commit

Permalink
update tests with custom rules (#379)
Browse files Browse the repository at this point in the history
  • Loading branch information
movence authored Nov 27, 2023
1 parent 3c12a98 commit 8e511bc
Show file tree
Hide file tree
Showing 4 changed files with 167 additions and 8 deletions.
45 changes: 44 additions & 1 deletion test/app_signals/resources/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,50 @@
},
"logs": {
"metrics_collected": {
"app_signals": {}
"app_signals": {
"rules":[
{
"selectors":[
{
"dimension":"Operation",
"match":"operation"
}
],
"action":"keep",
"rule_name":"keep01"
},
{
"selectors":[
{
"dimension":"Service",
"match":"drop-service-name*"
}
],
"action":"drop",
"rule_name":"drop01"
},
{
"selectors":[
{
"dimension":"Operation",
"match":"operation"
},
{
"dimension":"Service",
"match":"service-name"
}
],
"replacements":[
{
"target_dimension":"Operation",
"value":"replaced-operation"
}
],
"action":"replace",
"rule_name":"replace01"
}
]
}
}
},
"traces": {
Expand Down
124 changes: 120 additions & 4 deletions test/app_signals/resources/metrics/server_consumer.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@
"value": {
"stringValue": "pod-name"
}
}
,
},
{
"key": "K8s.Node",
"value": {
Expand Down Expand Up @@ -128,8 +127,7 @@
"value": {
"stringValue": "pod-name"
}
}
,
},
{
"key": "K8s.Node",
"value": {
Expand Down Expand Up @@ -210,6 +208,124 @@
}
]
}
},
{
"name": "Latency",
"unit": "Milliseconds",
"sum": {
"dataPoints": [
{
"attributes": [
{
"key": "aws.span.kind",
"value": {
"stringValue": "SERVER"
}
},
{
"key": "Operation",
"value": {
"stringValue": "operation"
}
},
{
"key": "Service",
"value": {
"stringValue": "drop-service-name-1"
}
},
{
"key": "K8s.Namespace",
"value": {
"stringValue": "default"
}
},
{
"key": "K8s.Pod",
"value": {
"stringValue": "pod-name"
}
},
{
"key": "K8s.Node",
"value": {
"stringValue": "i-00000000000000000"
}
},
{
"key": "K8s.Workload",
"value": {
"stringValue": "sample-app"
}
}
],
"startTimeUnixNano": START_TIME,
"timeUnixNano": START_TIME,
"sum": 1,
"min": 1,
"max": 1
}
]
}
},
{
"name": "Latency",
"unit": "Milliseconds",
"sum": {
"dataPoints": [
{
"attributes": [
{
"key": "aws.span.kind",
"value": {
"stringValue": "SERVER"
}
},
{
"key": "Operation",
"value": {
"stringValue": "do-not-keep-operation-1"
}
},
{
"key": "Service",
"value": {
"stringValue": "service-name"
}
},
{
"key": "K8s.Namespace",
"value": {
"stringValue": "default"
}
},
{
"key": "K8s.Pod",
"value": {
"stringValue": "pod-name"
}
},
{
"key": "K8s.Node",
"value": {
"stringValue": "i-00000000000000000"
}
},
{
"key": "K8s.Workload",
"value": {
"stringValue": "sample-app"
}
}
],
"startTimeUnixNano": START_TIME,
"timeUnixNano": START_TIME,
"sum": 1,
"min": 1,
"max": 1
}
]
}
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion test/app_signals/traces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var annotations = map[string]interface{}{
"aws_local_service": "service-name",
"aws_remote_service": "service-name-remote",
"HostedIn_K8s_Namespace": "default",
"aws_local_operation": "operation",
"aws_local_operation": "replaced-operation",
}

type AppSignalsTracesRunner struct {
Expand Down
4 changes: 2 additions & 2 deletions test/metric/app_signals_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var (
},
{
Key: "Operation",
Value: dimension.ExpectedDimensionValue{Value: aws.String("operation")},
Value: dimension.ExpectedDimensionValue{Value: aws.String("replaced-operation")},
},
}

Expand All @@ -57,7 +57,7 @@ var (
},
{
Key: "Operation",
Value: dimension.ExpectedDimensionValue{Value: aws.String("operation")},
Value: dimension.ExpectedDimensionValue{Value: aws.String("replaced-operation")},
},
{
Key: "RemoteOperation",
Expand Down

0 comments on commit 8e511bc

Please sign in to comment.