-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
config/stats: add udp statds address as config option #1019
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a4762be
Add udp statds address as config option
hennna 3b35c4b
Response to comments
hennna 5c62e0d
Update docs
hennna b22e78a
Update
hennna 9e7fda9
Use addressFromFd
hennna e897281
Fix
hennna e35a479
Fix
hennna a64fad2
Response to comments
hennna File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ specify miscellaneous configuration. | |
"cluster_manager": "{...}", | ||
"flags_path": "...", | ||
"statsd_local_udp_port": "...", | ||
"statsd_udp_ip_address": "...", | ||
"statsd_tcp_cluster_name": "...", | ||
"stats_flush_interval_ms": "...", | ||
"watchdog_miss_timeout_ms": "...", | ||
|
@@ -45,10 +46,16 @@ flags_path | |
*(optional, string)* The file system path to search for :ref:`startup flag files | ||
<operations_file_system_flags>`. | ||
|
||
statsd_local_udp_port | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shall we keep this until it's removed from the code? (and add deprecation warning) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure. Will add it back. |
||
statsd_local_udp_port (Warning: DEPRECATED and will be removed in 1.4.0) | ||
*(optional, integer)* The UDP port of a locally running statsd compliant listener. If specified, | ||
:ref:`statistics <arch_overview_statistics>` will be flushed to this port. | ||
|
||
statsd_udp_ip_address | ||
*(optional, string)* The UDP address of a running statsd compliant listener. If specified, | ||
:ref:`statistics <arch_overview_statistics>` will be flushed to this address. IPv4 addresses should | ||
have format host:port (ex: 127.0.0.1:855). IPv6 addresses should have URL format [host]:port | ||
(ex: [::1]:855). | ||
|
||
statsd_tcp_cluster_name | ||
*(optional, string)* The name of a cluster manager cluster that is running a TCP statsd compliant | ||
listener. If specified, Envoy will connect to this cluster to flush :ref:`statistics | ||
|
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @hennna I'll update this with 3a466c3
once you merge it