-
Notifications
You must be signed in to change notification settings - Fork 505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(tracing): Support for OpenTelemetry #860
Conversation
Codecov ReportBase: 77.04% // Head: 76.05% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #860 +/- ##
==========================================
- Coverage 77.04% 76.05% -1.00%
==========================================
Files 108 110 +2
Lines 12340 12698 +358
==========================================
+ Hits 9507 9657 +150
- Misses 2300 2494 +194
- Partials 533 547 +14
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Tags map[string]string `json:"tags" jsonschema:"omitempty"` | ||
Zipkin *ZipkinSpec `json:"zipkin" jsonschema:"required"` | ||
ServiceName string `json:"serviceName" jsonschema:"required,minLength=1"` | ||
Attributes map[string]string `json:"attributes" jsonschema:"omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better keep both Tags
and Attributes
, and ignore Tags
if Attributes
is not empty, this result in better backward compatibility.
pkg/tracing/tracing.go
Outdated
|
||
// Validate validates Spec. | ||
func (spec *JaegerSpec) Validate() error { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
per coding style, please remove these blank lines, and the blank lines before the closing }
of a function.
pkg/tracing/tracing.go
Outdated
return resource.Merge(resource.Default(), | ||
resource.NewWithAttributes(semconv.SchemaURL, attrs...)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
per https://github.com/golang/go/wiki/CodeReviewComments#line-length
propose not breaking a lengthy statement into several lines.
if it is too long, try breaking it into several statements, this makes the code more readable.
there are other cases.
pkg/tracing/tracing.go
Outdated
if sampleRate <= 0 { | ||
return sdktrace.NeverSample() | ||
} else if sampleRate >= 1 { | ||
return sdktrace.AlwaysSample() | ||
} else { | ||
return sdktrace.TraceIDRatioBased(sampleRate) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this makes the code more readable.
if sampleRate <= 0 { | |
return sdktrace.NeverSample() | |
} else if sampleRate >= 1 { | |
return sdktrace.AlwaysSample() | |
} else { | |
return sdktrace.TraceIDRatioBased(sampleRate) | |
} | |
if sampleRate <= 0 { | |
return sdktrace.NeverSample() | |
} | |
if sampleRate >= 1 { | |
return sdktrace.AlwaysSample() | |
} | |
return sdktrace.TraceIDRatioBased(sampleRate) |
pkg/tracing/tracing.go
Outdated
} else { | ||
if exp, err := spec.Zipkin.newExporter(); err == nil { | ||
exporters = []sdktrace.SpanExporter{exp} | ||
} else { | ||
return nil, err | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} else { | |
if exp, err := spec.Zipkin.newExporter(); err == nil { | |
exporters = []sdktrace.SpanExporter{exp} | |
} else { | |
return nil, err | |
} | |
} | |
} else if exp, err := spec.Zipkin.newExporter(); err == nil { | |
exporters = []sdktrace.SpanExporter{exp} | |
} else { | |
return nil, err | |
} |
* feat(tracing): init * fix(tracing): add propagator * fix(mod): upgrade * fix(test): add test * docs(controllers.md): update tracing spec * fix(doc): fix lint * docs(tracing.md): update * fix(tracing): Support for multiple exporter configurations * fix(tracing): add logger * fix(license): add license * fix(tracing): Backward compatible * fix(tracing): fix null pointer * fix(tracing): add tags && update doc
Zipkin
Zipkin
,Jagger
,OTLP
tracing.tags
is replaced bytracing.attributes
, in order to be consistent with the OpenTelemetry concept