Commit c0650800 authored by pengys5's avatar pengys5
Browse files

Merge remote-tracking branch 'origin/feature/3.0' into feature/collector

parents 419b40a3 590d93f0
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ Sky Walking
SkyWalking: Large-Scale Distributed Systems Tracing Infrastructure, also known Distributed Tracer.

[![Build Status](https://travis-ci.org/wu-sheng/sky-walking.svg?branch=master)](https://travis-ci.org/wu-sheng/sky-walking)
[![Coverage Status](https://coveralls.io/repos/github/wu-sheng/sky-walking/badge.svg?branch=master)](https://coveralls.io/github/wu-sheng/sky-walking?branch=master)
![license](https://img.shields.io/aur/license/yaourt.svg)
[![codebeat badge](https://codebeat.co/badges/579e4dce-1dc7-4f32-a163-c164eafa1335)](https://codebeat.co/projects/github-com-wu-sheng-sky-walking)
[![Join the chat at https://gitter.im/sky-walking/Lobby](https://badges.gitter.im/sky-walking/Lobby.svg)](https://gitter.im/sky-walking/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+3 −3
Original line number Diff line number Diff line
@@ -12,14 +12,14 @@ import java.util.Map;
 */
public class LogData {
    @Expose
    @SerializedName(value="ti")
    @SerializedName(value="tm")
    private long time;

    @Expose
    @SerializedName(value="fi")
    private Map<String, ?> fields;
    private Map<String, String> fields;

    LogData(long time, Map<String, ?> fields) {
    LogData(long time, Map<String, String> fields) {
        this.time = time;
        if(fields == null){
            throw new NullPointerException();
+0 −1
Original line number Diff line number Diff line
package com.a.eye.skywalking.trace;

import com.a.eye.skywalking.trace.TraceId.PropagatedTraceId;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.TypeAdapter;
+33 −11
Original line number Diff line number Diff line
@@ -57,8 +57,16 @@ public class Span{
     * {@see https://github.com/opentracing/specification/blob/master/specification.md#set-a-span-tag}
     */
    @Expose
    @SerializedName(value="ta")
    private final Map<String, Object> tags;
    @SerializedName(value="ts")
    private final Map<String, String> tagsWithStr;

    @Expose
    @SerializedName(value="tb")
    private final Map<String, Boolean> tagsWithBool;

    @Expose
    @SerializedName(value="ti")
    private final Map<String, Integer> tagsWithInt;

    /**
     * Log is a concept from OpenTracing spec.
@@ -151,7 +159,9 @@ public class Span{
     * Create a new/empty span.
     */
    public Span() {
        tags = new HashMap<String, Object>();
        tagsWithStr = new HashMap<String, String>(5);
        tagsWithBool = new HashMap<String, Boolean>(1);
        tagsWithInt = new HashMap<String, Integer>(2);
        logs = new LinkedList<LogData>();
    }

@@ -194,17 +204,17 @@ public class Span{
     * @return this Span instance, for chaining
     */
    public final Span setTag(String key, String value) {
        tags.put(key, value);
        tagsWithStr.put(key, value);
        return this;
    }

    public final Span setTag(String key, boolean value) {
        tags.put(key, value);
        tagsWithBool.put(key, value);
        return this;
    }

    public final Span setTag(String key, Number value) {
        tags.put(key, value);
    public final Span setTag(String key, Integer value) {
        tagsWithInt.put(key, value);
        return this;
    }

@@ -214,7 +224,11 @@ public class Span{
     * @return
     */
    public final Map<String, Object> getTags() {
        return Collections.unmodifiableMap(tags);
        Map<String, Object> tags = new HashMap<String, Object>();
        tags.putAll(tagsWithStr);
        tags.putAll(tagsWithBool);
        tags.putAll(tagsWithInt);
        return tags;
    }

    /**
@@ -223,8 +237,16 @@ public class Span{
     * @param key the given tag key.
     * @return tag value.
     */
    public Object getTag(String key) {
        return tags.get(key);
    public String getStrTag(String key) {
        return tagsWithStr.get(key);
    }

    public Boolean getBoolTag(String key) {
        return tagsWithBool.get(key);
    }

    public Integer getIntTag(String key) {
        return tagsWithInt.get(key);
    }

    /**
@@ -250,7 +272,7 @@ public class Span{
     * @return the Span, for chaining
     * @see Span#log(String)
     */
    public Span log(Map<String, ?> fields) {
    public Span log(Map<String, String> fields) {
        logs.add(new LogData(System.currentTimeMillis(), fields));
        return this;
    }
+27 −8
Original line number Diff line number Diff line
@@ -89,6 +89,16 @@ public class TraceSegment {
    @SerializedName(value = "gt")
    private DistributedTraceIds relatedGlobalTraces;

    /**
     * The <code>sampled</code> is a flag, which represent, when this {@link TraceSegment} finished, it need to be send
     * to Collector.
     *
     * Its value depends on SamplingService. True, by default.
     *
     * This value is not serialized.
     */
    private boolean sampled;

    /**
     * Create a trace segment, by given segmentId.
     * This segmentId is generated by TraceSegmentRef, AKA, from tracer/agent module.
@@ -107,6 +117,7 @@ public class TraceSegment {
        this.spans = new LinkedList<Span>();
        this.relatedGlobalTraces = new DistributedTraceIds();
        this.relatedGlobalTraces.append(new NewDistributedTraceId());
        this.sampled = true;
    }

    /**
@@ -183,6 +194,14 @@ public class TraceSegment {
        return applicationCode;
    }

    public boolean isSampled() {
        return sampled;
    }

    public void setSampled(boolean sampled) {
        this.sampled = sampled;
    }

    @Override
    public String toString() {
        return "TraceSegment{" +
Loading