use of zipkin2.Annotation in project zipkin-gcp by openzipkin.
the class LabelExtractor method extract.
/**
* Extracts the Stackdriver span labels that are equivalent to the Zipkin Span annotations.
*
* @param zipkinSpan The Zipkin Span
* @return A map of the Stackdriver span labels equivalent to the Zipkin annotations.
*/
Map<String, String> extract(Span zipkinSpan) {
Map<String, String> result = new LinkedHashMap<>();
for (Map.Entry<String, String> tag : zipkinSpan.tags().entrySet()) {
result.put(getLabelName(tag.getKey()), tag.getValue());
}
// trace might not show the final destination.
if (zipkinSpan.localEndpoint() != null && zipkinSpan.kind() == Span.Kind.SERVER) {
if (zipkinSpan.localEndpoint().ipv4() != null) {
result.put(getLabelName("endpoint.ipv4"), zipkinSpan.localEndpoint().ipv4());
}
if (zipkinSpan.localEndpoint().ipv6() != null) {
result.put(getLabelName("endpoint.ipv6"), zipkinSpan.localEndpoint().ipv6());
}
}
for (Annotation annotation : zipkinSpan.annotations()) {
result.put(getLabelName(annotation.value()), formatTimestamp(annotation.timestamp()));
}
if (zipkinSpan.localEndpoint() != null && !zipkinSpan.localEndpoint().serviceName().isEmpty()) {
result.put(kComponentLabelKey, zipkinSpan.localEndpoint().serviceName());
}
if (zipkinSpan.parentId() == null) {
String agentName = System.getProperty("stackdriver.trace.zipkin.agent", "zipkin-java");
result.put(kAgentLabelKey, agentName);
}
return result;
}
use of zipkin2.Annotation in project libSBOLj by SynBioDex.
the class AnnotationTest method test_toString.
@Test
public void test_toString() throws SBOLValidationException {
Annotation CD_annot = gRNA_b_gene.createAnnotation(new QName(prURI, "protein", "pr"), true);
// System.out.println(CD_annot.toString());
assertTrue(CD_annot.toString().contains("value=" + true));
}
use of zipkin2.Annotation in project libSBOLj by SynBioDex.
the class AnnotationOutput method main.
public static void main(String[] args) throws Exception {
String prURI = "http://partsregistry.org/";
String prPrefix = "pr";
SBOLDocument document = new SBOLDocument();
document.setDefaultURIprefix(prURI);
document.setTypesInURIs(true);
document.addNamespace(URI.create(prURI), prPrefix);
ComponentDefinition promoter = document.createComponentDefinition("BBa_J23119", "", new HashSet<URI>(Arrays.asList(URI.create("http://www.biopax.org/release/biopax-level3.owl#DnaRegion"))));
promoter.addRole(SequenceOntology.PROMOTER);
promoter.setName("J23119");
promoter.setDescription("Constitutive promoter");
promoter.createAnnotation(new QName(prURI, "group", prPrefix), "iGEM2006_Berkeley");
promoter.createAnnotation(new QName(prURI, "experience", prPrefix), URI.create("http://parts.igem.org/cgi/partsdb/part_info.cgi?part_name=BBa_J23119"));
Annotation sigmaFactor = new Annotation(QName(prURI, "sigmafactor", prPrefix), "//rnap/prokaryote/ecoli/sigma70");
Annotation regulation = new Annotation(QName(prURI, "regulation", prPrefix), "//regulation/constitutive");
promoter.createAnnotation(new QName(prURI, "information", prPrefix), new QName(prURI, "Information", prPrefix), URI.create("http://partsregistry.org/cd/BBa_J23119/information"), new ArrayList<Annotation>(Arrays.asList(sigmaFactor, regulation)));
SBOLWriter.write(document, (System.out));
}
Aggregations