File tree Expand file tree Collapse file tree 2 files changed +50
-1
lines changed Expand file tree Collapse file tree 2 files changed +50
-1
lines changed Original file line number Diff line number Diff line change @@ -118,7 +118,9 @@ type Metric struct {
118
118
}
119
119
120
120
func (m * Metric ) TargetStatusCodeGroup () string {
121
- code := ""
121
+ // TargetStatusCode is - when the target does not send a response
122
+ // see: https://docs.aws.amazon.com/ja_jp/elasticloadbalancing/latest/application/load-balancer-access-logs.html
123
+ code := "-"
122
124
switch {
123
125
case strings .HasPrefix (m .TargetStatusCode , "1" ):
124
126
code = "1xx"
Original file line number Diff line number Diff line change @@ -112,6 +112,53 @@ func TestMetricsSubmitter_targetProcessingTime(t *testing.T) {
112
112
},
113
113
wantErr : false ,
114
114
},
115
+ {
116
+ name : "TargetStatusCode is -" ,
117
+ fields : fields {
118
+ TargetProcessingTimeMetricName : "target_processing_time" ,
119
+ },
120
+ args : args {
121
+ metric : & Metric {
122
+ TargetProcessingTimesMap : map [Timestamp ]TargetProcessingTimes {
123
+ Timestamp (1 ): {- 1 },
124
+ Timestamp (2 ): {- 1 },
125
+ },
126
+ Method : "GET" ,
127
+ Path : "/" ,
128
+ ElbStatusCode : "460" ,
129
+ TargetStatusCode : "-" ,
130
+ Elb : "elb" ,
131
+ TargetGroupArn : "arn" ,
132
+ },
133
+ },
134
+ want : []datadogV1.DistributionPointsSeries {
135
+ datadogV1.DistributionPointsSeries {
136
+ Metric : "target_processing_time" ,
137
+ Points : [][]datadogV1.DistributionPointItem {
138
+ {
139
+ {DistributionPointTimestamp : datadog .PtrFloat64 (1 )},
140
+ {DistributionPointData : & []float64 {- 1 }},
141
+ },
142
+ {
143
+ {DistributionPointTimestamp : datadog .PtrFloat64 (2 )},
144
+ {DistributionPointData : & []float64 {- 1 }},
145
+ },
146
+ },
147
+ Tags : []string {
148
+ "elb:elb" ,
149
+ "target_group_arn:arn" ,
150
+ "path:/" ,
151
+ "method:GET" ,
152
+ "elb_status_code:460" ,
153
+ "target_status_code:-" ,
154
+ "target_status_code_group:-" ,
155
+ "ip_address:172.160.001.192" ,
156
+ },
157
+ Type : & typeVar ,
158
+ },
159
+ },
160
+ wantErr : false ,
161
+ },
115
162
}
116
163
for _ , tt := range tests {
117
164
t .Run (tt .name , func (t * testing.T ) {
You can’t perform that action at this time.
0 commit comments