You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2026-06-03 18:35:08 +02:00
Add the internal/observ package to otlptracegrpc (#7404)
- Part of #7007 - Contains a TODO tracking features added in #7401 - This package will be used to instrument `otlptracegrpc` in a follow-up PR ### Benchmarks ```terminal goos: linux goarch: amd64 pkg: go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/observ cpu: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz │ otlptracegrpc-internal-observ.bmark.result │ │ sec/op │ InstrumentationExportSpans/NoError-8 143.8n ± 4% InstrumentationExportSpans/PartialError-8 1.747µ ± 6% InstrumentationExportSpans/FullError-8 1.737µ ± 11% geomean 758.4n │ otlptracegrpc-internal-observ.bmark.result │ │ B/op │ InstrumentationExportSpans/NoError-8 0.000 ± 0% InstrumentationExportSpans/PartialError-8 753.0 ± 0% InstrumentationExportSpans/FullError-8 753.0 ± 0% geomean ¹ ¹ summaries must be >0 to compute geomean │ otlptracegrpc-internal-observ.bmark.result │ │ allocs/op │ InstrumentationExportSpans/NoError-8 0.000 ± 0% InstrumentationExportSpans/PartialError-8 4.000 ± 0% InstrumentationExportSpans/FullError-8 4.000 ± 0% geomean ¹ ¹ summaries must be >0 to compute geomean ``` --------- Co-authored-by: Robert Pająk <pellared@hotmail.com>
This commit is contained in:
@@ -29,6 +29,17 @@ func (ps PartialSuccess) Error() string {
|
||||
return fmt.Sprintf("OTLP partial success: %s (%d %s rejected)", msg, ps.RejectedItems, ps.RejectedKind)
|
||||
}
|
||||
|
||||
// As returns true if ps can be assigned to target and makes the assignment.
|
||||
// Otherwise, it returns false. This supports the errors.As() interface.
|
||||
func (ps PartialSuccess) As(target any) bool {
|
||||
t, ok := target.(*PartialSuccess)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
*t = ps
|
||||
return true
|
||||
}
|
||||
|
||||
// Is supports the errors.Is() interface.
|
||||
func (ps PartialSuccess) Is(err error) bool {
|
||||
_, ok := err.(PartialSuccess)
|
||||
|
||||
Reference in New Issue
Block a user