-
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 037f10b
Showing
6 changed files
with
76 additions
and
63 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,34 @@ | ||
package 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
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