-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[chore] Move metrics initialization in service/telemetry
Signed-off-by: Bogdan Drutu <[email protected]>
- Loading branch information
1 parent
1339c01
commit 8f65a8f
Showing
8 changed files
with
89 additions
and
73 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package promtest // import "go.opentelemetry.io/collector/service/internal/promtest" | ||
|
||
import ( | ||
"net" | ||
"strconv" | ||
"testing" | ||
|
||
"go.opentelemetry.io/contrib/config" | ||
|
||
"go.opentelemetry.io/collector/internal/testutil" | ||
) | ||
|
||
func GetAvailableLocalIPv6AddressPrometheus(t testing.TB) *config.Prometheus { | ||
return addrToPrometheus(testutil.GetAvailableLocalIPv6Address(t)) | ||
} | ||
|
||
func GetAvailableLocalAddressPrometheus(t testing.TB) *config.Prometheus { | ||
return addrToPrometheus(testutil.GetAvailableLocalAddress(t)) | ||
} | ||
|
||
func addrToPrometheus(address string) *config.Prometheus { | ||
host, port, err := net.SplitHostPort(address) | ||
if err != nil { | ||
return nil | ||
} | ||
portInt, err := strconv.Atoi(port) | ||
if err != nil { | ||
return nil | ||
} | ||
return &config.Prometheus{ | ||
Host: &host, | ||
Port: &portInt, | ||
} | ||
} |
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
2 changes: 1 addition & 1 deletion
2
service/internal/proctelemetry/config.go → ...ice/telemetry/internal/otelinit/config.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
2 changes: 1 addition & 1 deletion
2
...ice/internal/proctelemetry/config_test.go → ...elemetry/internal/otelinit/config_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
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