1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-10-31 00:07:40 +02:00

fix(observ): correct rejected items and update comment style (#7502)

- correct rejected items in `TestInstrumentationExportLogPartialErrors`
- fmt imports and update comment style

---------

Co-authored-by: Damien Mathieu <42@dmathieu.com>
This commit is contained in:
ian
2025-10-15 17:05:24 +08:00
committed by GitHub
parent 86e673ca6d
commit ee0c2037b3
2 changed files with 8 additions and 9 deletions

View File

@@ -12,14 +12,13 @@ import (
"sync"
"time"
"go.opentelemetry.io/otel/internal/global"
"google.golang.org/grpc/status"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc/internal"
"go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc/internal/x"
"go.opentelemetry.io/otel/internal/global"
"go.opentelemetry.io/otel/metric"
semconv "go.opentelemetry.io/otel/semconv/v1.37.0"
"go.opentelemetry.io/otel/semconv/v1.37.0/otelconv"
@@ -38,12 +37,12 @@ const (
var (
attrsPool = &sync.Pool{
New: func() any {
const n = 1 /* component.name */ +
1 /* component.type */ +
1 /* server.addr */ +
1 /* server.port */ +
1 /* error.type */ +
1 /* rpc.grpc.status_code */
const n = 1 + // component.name
1 + // component.type
1 + // server.addr
1 + // server.port
1 + // error.type
1 // rpc.grpc.status_code
s := make([]attribute.KeyValue, 0, n)
// Return a pointer to a slice instead of a slice itself
// to avoid allocations on every call.

View File

@@ -264,7 +264,7 @@ func TestInstrumentationExportLogPartialErrors(t *testing.T) {
const n = 10
const success = 5
err := internal.PartialSuccess{RejectedItems: success}
err := internal.PartialSuccess{RejectedItems: n - success}
inst.ExportLogs(t.Context(), n).End(err)
assertMetrics(t, collect(), n, success, err, status.Code(err))