Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HCP Observability] Add custom metrics for OTEL sink, improve logging, upgrade modules and cleanup metrics client #17455

Merged
merged 11 commits into from
May 26, 2023
Prev Previous commit
Next Next commit
use GetHumanVersion on version
  • Loading branch information
Achooo committed May 25, 2023
commit dd2f7a8764b98a979e10df9a70de91ea2230b4b0
2 changes: 1 addition & 1 deletion agent/hcp/client/metrics_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func NewMetricsClient(cfg CloudConfig, ctx context.Context) (MetricsClient, erro
header := make(http.Header)
header.Set("content-type", "application/x-protobuf")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lowercased to be consistent with other ones.

header.Set("x-hcp-resource-id", r.String())
header.Set("x-channel", fmt.Sprintf("consul/%s", version.Version))
header.Set("x-channel", fmt.Sprintf("consul/%s", version.GetHumanVersion()))

return &otlpClient{
client: c,
Expand Down
2 changes: 1 addition & 1 deletion agent/hcp/client/metrics_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func TestExportMetrics(t *testing.T) {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
require.Equal(t, r.Header.Get("content-type"), "application/x-protobuf")
require.Equal(t, r.Header.Get("x-hcp-resource-id"), testResourceID)
require.Equal(t, r.Header.Get("x-channel"), fmt.Sprintf("consul/%s", version.Version))
require.Equal(t, r.Header.Get("x-channel"), fmt.Sprintf("consul/%s", version.GetHumanVersion()))
require.Equal(t, r.Header.Get("Authorization"), "Bearer test-token")

body := colpb.ExportMetricsServiceResponse{}
Expand Down