Skip to content

Commit

Permalink
rename methodMetric to standardizeHTTPMethodMetric
Browse files Browse the repository at this point in the history
  • Loading branch information
VinozzZ committed Aug 20, 2024
1 parent cd6d147 commit dec5bf2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions instrumentation/net/http/otelhttp/internal/semconv/v1.20.0.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func (o oldHTTPServer) MetricAttributes(server string, req *http.Request, status

attributes := slices.Grow(additionalAttributes, n)
attributes = append(attributes,
methodMetric(req.Method),
standardizeHTTPMethodMetric(req.Method),
o.scheme(req.TLS != nil),
semconv.NetHostName(host))

Expand Down Expand Up @@ -214,7 +214,7 @@ func (o oldHTTPClient) MetricAttributes(req *http.Request, statusCode int, addit

attributes := slices.Grow(additionalAttributes, n)
attributes = append(attributes,
methodMetric(req.Method),
standardizeHTTPMethodMetric(req.Method),
semconv.NetPeerName(requestHost),
)

Expand Down Expand Up @@ -263,7 +263,7 @@ func (o oldHTTPClient) createMeasures(meter metric.Meter) (metric.Int64Counter,
return requestBytesCounter, responseBytesCounter, latencyMeasure
}

func methodMetric(method string) attribute.KeyValue {
func standardizeHTTPMethodMetric(method string) attribute.KeyValue {
method = strings.ToUpper(method)
switch method {
case http.MethodConnect, http.MethodDelete, http.MethodGet, http.MethodHead, http.MethodOptions, http.MethodPatch, http.MethodPost, http.MethodPut, http.MethodTrace:
Expand Down

0 comments on commit dec5bf2

Please sign in to comment.