Skip to content
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

stats/opentelemetry: add trace event for name resolution delay #7992

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
c00f232
final rebase with master
aranjans Dec 9, 2024
ac9826d
update e2e tests
aranjans Dec 9, 2024
b5d2dda
fix e2e tests
aranjans Dec 10, 2024
c2b7532
remove fmt logs
aranjans Dec 10, 2024
b6b0b54
move grpc_trace_bin_propagator to experimental
aranjans Dec 11, 2024
9236837
move TraceOptions api to experimental
aranjans Dec 11, 2024
620680f
addressed purnesh's comments
aranjans Dec 16, 2024
33b145c
don't change opentelemetry/e2e_test.go package name from opentelemetr…
aranjans Dec 16, 2024
c771077
make vet happy
aranjans Dec 16, 2024
0baa3c8
update TestServerWithMetricsAndTraceOptions
aranjans Dec 17, 2024
18bbf3f
fixed nits
aranjans Dec 17, 2024
666f07a
fixed nits
aranjans Dec 17, 2024
ef4009b
fix: small nits
aranjans Dec 18, 2024
72bec73
Add test with metrics and traces disabled.
aranjans Dec 19, 2024
94e3b2a
make vet happy
aranjans Dec 19, 2024
fe99ea7
pull out logic to find name resolution delay
aranjans Dec 20, 2024
c95ee24
remove experimental notice from grpc_trace_bin_propagator
aranjans Dec 20, 2024
d954daf
refactor and addressed comments from doug
aranjans Dec 23, 2024
f583aaa
Add copyright notice to client_tracing.go
aranjans Dec 23, 2024
8c65f1a
let client set the propagator and trace provider
aranjans Dec 24, 2024
a1dabbf
fix breaking tests
aranjans Dec 24, 2024
669191c
move call span creation to client_tracing.go
aranjans Jan 2, 2025
3d9570e
A72: add event for name resolution delay
aranjans Jan 7, 2025
642deec
A72: add tracing event for name resolution delay
aranjans Jan 9, 2025
af9b139
make vet happy
aranjans Jan 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixed nits
  • Loading branch information
aranjans committed Jan 9, 2025
commit 666f07a32f66ad7f5383639b2fa5a5fb155948e7
40 changes: 20 additions & 20 deletions stats/opentelemetry/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"time"

otelcodes "go.opentelemetry.io/otel/codes"
trace2 "go.opentelemetry.io/otel/trace"
oteltrace "go.opentelemetry.io/otel/trace"

