Skip to content

Commit 00f39be

Browse files
committed
Merge branch 'release-12.x'
* release-12.x: [release] prepare release for proxy-12.2 update open_source_licenses.txt for release 12.2 Fix failing HttpEndtoEndTest (#835) 12.2 version (#834) [release] prepare for next development iteration
2 parents 06df16d + 604e9d1 commit 00f39be

37 files changed

+12148
-14320
lines changed

docker/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ RUN chown -R wavefront:wavefront /opt/java/openjdk/lib/security/cacerts
1616
RUN mkdir -p /var/spool/wavefront-proxy
1717
RUN chown -R wavefront:wavefront /var/spool/wavefront-proxy
1818

19+
RUN mkdir -p /var/log/wavefront
20+
RUN chown -R wavefront:wavefront /var/log/wavefront
21+
1922
# Run the agent
2023
EXPOSE 3878
2124
EXPOSE 2878

open_source_licenses.txt

Lines changed: 9551 additions & 12270 deletions
Large diffs are not rendered by default.

pkg/etc/wavefront/wavefront-proxy/wavefront.conf.default

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
# suffix -- or Wavefront provides the URL.
99
server=CHANGE_ME
1010

11-
# The hostname will be used to identify the internal proxy statistics around point rates, JVM info, etc.
11+
# The proxyname will be used to identify the internal proxy statistics around point rates, JVM info, etc.
1212
# We strongly recommend setting this to a name that is unique among your entire infrastructure, to make this
13-
# proxy easy to identify. This hostname does not need to correspond to any actual hostname or DNS entry; it's merely
13+
# proxy easy to identify. This proxyname does not need to correspond to any actual proxyname or DNS entry; it's merely
1414
# a string that we pass with the internal stats and ~proxy.* metrics.
15-
#hostname=my.proxy.host.com
15+
#proxyname=my.proxy.name.com
1616

1717
# The Token is any valid API token for an account that has *Proxy Management* permissions. To get to the token:
1818
# 1. Click the gear icon at the top right in the Wavefront UI.
@@ -41,9 +41,9 @@ pushListenerPorts=2878
4141
#graphitePorts=2003
4242
## Comma-separated list of ports to listen on for Graphite pickle formatted data (from carbon-relay) (Default: none)
4343
#picklePorts=2004
44-
## Which fields (1-based) should we extract and concatenate (with dots) as the hostname?
44+
## Which fields (1-based) should we extract and concatenate (with dots) as the proxyname?
4545
#graphiteFormat=2
46-
## Which characters should be replaced by dots in the hostname, after extraction? (Default: _)
46+
## Which characters should be replaced by dots in the proxyname, after extraction? (Default: _)
4747
#graphiteDelimiters=_
4848
## Comma-separated list of fields (metric segments) to remove (1-based). This is an optional setting. (Default: none)
4949
#graphiteFieldsToRemove=3,4,5
@@ -83,7 +83,7 @@ pushListenerPorts=2878
8383
## source= or host= (preferring source=) and treat that as the source/host within Wavefront.
8484
## customSourceTags is a comma-separated, ordered list of additional tag keys to use if neither
8585
## source= or host= is present
86-
#customSourceTags=fqdn, hostname
86+
#customSourceTags=fqdn, proxyname
8787

8888
## The prefix should either be left undefined, or can be any prefix you want
8989
## prepended to all data points coming through this proxy (such as `production`).

proxy/pom.xml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
35
<modelVersion>4.0.0</modelVersion>
46

57
<groupId>com.wavefront</groupId>
68
<artifactId>proxy</artifactId>
7-
<version>12.1</version>
9+
<version>12.2</version>
810

911
<name>Wavefront Proxy</name>
1012
<description>Service for batching and relaying metric traffic to Wavefront</description>
@@ -263,7 +265,7 @@
263265
<dependency>
264266
<groupId>com.google.protobuf</groupId>
265267
<artifactId>protobuf-bom</artifactId>
266-
<version>3.21.0</version>
268+
<version>3.21.12</version>
267269
<type>pom</type>
268270
<scope>import</scope>
269271
</dependency>
@@ -280,7 +282,7 @@
280282
<dependency>
281283
<groupId>io.netty</groupId>
282284
<artifactId>netty-bom</artifactId>
283-
<version>4.1.77.Final</version>
285+
<version>4.1.89.Final</version>
284286
<type>pom</type>
285287
<scope>import</scope>
286288
</dependency>
@@ -386,7 +388,7 @@
386388
<dependency>
387389
<groupId>com.wavefront</groupId>
388390
<artifactId>java-lib</artifactId>
389-
<version>2022-11.1</version>
391+
<version>2023-02.1</version>
390392
</dependency>
391393
<dependency>
392394
<groupId>com.fasterxml.jackson.module</groupId>
@@ -444,7 +446,7 @@
444446
<dependency>
445447
<groupId>com.amazonaws</groupId>
446448
<artifactId>aws-java-sdk-sqs</artifactId>
447-
<version>1.12.229</version>
449+
<version>1.12.297</version>
448450
<scope>compile</scope>
449451
</dependency>
450452
<dependency>

proxy/src/main/java/com/wavefront/agent/AbstractAgent.java

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import com.google.common.annotations.VisibleForTesting;
1313
import com.google.common.base.Preconditions;
1414
import com.google.common.base.Splitter;
15-
import com.google.common.collect.ImmutableSet;
1615
import com.google.common.collect.Maps;
1716
import com.wavefront.agent.api.APIContainer;
1817
import com.wavefront.agent.config.LogsIngestionConfig;
@@ -42,7 +41,6 @@
4241
import java.util.ArrayList;
4342
import java.util.List;
4443
import java.util.Map;
45-
import java.util.Set;
4644
import java.util.Timer;
4745
import java.util.TimerTask;
4846
import java.util.UUID;
@@ -51,8 +49,6 @@
5149
import java.util.concurrent.atomic.AtomicBoolean;
5250
import java.util.logging.Level;
5351
import java.util.logging.Logger;
54-
import java.util.stream.Collectors;
55-
import java.util.stream.IntStream;
5652
import javax.net.ssl.SSLException;
5753
import org.apache.commons.lang.StringUtils;
5854
import org.apache.commons.lang3.ObjectUtils;
@@ -67,10 +63,8 @@ public abstract class AbstractAgent {
6763
final Counter activeListeners =
6864
Metrics.newCounter(ExpectedAgentMetric.ACTIVE_LISTENERS.metricName);
6965
/** A set of commandline parameters to hide when echoing command line arguments */
70-
protected static final Set<String> PARAMETERS_TO_HIDE =
71-
ImmutableSet.of("-t", "--token", "--proxyPassword");
72-
7366
protected final ProxyConfig proxyConfig = new ProxyConfig();
67+
7468
protected APIContainer apiContainer;
7569
protected final List<ExecutorService> managedExecutors = new ArrayList<>();
7670
protected final List<Runnable> shutdownTasks = new ArrayList<>();
@@ -223,6 +217,15 @@ private void postProcessConfig() {
223217
@VisibleForTesting
224218
void parseArguments(String[] args) {
225219
// read build information and print version.
220+
String versionStr =
221+
"Wavefront Proxy version "
222+
+ getBuildVersion()
223+
+ " (pkg:"
224+
+ getPackage()
225+
+ ")"
226+
+ ", runtime: "
227+
+ getJavaVersion();
228+
logger.info(versionStr);
226229
try {
227230
if (!proxyConfig.parseArguments(args, this.getClass().getCanonicalName())) {
228231
System.exit(0);
@@ -231,13 +234,6 @@ void parseArguments(String[] args) {
231234
logger.severe("Parameter exception: " + e.getMessage());
232235
System.exit(1);
233236
}
234-
logger.info(
235-
"Arguments: "
236-
+ IntStream.range(0, args.length)
237-
.mapToObj(
238-
i -> (i > 0 && PARAMETERS_TO_HIDE.contains(args[i - 1])) ? "<HIDDEN>" : args[i])
239-
.collect(Collectors.joining(" ")));
240-
proxyConfig.verifyAndInit();
241237
}
242238

243239
/**
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package com.wavefront.agent;
2+
3+
import com.wavefront.agent.formatter.DataFormat;
4+
import com.wavefront.common.TaggedMetricName;
5+
import com.yammer.metrics.core.Counter;
6+
import com.yammer.metrics.core.Histogram;
7+
import com.yammer.metrics.core.MetricsRegistry;
8+
import java.util.Arrays;
9+
import java.util.HashSet;
10+
import java.util.Set;
11+
12+
/** @author Sumit Deo ([email protected]) */
13+
public class LogsUtil {
14+
15+
public static final Set<DataFormat> LOGS_DATA_FORMATS =
16+
new HashSet<>(
17+
Arrays.asList(
18+
DataFormat.LOGS_JSON_ARR,
19+
DataFormat.LOGS_JSON_LINES,
20+
DataFormat.LOGS_JSON_CLOUDWATCH));
21+
22+
public static Counter getOrCreateLogsCounterFromRegistry(
23+
MetricsRegistry registry, DataFormat format, String group, String name) {
24+
return registry.newCounter(
25+
new TaggedMetricName(group, name, "format", format.name().toLowerCase()));
26+
}
27+
28+
public static Histogram getOrCreateLogsHistogramFromRegistry(
29+
MetricsRegistry registry, DataFormat format, String group, String name) {
30+
return registry.newHistogram(
31+
new TaggedMetricName(group, name, "format", format.name().toLowerCase()), false);
32+
}
33+
}

proxy/src/main/java/com/wavefront/agent/ProxyCheckInScheduler.java

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import com.google.common.base.Throwables;
1010
import com.google.common.collect.Maps;
1111
import com.wavefront.agent.api.APIContainer;
12+
import com.wavefront.agent.preprocessor.PreprocessorConfigManager;
1213
import com.wavefront.api.agent.AgentConfiguration;
1314
import com.wavefront.common.Clock;
1415
import com.wavefront.common.NamedThreadFactory;
@@ -54,18 +55,16 @@ public class ProxyCheckInScheduler {
5455
private final BiConsumer<String, AgentConfiguration> agentConfigurationConsumer;
5556
private final Runnable shutdownHook;
5657
private final Runnable truncateBacklog;
57-
private String hostname;
58-
private String serverEndpointUrl = null;
59-
60-
private volatile JsonNode agentMetrics;
6158
private final AtomicInteger retries = new AtomicInteger(0);
6259
private final AtomicLong successfulCheckIns = new AtomicLong(0);
63-
private boolean retryImmediately = false;
64-
6560
/** Executors for support tasks. */
6661
private final ScheduledExecutorService executor =
6762
Executors.newScheduledThreadPool(2, new NamedThreadFactory("proxy-configuration"));
6863

64+
private String serverEndpointUrl = null;
65+
private volatile JsonNode agentMetrics;
66+
private boolean retryImmediately = false;
67+
6968
/**
7069
* @param proxyId Proxy UUID.
7170
* @param proxyConfig Proxy settings.
@@ -87,13 +86,18 @@ public ProxyCheckInScheduler(
8786
this.agentConfigurationConsumer = agentConfigurationConsumer;
8887
this.shutdownHook = shutdownHook;
8988
this.truncateBacklog = truncateBacklog;
89+
9090
updateProxyMetrics();
91+
9192
Map<String, AgentConfiguration> configList = checkin();
93+
sendConfig();
94+
9295
if (configList == null && retryImmediately) {
9396
// immediately retry check-ins if we need to re-attempt
9497
// due to changing the server endpoint URL
9598
updateProxyMetrics();
9699
configList = checkin();
100+
sendPreprocessorRules();
97101
}
98102
if (configList != null && !configList.isEmpty()) {
99103
logger.info("initial configuration is available, setting up proxy");
@@ -102,7 +106,6 @@ public ProxyCheckInScheduler(
102106
successfulCheckIns.incrementAndGet();
103107
}
104108
}
105-
hostname = proxyConfig.getHostname();
106109
}
107110

108111
/** Set up and schedule regular check-ins. */
@@ -126,6 +129,27 @@ public void shutdown() {
126129
executor.shutdown();
127130
}
128131

132+
private void sendConfig() {
133+
try {
134+
apiContainer
135+
.getProxyV2APIForTenant(APIContainer.CENTRAL_TENANT_NAME)
136+
.proxySaveConfig(proxyId, proxyConfig.getJsonConfig());
137+
} catch (javax.ws.rs.NotFoundException ex) {
138+
logger.debug("'proxySaveConfig' api end point not found", ex);
139+
}
140+
}
141+
142+
/** Send preprocessor rules */
143+
private void sendPreprocessorRules() {
144+
try {
145+
apiContainer
146+
.getProxyV2APIForTenant(APIContainer.CENTRAL_TENANT_NAME)
147+
.proxySavePreprocessorRules(proxyId, PreprocessorConfigManager.getJsonRules());
148+
} catch (javax.ws.rs.NotFoundException ex) {
149+
logger.debug("'proxySavePreprocessorRules' api end point not found", ex);
150+
}
151+
}
152+
129153
/**
130154
* Perform agent check-in and fetch configuration of the daemon from remote server.
131155
*
@@ -307,6 +331,7 @@ private Map<String, AgentConfiguration> checkin() {
307331
void updateConfiguration() {
308332
try {
309333
Map<String, AgentConfiguration> configList = checkin();
334+
sendPreprocessorRules();
310335
if (configList != null && !configList.isEmpty()) {
311336
AgentConfiguration config;
312337
for (Map.Entry<String, AgentConfiguration> configEntry : configList.entrySet()) {
@@ -345,8 +370,7 @@ void updateProxyMetrics() {
345370
try {
346371
Map<String, String> pointTags = new HashMap<>(proxyConfig.getAgentMetricsPointTags());
347372
pointTags.put("processId", ID);
348-
// MONIT-27856 Adds real hostname (fqdn if possible) as internal metric tag
349-
pointTags.put("hostname", hostname);
373+
pointTags.put("hostname", proxyConfig.getHostname());
350374
synchronized (executor) {
351375
agentMetrics =
352376
JsonMetricsGenerator.generateJsonMetrics(

0 commit comments

Comments
 (0)