-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ipc: add option to disable inflight (#1150)
The inflight metrics are poorly modeled and can often be confusing. They do not aggregate as expected so aren't really meaningful unless you understand the full set of dimensions used. Add option to disable them. Cannot remove for now due to backwards compatibility.
- Loading branch information
1 parent
b9630ce
commit fa54768
Showing
4 changed files
with
192 additions
and
30 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
76 changes: 76 additions & 0 deletions
76
spectator-ext-ipc/src/main/java/com/netflix/spectator/ipc/IpcLoggerConfig.java
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,76 @@ | ||
/* | ||
* Copyright 2014-2024 Netflix, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.netflix.spectator.ipc; | ||
|
||
/** | ||
* Configuration settings for IpcLogger. | ||
*/ | ||
public interface IpcLoggerConfig { | ||
|
||
/** | ||
* Get the value for a given key or return null if it is not present. | ||
*/ | ||
String get(String key); | ||
|
||
/** | ||
* Get the value for a given key or return the specified default if it is not present. | ||
*/ | ||
default String get(String key, String dflt) { | ||
String v = get(key); | ||
return v == null ? dflt : v; | ||
} | ||
|
||
/** | ||
* Get the value for a given key or return the specified default if it is not present. | ||
*/ | ||
default int getInt(String key, int dflt) { | ||
int n = dflt; | ||
String v = get(key, Integer.toString(n)); | ||
try { | ||
n = Integer.parseInt(v); | ||
} catch (NumberFormatException ignored) { | ||
} | ||
return n; | ||
} | ||
|
||
/** | ||
* Determines whether the metrics for number of in flight requests will be generated. | ||
* These metrics are poorly modeled and often lead to confusion. To estimate number | ||
* of in flight requests for a given scope, Little's law can be used along with the | ||
* latency metrics. Defaults to true for backwards compatibility. | ||
*/ | ||
default boolean inflightMetricsEnabled() { | ||
String v = get("spectator.ipc.inflight-metrics-enabled", "true"); | ||
return "true".equals(v); | ||
} | ||
|
||
/** | ||
* Limit to use for the cardinality limiter applied on a given tag key. IPC metrics | ||
* have many dimensions and a high volume, be careful with increasing the limit as | ||
* it can easily cause a large increase. | ||
*/ | ||
default int cardinalityLimit(String tagKey) { | ||
String propKey = "spectator.ipc.cardinality-limit." + tagKey; | ||
return getInt(propKey, 25); | ||
} | ||
|
||
/** | ||
* Size to use for the queue of reusable logger entries. | ||
*/ | ||
default int entryQueueSize() { | ||
return getInt("spectator.ipc.entry-queue-size", 1000); | ||
} | ||
} |
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