v3clusterpb "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3"
v3corepb "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
Expand Down Expand Up @@ -685,11 +685,11 @@ func (s) TestMetricsAndTracesOptionEnabled(t *testing.T) {
// enabled, makes a unary RPC, and streaming RPC as well.
//
// Verification:
// - Ensures that the span context is correctly propagated from the client
// - Verifies that the span context is correctly propagated from the client
// to the server, including the trace ID and span ID.
// - Confirms that the server can access the span context and create
// - Verifies that the server can access the span context and create
// child spans as expected during the RPC calls.
// - Validates that the tracing information is recorded accurately in
// - Verifies that the tracing information is recorded accurately in
// the OpenTelemetry backend.
func (s) TestSpan(t *testing.T) {
// Using defaultTraceOptions to set up OpenTelemetry with an in-memory exporter
Expand All @@ -713,11 +713,11 @@ func (s) TestSpan(t *testing.T) {
if err != nil {
t.Fatalf("ss.Client.FullDuplexCall failed: %f", err)
}

stream.CloseSend()
if _, err = stream.Recv(); err != io.EOF {
t.Fatalf("stream.Recv received an unexpected error: %v, expected an EOF error", err)
}

// Get the spans from the exporter
spans := spanExporter.GetSpans()
if got, want := len(spans), 6; got != want {
Expand All @@ -727,7 +727,7 @@ func (s) TestSpan(t *testing.T) {
wantSI := []traceSpanInfo{
{
name: "grpc.testing.TestService.UnaryCall",
spanKind: trace2.SpanKindServer.String(),
spanKind: oteltrace.SpanKindServer.String(),
attributes: []attribute.KeyValue{
{
Key: "Client",
Expand Down Expand Up @@ -785,7 +785,7 @@ func (s) TestSpan(t *testing.T) {
},
{
name: "Attempt.grpc.testing.TestService.UnaryCall",
spanKind: trace2.SpanKindInternal.String(),
spanKind: oteltrace.SpanKindInternal.String(),
attributes: []attribute.KeyValue{
{
Key: "Client",
Expand Down Expand Up @@ -843,13 +843,13 @@ func (s) TestSpan(t *testing.T) {
},
{
name: "grpc.testing.TestService.UnaryCall",
spanKind: trace2.SpanKindClient.String(),
spanKind: oteltrace.SpanKindClient.String(),
attributes: []attribute.KeyValue{},
events: []trace.Event{},
},
{
name: "grpc.testing.TestService.FullDuplexCall",
spanKind: trace2.SpanKindServer.String(),
spanKind: oteltrace.SpanKindServer.String(),
attributes: []attribute.KeyValue{
{
Key: "Client",
Expand All @@ -872,13 +872,13 @@ func (s) TestSpan(t *testing.T) {
},
{
name: "grpc.testing.TestService.FullDuplexCall",
spanKind: trace2.SpanKindClient.String(),
spanKind: oteltrace.SpanKindClient.String(),
attributes: []attribute.KeyValue{},
events: []trace.Event{},
},
{
name: "Attempt.grpc.testing.TestService.FullDuplexCall",
spanKind: trace2.SpanKindInternal.String(),
spanKind: oteltrace.SpanKindInternal.String(),
attributes: []attribute.KeyValue{
{
Key: "Client",
Expand Down Expand Up @@ -968,11 +968,11 @@ func (s) TestSpan(t *testing.T) {
// number of spans are created with the expected spans.
//
// Verification:
// - Confirms that the correct number of spans are created for both unary and
// - Verifies that the correct number of spans are created for both unary and
// streaming RPCs.
// - Validates that the spans have the expected names and attributes, ensuring
// - Verifies that the spans have the expected names and attributes, ensuring
// they accurately reflect the operations performed.
// - Checks that the trace ID and span ID are correctly assigned and accessible
// - Verifies that the trace ID and span ID are correctly assigned and accessible
// in the OpenTelemetry backend.
func (s) TestSpan_WithW3CContextPropagator(t *testing.T) {
// Using defaultTraceOptions to set up OpenTelemetry with an in-memory exporter
Expand Down Expand Up @@ -1012,7 +1012,7 @@ func (s) TestSpan_WithW3CContextPropagator(t *testing.T) {
wantSI := []traceSpanInfo{
{
name: "grpc.testing.TestService.UnaryCall",
spanKind: trace2.SpanKindServer.String(),
spanKind: oteltrace.SpanKindServer.String(),
attributes: []attribute.KeyValue{
{
Key: "Client",
Expand Down Expand Up @@ -1070,7 +1070,7 @@ func (s) TestSpan_WithW3CContextPropagator(t *testing.T) {
},
{
name: "Attempt.grpc.testing.TestService.UnaryCall",
spanKind: trace2.SpanKindInternal.String(),
spanKind: oteltrace.SpanKindInternal.String(),
attributes: []attribute.KeyValue{
{
Key: "Client",
Expand Down Expand Up @@ -1128,13 +1128,13 @@ func (s) TestSpan_WithW3CContextPropagator(t *testing.T) {
},
{
name: "grpc.testing.TestService.UnaryCall",
spanKind: trace2.SpanKindClient.String(),
spanKind: oteltrace.SpanKindClient.String(),
attributes: []attribute.KeyValue{},
events: []trace.Event{},
},
{
name: "grpc.testing.TestService.FullDuplexCall",
spanKind: trace2.SpanKindServer.String(),
spanKind: oteltrace.SpanKindServer.String(),
attributes: []attribute.KeyValue{
{
Key: "Client",
Expand All @@ -1157,13 +1157,13 @@ func (s) TestSpan_WithW3CContextPropagator(t *testing.T) {
},
{
name: "grpc.testing.TestService.FullDuplexCall",
spanKind: trace2.SpanKindClient.String(),
spanKind: oteltrace.SpanKindClient.String(),
attributes: []attribute.KeyValue{},
events: []trace.Event{},
},
{
name: "Attempt.grpc.testing.TestService.FullDuplexCall",
spanKind: trace2.SpanKindInternal.String(),
spanKind: oteltrace.SpanKindInternal.String(),
attributes: []attribute.KeyValue{
{
Key: "Client",
Expand Down
2 changes: 1 addition & 1 deletion stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth
}
var mc serviceconfig.MethodConfig
var onCommit func()
var newStream = func(ctx context.Context, done func()) (iresolver.ClientStream, error) {
newStream := func(ctx context.Context, done func()) (iresolver.ClientStream, error) {
return newClientStreamWithParams(ctx, desc, cc, method, mc, onCommit, done, cc.nameResolutionDelayed, opts...)
}

Expand Down