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 CSM Plugin Option #7205

Merged
merged 14 commits into from May 21, 2024

Conversation

zasweq
Copy link
Contributor

@zasweq zasweq commented May 7, 2024

This PR adds support for the CSM Plugin Option, as speced in the design. The interface and the implementation live in OpenTelemetry's internal/. The next step is the usage of the CSM Plugin Option in OpenTelemetry and the global configuration.

RELEASE NOTES: N/A

@zasweq zasweq requested a review from dfawley May 7, 2024 02:18
@zasweq zasweq added this to the 1.64 Release milestone May 7, 2024
Copy link

codecov bot commented May 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.53%. Comparing base (adf976b) to head (4290e3a).
Report is 57 commits behind head on master.

Current head 4290e3a differs from pull request most recent head c56b06b

Please upload reports for the commit c56b06b to get more accurate results.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7205      +/-   ##
==========================================
- Coverage   81.24%   80.53%   -0.72%     
==========================================
  Files         345      349       +4     
  Lines       33941    34063     +122     
==========================================
- Hits        27574    27431     -143     
- Misses       5202     5437     +235     
- Partials     1165     1195      +30     

see 34 files with indirect coverage changes

stats/opentelemetry/internal/csm/pluginoption.go Outdated Show resolved Hide resolved
stats/opentelemetry/internal/csm/pluginoption.go Outdated Show resolved Hide resolved
stats/opentelemetry/internal/csm/pluginoption.go Outdated Show resolved Hide resolved
stats/opentelemetry/internal/csm/pluginoption.go Outdated Show resolved Hide resolved
stats/opentelemetry/internal/pluginoption.go Outdated Show resolved Hide resolved
stats/opentelemetry/internal/csm/pluginoption.go Outdated Show resolved Hide resolved
stats/opentelemetry/internal/csm/pluginoption.go Outdated Show resolved Hide resolved
stats/opentelemetry/internal/csm/pluginoption.go Outdated Show resolved Hide resolved
stats/opentelemetry/internal/csm/pluginoption.go Outdated Show resolved Hide resolved
stats/opentelemetry/internal/csm/pluginoption.go Outdated Show resolved Hide resolved
@dfawley dfawley assigned zasweq and unassigned dfawley May 7, 2024
@zasweq zasweq assigned dfawley and unassigned zasweq May 8, 2024
@arvindbr8 arvindbr8 modified the milestones: 1.64 Release, 1.65 Release May 9, 2024
stats/opentelemetry/csm/pluginoption.go Outdated Show resolved Hide resolved
stats/opentelemetry/internal/pluginoption.go Outdated Show resolved Hide resolved
stats/opentelemetry/internal/pluginoption.go Outdated Show resolved Hide resolved
Comment on lines 92 to 97
// Append the optional labels. To avoid string comparisons, assume the
// caller only passes in two potential xDS Optional Labels: service_name and
// service_namespace.
for k, v := range optionalLabels {
labels[k] = v
}
Copy link
Member

Choose a reason for hiding this comment

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

Why don't we merge these labels externally, rather than passing them in here and merging them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, this confused me too. This is a built in function of how this API should work (one API call that emits labels from the three sources described above). Thus, it is intended for this layer to receive this arbitrary map of optional labels and make the determination as to which it is interested in. For this case, we assume the caller has processed these service_name and service_namespace for the sake of avoiding string comparisons.

Copy link
Member

Choose a reason for hiding this comment

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

So why not remove it from the API then, if we're just going to use whatever is passed in?

Copy link
Member

Choose a reason for hiding this comment

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

There can be optional labels other than service_name and service_namespace. Immediately, we have "locality". Additionally, the CSM Plugin Options changes the name of the label from "service_name" to "csm.service_name".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh whoops I didn't prepend csm. for the two. Let me do that now.

Copy link
Member

Choose a reason for hiding this comment

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

Immediately, we have "locality".

Then why doesn't this need to filter out locality or ensure it only passes through service_name[space]?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmmm ok. I do plan on using the same API that I set xDS Labels with for the locality, and even though there will be orthogonal stats handlers for GCS it will still be in same call which will get merged with this, and call out into this. So I'll add a filter here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just talked to Yash about this, the intended behavior is to log "unknown" for the xDS labels that don't show up. Even though we want to make this general purpose, C++ actually just takes a struct here with two xDS Labels and a service_name label. Would you prefer that to avoid filtering?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Discussed offline with Yash; decided to do this in the OTel layer with an additional API which we will need for GCS SetOptionalLabel, and also prepend csm. in the xDS Client.

stats/opentelemetry/csm/pluginoption.go Outdated Show resolved Hide resolved
stats/opentelemetry/csm/pluginoption.go Outdated Show resolved Hide resolved
stats/opentelemetry/csm/pluginoption.go Outdated Show resolved Hide resolved
stats/opentelemetry/csm/pluginoption.go Outdated Show resolved Hide resolved
stats/opentelemetry/csm/pluginoption.go Outdated Show resolved Hide resolved
stats/opentelemetry/csm/pluginoption.go Outdated Show resolved Hide resolved
@dfawley dfawley assigned zasweq and unassigned dfawley May 13, 2024
@zasweq zasweq assigned dfawley and unassigned zasweq May 13, 2024
@zasweq zasweq added the Type: Feature New features or improvements in behavior label May 13, 2024
@dfawley
Copy link
Member

dfawley commented May 13, 2024

Looks like you still need to exclude these tests from go1.20 runs, too.

@dfawley dfawley assigned zasweq and unassigned dfawley May 13, 2024
@zasweq
Copy link
Contributor Author

zasweq commented May 13, 2024

Argh yeah, I started that but forget to wrap it up/send it out. Working on it now.

@zasweq zasweq assigned dfawley and unassigned zasweq May 13, 2024
@dfawley dfawley assigned zasweq and unassigned dfawley May 16, 2024
@zasweq zasweq assigned dfawley and unassigned zasweq May 18, 2024
@dfawley dfawley assigned zasweq and unassigned dfawley May 21, 2024
@zasweq zasweq assigned dfawley and unassigned zasweq May 21, 2024
@@ -103,10 +104,18 @@ jobs:
go version
go test ${{ matrix.testflags }} -cpu 1,4 -timeout 7m google.golang.org/grpc/...
cd "${GITHUB_WORKSPACE}"
set -x
Copy link
Member

Choose a reason for hiding this comment

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

Remove?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why not just keep this in to enable debugging? I'll delete though.

.github/workflows/testing.yml Outdated Show resolved Hide resolved
stats/opentelemetry/csm/pluginoption.go Outdated Show resolved Hide resolved
stats/opentelemetry/internal/pluginoption.go Outdated Show resolved Hide resolved
@dfawley dfawley assigned zasweq and unassigned dfawley May 21, 2024
@zasweq zasweq assigned dfawley and unassigned zasweq May 21, 2024
@zasweq zasweq merged commit 0a0abfa into grpc:master May 21, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature New features or improvements in behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants