-
Notifications
You must be signed in to change notification settings - Fork 864
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated v1_11 tests to account for dynamodb
- Loading branch information
Showing
8 changed files
with
107 additions
and
19 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
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
63 changes: 63 additions & 0 deletions
63
...testing/src/main/java/io/opentelemetry/instrumentation/awssdk/v1_11/AttributeKeyPair.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,63 @@ | ||
package io.opentelemetry.instrumentation.awssdk.v1_11; | ||
|
||
import groovyjarjarantlr4.v4.runtime.misc.Nullable; | ||
import io.opentelemetry.api.common.AttributeKey; | ||
import io.opentelemetry.api.common.AttributeType; | ||
import java.util.List; | ||
|
||
public class AttributeKeyPair<T> { | ||
|
||
private final AttributeKey<T> key; | ||
private final T value; | ||
|
||
AttributeKeyPair(AttributeKey<T> key, T value) { | ||
this.key = key; | ||
this.value = value; | ||
} | ||
|
||
public static AttributeKeyPair<String> createStringKeyPair(String keyString, String val) { | ||
return new AttributeKeyPair<>(AttributeKey.stringKey(keyString), val); | ||
} | ||
|
||
public static AttributeKeyPair<List<String>> createStringArrayKeyPair(String keyString, List<String> val) { | ||
return new AttributeKeyPair<>(AttributeKey.stringArrayKey(keyString), val); | ||
} | ||
|
||
public AttributeType getType() { | ||
return key.getType(); | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
public AttributeKey<String> getStringKey() { | ||
if (key.getType() != AttributeType.STRING){ | ||
return null; | ||
} | ||
return (AttributeKey<String>) key; | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
@Nullable | ||
public AttributeKey<List<String>> getStringArrayKey() { | ||
if (key.getType() != AttributeType.STRING_ARRAY) { | ||
return null; | ||
} | ||
return (AttributeKey<List<String>>) key; | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
public String getStringVal(){ | ||
if (key.getType() != AttributeType.STRING){ | ||
return null; | ||
} | ||
return (String) value; | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
@Nullable | ||
public List<String> getStringArrayVal(){ | ||
if (key.getType() != AttributeType.STRING_ARRAY){ | ||
return null; | ||
} | ||
return (List<String>)value; | ||
} | ||
} |