Skip to content

Add instrumentation API usage and native OpenTelemetry implementation #771

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

Merged
merged 16 commits into from
Dec 21, 2023
Merged
Changes from 1 commit
Commits
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
regroup cluster id and node name test in AfterResponse
  • Loading branch information
Anaethelion committed Dec 14, 2023
commit 270a6f8ca675c83a18ffbb46da47af932e282591
15 changes: 8 additions & 7 deletions elasticsearch_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1008,12 +1008,13 @@ func (c *FakeInstrumentation) RecordError(ctx context.Context, err error) {
c.Error = err
}

func (c *FakeInstrumentation) RecordClusterId(ctx context.Context, id string) {
c.ClusterId = id
}

func (c *FakeInstrumentation) RecordNodeName(ctx context.Context, name string) {
c.NodeName = name
func (c *FakeInstrumentation) AfterResponse(ctx context.Context, res *http.Response) {
if id := res.Header.Get("X-Found-Handling-Cluster"); id != "" {
c.ClusterId = id
}
if name := res.Header.Get("X-Found-Handling-Instance"); name != "" {
c.NodeName = name
}
}

func (c *FakeInstrumentation) RecordPathPart(ctx context.Context, pathPart, value string) {
Expand All @@ -1025,7 +1026,7 @@ func (c *FakeInstrumentation) RecordQuery(ctx context.Context, endpoint string,
if !c.PersistQuery {
return nil
}

buf := bytes.Buffer{}
buf.ReadFrom(query)
c.Query = buf.String()
Expand Down