Add Circle ci (#41)

* fix compile errors.

* fix lint errors.

* add circle-ci job.

* rename IDHigh to TraceIDHigh

* rename the file.

* add go get for goimports and golangci-lint

* enable GO111MODULE and remove comments.

* remove working dir and update cache name

* Add TEST_RESULT env back.

* run go mod tidy.

* remove go mod download.

* add test coverage.

* fix TraceID.

* fix circlefi config error.

* remove install-tools.

* remove ALL_TEST_SRC from Makefile.
This commit is contained in:
rghetia
2019-07-02 16:21:24 -07:00
committed by GitHub
parent 74eda41032
commit 20b2f718b8
20 changed files with 184 additions and 733 deletions
+7 -7
View File
@@ -21,13 +21,13 @@ import (
type EventID uint64
type TraceID struct {
IDHigh uint64
IDLow uint64
High uint64
Low uint64
}
type SpanContext struct {
TraceID
SpanID uint64
TraceID TraceID
SpanID uint64
}
type ScopeID struct {
@@ -48,7 +48,7 @@ var (
)
func (sc SpanContext) HasTraceID() bool {
return sc.TraceIDHigh != 0 || sc.TraceIDLow != 0
return sc.TraceID.High != 0 || sc.TraceID.Low != 0
}
func (sc SpanContext) HasSpanID() bool {
@@ -61,8 +61,8 @@ func (sc SpanContext) SpanIDString() string {
}
func (sc SpanContext) TraceIDString() string {
p1 := fmt.Sprintf("%.16x", sc.TraceIDHigh)
p2 := fmt.Sprintf("%.16x", sc.TraceIDLow)
p1 := fmt.Sprintf("%.16x", sc.TraceID.High)
p2 := fmt.Sprintf("%.16x", sc.TraceID.Low)
return p1[0:3] + ".." + p2[13:16]
}
+4
View File
@@ -65,6 +65,10 @@ func (bm *baseMetric) base() *baseMetric {
return bm
}
func (bm *baseMetric) DefinitionID() core.EventID {
return bm.eventID
}
func (bm *baseMetric) Measure() core.Measure {
return bm.measure
}
+1 -1
View File
@@ -197,7 +197,7 @@ type measure struct {
rk *registeredKey
}
var _ core.Mearsure = (*measure)(nil)
var _ core.Measure = (*measure)(nil)
func (m measure) M(v float64) core.Measurement {
return core.Measurement{
+28
View File
@@ -0,0 +1,28 @@
// Copyright 2019, OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package trace
import (
"testing"
)
// GlobalTracer return tracer registered with global registry.
// If no tracer is registered then an instance of noop Tracer is returned.
func TestGlobalTracer(t *testing.T) {
tracer := GlobalTracer()
if tracer == nil {
t.Fatalf("Failed to get tracer\n")
}
}
+1 -8
View File
@@ -44,7 +44,6 @@ func (sp *noopSpan) IsRecordingEvents() bool {
// SetStatus does nothing.
func (sp *noopSpan) SetStatus(status codes.Code) {
return
}
// ScopeID returns and empty ScopeID.
@@ -54,37 +53,31 @@ func (sp *noopSpan) ScopeID() core.ScopeID {
// SetError does nothing.
func (sp *noopSpan) SetError(v bool) {
return
}
// SetAttribute does nothing.
func (sp *noopSpan) SetAttribute(attribute core.KeyValue) {
return
}
// SetAttributes does nothing.
func (sp *noopSpan) SetAttributes(attributes ...core.KeyValue) {
return
}
// ModifyAttribute does nothing.
func (sp *noopSpan) ModifyAttribute(mutator core.Mutator) {
return
}
// ModifyAttributes does nothing.
func (sp *noopSpan) ModifyAttributes(mutators ...core.Mutator) {
return
}
// Finish does nothing.
func (sp *noopSpan) Finish() {
return
}
// Tracer returns noop implementation of Tracer.
func (sp *noopSpan) Tracer() Tracer {
return t
return nt
}
// AddEvent does nothing.
+1 -1
View File
@@ -68,4 +68,4 @@ func (t *noopTracer) Start(ctx context.Context, name string, opts ...SpanOption)
func (t *noopTracer) Inject(ctx context.Context, span Span, injector Injector) {
}
var _ Injector = (*noopTracer)(nil)
var _ Tracer = (*noopTracer)(nil)