-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: remove high cardinality metrics (#406)
* removing high cardinality metrics * removing content_length as well * adding smoke test
- Loading branch information
Showing
4 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
...xtensions/src/main/java/org/hypertrace/agent/otel/extensions/MetricViewConfiguration.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,53 @@ | ||
/* | ||
* Copyright The Hypertrace Authors | ||
* | ||
* 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 org.hypertrace.agent.otel.extensions; | ||
|
||
import io.opentelemetry.sdk.metrics.View; | ||
import java.util.Arrays; | ||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
public class MetricViewConfiguration { | ||
|
||
public static View createView() { | ||
// Attributes to exclude | ||
Set<String> excludedAttributes = | ||
new HashSet<>( | ||
Arrays.asList( | ||
"net.sock.peer.addr", | ||
"net.sock.peer.port", | ||
"http.user_agent", | ||
"enduser.id", | ||
"http.client_ip", | ||
"http.request_content_length", | ||
"http.response_content_length", | ||
"user_agent.original")); | ||
|
||
// Build the view | ||
return View.builder() | ||
.setAttributeFilter( | ||
attributes -> { | ||
for (String attribute : excludedAttributes) { | ||
if (attributes.contains(attribute)) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
}) | ||
.build(); | ||
} | ||
} |
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