-
Notifications
You must be signed in to change notification settings - Fork 360
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add trace for rate-limit (#2974)
* feat: support trace of ratelimit Signed-off-by: ShyunnY <1147212064@qq.com> * fix: add json tag Signed-off-by: ShyunnY <1147212064@qq.com> * fix: use OTEL_EXPORTER_OTLP_ENDPOINT env Signed-off-by: ShyunnY <1147212064@qq.com> * fix Signed-off-by: ShyunnY <1147212064@qq.com> * docs: update docs Signed-off-by: yuluo-yx <yuluo08290126@gmail.com> --------- Signed-off-by: ShyunnY <1147212064@qq.com> Signed-off-by: yuluo-yx <yuluo08290126@gmail.com> Co-authored-by: yuluo-yx <yuluo08290126@gmail.com> Co-authored-by: zirain <zirain2009@gmail.com>
- Loading branch information
1 parent
b608831
commit aa4e3a0
Showing
10 changed files
with
679 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
internal/infrastructure/kubernetes/ratelimit/resource_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright Envoy Gateway Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// The full text of the Apache license is available in the LICENSE file at | ||
// the root of the repo. | ||
|
||
package ratelimit | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestCheckTraceEndpointScheme(t *testing.T) { | ||
|
||
cases := []struct { | ||
caseName string | ||
actualURL string | ||
expectedURL string | ||
}{ | ||
{ | ||
caseName: "normal url with http prefix", | ||
actualURL: "http://collector.observability.svc.cluster.local:4318", | ||
expectedURL: "http://collector.observability.svc.cluster.local:4318", | ||
}, | ||
{ | ||
caseName: "abnormal url without http prefix", | ||
actualURL: "collector.observability.svc.cluster.local:4318", | ||
expectedURL: "http://collector.observability.svc.cluster.local:4318", | ||
}, | ||
} | ||
|
||
for _, tc := range cases { | ||
t.Run(tc.caseName, func(t *testing.T) { | ||
actual := checkTraceEndpointScheme(tc.actualURL) | ||
require.Equal(t, tc.expectedURL, actual) | ||
}) | ||
} | ||
|
||
} |
Oops, something went wrong.