Skip to content

Commit cc4576e

Browse files
committed
Improve log statement
1 parent 9b37454 commit cc4576e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

custom/src/main/java/com/splunk/opentelemetry/resource/TruncateCommandLineResourceDetector.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@
3333
@SuppressWarnings("rawtypes")
3434
@AutoService(ComponentProvider.class)
3535
public class TruncateCommandLineResourceDetector implements ComponentProvider<Resource> {
36-
private static final int MAX_COMMAND_LINE_LENGTH = 255;
3736
private static final Logger logger =
3837
Logger.getLogger(TruncateCommandLineResourceDetector.class.getName());
3938

39+
private static final int MAX_COMMAND_LINE_LENGTH = 255;
40+
4041
@Override
4142
public Class<Resource> getType() {
4243
return Resource.class;
@@ -53,7 +54,7 @@ public Resource create(DeclarativeConfigProperties config) {
5354

5455
List<String> commandArgs = resource.getAttribute(PROCESS_COMMAND_ARGS);
5556
if (commandArgs != null) {
56-
logger.fine(() -> "Truncate resource attribute" + PROCESS_COMMAND_ARGS.getKey());
57+
logger.fine(() -> "Truncate resource attribute " + PROCESS_COMMAND_ARGS.getKey());
5758
List<String> newCommandArgs = truncate(commandArgs, MAX_COMMAND_LINE_LENGTH);
5859
if (newCommandArgs != null) {
5960
resource =
@@ -63,7 +64,7 @@ public Resource create(DeclarativeConfigProperties config) {
6364

6465
String commandLine = resource.getAttribute(PROCESS_COMMAND_LINE);
6566
if (commandLine != null && commandLine.length() > MAX_COMMAND_LINE_LENGTH) {
66-
logger.fine(() -> "Truncate resource attribute" + PROCESS_COMMAND_LINE.getKey());
67+
logger.fine(() -> "Truncate resource attribute " + PROCESS_COMMAND_LINE.getKey());
6768
String newCommandLine = commandLine.substring(0, MAX_COMMAND_LINE_LENGTH - 3) + "...";
6869
resource =
6970
resource.merge(Resource.create(Attributes.of(PROCESS_COMMAND_LINE, newCommandLine)));

0 commit comments

Comments
 (0)