use of com.vmware.vim25.KeyValue in project data-prepper by opensearch-project.
the class RawEventTest method testRawEventWithAttributes.
@Test
public void testRawEventWithAttributes() {
final KeyValue childAttr1 = KeyValue.newBuilder().setKey("statement").setValue(AnyValue.newBuilder().setIntValue(1_000).build()).build();
final KeyValue childAttr2 = KeyValue.newBuilder().setKey("statement.params").setValue(AnyValue.newBuilder().setStringValue("us-east-1").build()).build();
final Span.Event spanEvent = Span.Event.newBuilder().setName("Error").setTimeUnixNano(1598013600000000321L).addAllAttributes(Arrays.asList(childAttr1, childAttr2)).build();
final RawEvent rawEvent = RawEvent.buildRawEvent(spanEvent);
assertThat(rawEvent.getAttributes().size() == 2).isTrue();
assertThat((Long) rawEvent.getAttributes().get(childAttr1.getKey()) == childAttr1.getValue().getIntValue()).isTrue();
assertThat(rawEvent.getAttributes().get(OTelProtoHelper.REPLACE_DOT_WITH_AT.apply(childAttr2.getKey())).equals(childAttr2.getValue().getStringValue())).isTrue();
assertThat(rawEvent.getName().equals("Error")).isTrue();
assertThat(rawEvent.getTime().equals("2020-08-21T12:40:00.000000321Z")).isTrue();
}
use of com.vmware.vim25.KeyValue in project data-prepper by opensearch-project.
the class RawLinkTest method testRawEventWithAttributes.
@Test
public void testRawEventWithAttributes() throws DecoderException {
final KeyValue childAttr1 = KeyValue.newBuilder().setKey("statement").setValue(AnyValue.newBuilder().setIntValue(1_000).build()).build();
final KeyValue childAttr2 = KeyValue.newBuilder().setKey("statement.params").setValue(AnyValue.newBuilder().setStringValue("us-east-1").build()).build();
final Span.Link spanLink = Span.Link.newBuilder().setSpanId(ByteString.copyFrom(TestUtils.getRandomBytes(8))).setTraceId(ByteString.copyFrom(TestUtils.getRandomBytes(16))).setTraceState("Some State").addAllAttributes(Arrays.asList(childAttr1, childAttr2)).build();
final RawLink rawLink = RawLink.buildRawLink(spanLink);
assertThat(rawLink.getAttributes().size() == 2).isTrue();
assertThat((Long) rawLink.getAttributes().get(childAttr1.getKey()) == childAttr1.getValue().getIntValue()).isTrue();
assertThat(rawLink.getAttributes().get(OTelProtoHelper.REPLACE_DOT_WITH_AT.apply(childAttr2.getKey())).equals(childAttr2.getValue().getStringValue())).isTrue();
assertThat(rawLink.getTraceState().equals("Some State")).isTrue();
assertThat(ByteString.copyFrom(Hex.decodeHex(rawLink.getTraceId())).equals(spanLink.getTraceId())).isTrue();
assertThat(ByteString.copyFrom(Hex.decodeHex(rawLink.getSpanId())).equals(spanLink.getSpanId())).isTrue();
}
use of com.vmware.vim25.KeyValue in project cs-actions by CloudSlang.
the class DeployOvfTemplateService method getOvfCreateImportSpecParams.
private OvfCreateImportSpecParams getOvfCreateImportSpecParams(final VmInputs vmInputs, final ManagedObjectReference hostSystem, final List ovfNetworkMappings, final List<KeyValue> ovfPropertyMappings) {
final OvfCreateImportSpecParams params = new OvfCreateImportSpecParams();
params.setHostSystem(hostSystem);
params.setDeploymentOption("");
params.setLocale(String.valueOf(vmInputs.getLocale()));
params.setEntityName(vmInputs.getVirtualMachineName());
params.setIpAllocationPolicy(vmInputs.getIpAllocScheme());
params.setIpProtocol(vmInputs.getIpProtocol());
params.setDiskProvisioning(vmInputs.getDiskProvisioning());
params.getNetworkMapping().addAll(ovfNetworkMappings);
params.getPropertyMapping().addAll(ovfPropertyMappings);
return params;
}
use of com.vmware.vim25.KeyValue in project wavefront-proxy by wavefrontHQ.
the class OtlpProtobufUtilsTest method transformSpanConvertsResourceAttributesToAnnotations.
@Test
public void transformSpanConvertsResourceAttributesToAnnotations() {
List<KeyValue> resourceAttrs = Collections.singletonList(otlpAttribute("r-key", "r-value"));
wavefront.report.Span expectedSpan = OtlpTestHelpers.wfSpanGenerator(Collections.singletonList(new Annotation("r-key", "r-value"))).build();
actualSpan = OtlpProtobufUtils.transformSpan(OtlpTestHelpers.otlpSpanGenerator().build(), resourceAttrs, null, null, "test-source");
assertWFSpanEquals(expectedSpan, actualSpan);
}
use of com.vmware.vim25.KeyValue in project wavefront-proxy by wavefrontHQ.
the class OtlpProtobufUtilsTest method transformSpanGivesSpanAttributesHigherPrecedenceThanResourceAttributes.
@Test
public void transformSpanGivesSpanAttributesHigherPrecedenceThanResourceAttributes() {
String key = "the-key";
Span otlpSpan = OtlpTestHelpers.otlpSpanGenerator().addAttributes(otlpAttribute(key, "span-value")).build();
List<KeyValue> resourceAttrs = Collections.singletonList(otlpAttribute(key, "rsrc-value"));
actualSpan = OtlpProtobufUtils.transformSpan(otlpSpan, resourceAttrs, null, null, "test-source");
assertThat(actualSpan.getAnnotations(), not(hasItem(new Annotation(key, "rsrc-value"))));
assertThat(actualSpan.getAnnotations(), hasItem(new Annotation(key, "span-value")));
}
Aggregations