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

Add support for tracking Redis client calls for non-Go programs #891

Merged
merged 13 commits into from
May 30, 2024

Conversation

grcevski
Copy link
Contributor

Added detection based on the format of the query and response. The protocol is in text format with various operators.
I added a new integration tests with OATS.

Relates to #879

@grcevski grcevski requested review from mariomac and marctc as code owners May 29, 2024 21:04
@codecov-commenter
Copy link

codecov-commenter commented May 29, 2024

Codecov Report

Attention: Patch coverage is 87.42857% with 22 lines in your changes are missing coverage. Please review.

Project coverage is 59.36%. Comparing base (a08e2ba) to head (5900591).
Report is 1 commits behind head on main.

Files Patch % Lines
pkg/internal/request/span_getters.go 14.28% 11 Missing and 1 partial ⚠️
pkg/internal/ebpf/common/tcp_detect_transform.go 70.00% 2 Missing and 1 partial ⚠️
pkg/internal/export/otel/traces.go 88.88% 2 Missing and 1 partial ⚠️
pkg/internal/export/prom/prom.go 72.72% 3 Missing ⚠️
pkg/internal/export/otel/metrics.go 88.88% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main     #891       +/-   ##
===========================================
- Coverage   77.57%   59.36%   -18.21%     
===========================================
  Files         122      123        +1     
  Lines        8594     8737      +143     
===========================================
- Hits         6667     5187     -1480     
- Misses       1482     3181     +1699     
+ Partials      445      369       -76     
Flag Coverage Δ
integration-test ?
k8s-integration-test ?
oats-test 35.12% <73.71%> (+0.91%) ⬆️
unittests 43.61% <56.00%> (+0.28%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@mariomac mariomac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AMAZING

@@ -567,6 +568,10 @@ func traceAttributes(span *request.Span, optionalAttrs map[attr.Name]struct{}) [
request.ServerPort(span.HostPort),
}
case request.EventTypeSQLClient:
attrs = []attribute.KeyValue{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I have to add this for Kafka, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that's right, we need to specify which attributes will be ON by default for kafka. We tend to select by default the attributes which will not cause cardinality explosion. Kafka operation is definitely OK to add in metrics, I think topic is too, although there will be customers with many topics. For those customers we can recommend that they remove the attribute by changing the config.

@@ -613,7 +639,7 @@ func spanKind(span *request.Span) trace2.SpanKind {
switch span.Type {
case request.EventTypeHTTP, request.EventTypeGRPC:
return trace2.SpanKindServer
case request.EventTypeHTTPClient, request.EventTypeGRPCClient, request.EventTypeSQLClient:
case request.EventTypeHTTPClient, request.EventTypeGRPCClient, request.EventTypeSQLClient, request.EventTypeRedisClient:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, do we need this for Kafka?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

RedisClientDuration.Section: {
SubGroups: []*AttrReportGroup{&appAttributes, &appKubeAttributes},
Attributes: map[attr.Name]Default{
attr.DBOperation: true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

qq: is this what is defined here and that's why db.statement is hidden? Why we document hidden and what it means?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It means that we don't include db.statement by default in metrics, because it will definitely cause high cardinality. We don't include it in traces by default too, because it might contain sensitive information, but if customers want it they can add it.

@grcevski grcevski merged commit 05ff13a into grafana:main May 30, 2024
8 checks passed
@grcevski grcevski deleted the redis branch May 30, 2024 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants