-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
config/stats: add udp statds address as config option (#1019)
- Loading branch information
1 parent
8d72607
commit a8c446a
Showing
15 changed files
with
156 additions
and
20 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
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,10 @@ | ||
# DEPRECATED | ||
|
||
As of release 1.3.0, Envoy will follow a | ||
[Breaking Change Policy](https://github.com/lyft/envoy/blob/master//CONTRIBUTING.md#breaking-change-policy). | ||
|
||
The following features have been DEPRECATED and will be removed in the specified release cycle. | ||
|
||
* Version 1.4.0 | ||
* Config option `statsd_local_udp_port` has been deprecated and has been replaced with | ||
`statsd_udp_ip_address`. |
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
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
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,51 @@ | ||
#include <chrono> | ||
|
||
#include "common/network/address_impl.h" | ||
#include "common/network/utility.h" | ||
#include "common/stats/statsd.h" | ||
|
||
#include "test/mocks/thread_local/mocks.h" | ||
#include "test/test_common/environment.h" | ||
#include "test/test_common/network_utility.h" | ||
|
||
#include "gmock/gmock.h" | ||
#include "gtest/gtest.h" | ||
#include "spdlog/spdlog.h" | ||
|
||
namespace Envoy { | ||
using testing::NiceMock; | ||
|
||
namespace Stats { | ||
namespace Statsd { | ||
|
||
class UdpStatsdSinkTest : public testing::TestWithParam<Network::Address::IpVersion> {}; | ||
INSTANTIATE_TEST_CASE_P(IpVersions, UdpStatsdSinkTest, | ||
testing::ValuesIn(TestEnvironment::getIpVersionsForTest())); | ||
|
||
TEST_P(UdpStatsdSinkTest, InitWithIpAddress) { | ||
NiceMock<ThreadLocal::MockInstance> tls_; | ||
// UDP statsd server address. | ||
Network::Address::InstanceConstSharedPtr server_address = | ||
Network::Utility::parseInternetAddressAndPort( | ||
fmt::format("{}:8125", Network::Test::getLoopbackAddressUrlString(GetParam()))); | ||
UdpStatsdSink sink(tls_, server_address); | ||
int fd = sink.getFdForTests(); | ||
EXPECT_NE(fd, -1); | ||
|
||
// Check that fd has not changed. | ||
sink.flushCounter("test_counter", 1); | ||
sink.flushGauge("test_gauge", 1); | ||
sink.onTimespanComplete("test_counter", std::chrono::milliseconds(5)); | ||
EXPECT_EQ(fd, sink.getFdForTests()); | ||
|
||
if (GetParam() == Network::Address::IpVersion::v4) { | ||
EXPECT_EQ("127.0.0.1:8125", Network::Address::peerAddressFromFd(fd)->asString()); | ||
} else { | ||
EXPECT_EQ("[::1]:8125", Network::Address::peerAddressFromFd(fd)->asString()); | ||
} | ||
tls_.shutdownThread(); | ||
} | ||
|
||
} // Statsd | ||
} // Stats | ||
} // Envoy |
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