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

Separate OpenCensus and remove unused methods #804

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

costinm
Copy link
Contributor

@costinm costinm commented May 8, 2023

This is still WIP (commented out a number of unused methods, will cleanup).

Like the log change, there are a few small updates in istio repo, but very small. Almost all of Istio is using
the float variables and the methods removed are not used and will simplify migration from OC.

@costinm costinm requested a review from a team as a code owner May 8, 2023 17:46
@istio-policy-bot
Copy link

😊 Welcome @costinm! This is either your first contribution to the Istio pkg repo, or it's been
awhile since you've been here.

You can learn more about the Istio working groups, code of conduct, and contributing guidelines
by referring to Contributing to Istio.

Thanks for contributing!

Courtesy of your friendly welcome wagon.

@istio-testing istio-testing added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label May 8, 2023
@costinm costinm requested a review from howardjohn May 8, 2023 17:46
Name() string

// Record makes an observation of the provided value for the given measure.
// Majority of Istio is setting this to an int
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't imply we are going to change it to int, right? Since all the histograms are floats (duration)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, I'm removing ints from this API since Istio is only using floats. Just noticing it...

Comment on lines 61 to 62
// Otel uses attribute.Int("name", val) and similar - from the stable package -
// but doesn't create a new Metric, it is an option to Add().
Copy link
Member

Choose a reason for hiding this comment

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

Not pre-creating objects with the attributes is what was costing Istiod to spend ~25% of its time in metrics code. So hopefully this is not suggesting we do that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This PR is not changing anything in the current API or OC implementation.

I have a separate change to use prometheus client - and it is also pre-computing the attribute.

This is a note that OTel metrics does things differently - fortunately it is not yet marked as stable and the
prom client is not deprecated, so not a concern - but it is important to keep this in mind. Attributes/labels
are the highest cost and complexity in all telemetry ( and logs ).

}

// NewGauge creates a new Metric with an aggregation type of LastValue. That means that data collected
// by the new Metric will export only the last recorded value.
func NewGauge(name, description string, opts ...Options) Metric {
return newMetric(name, description, view.LastValue(), opts...)
if strings.HasSuffix(name, "_total") {
fmt.Println(name)
Copy link
Member

Choose a reason for hiding this comment

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

Should rm before merge

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, I was trying to find bad names - we can't really change them.

@@ -0,0 +1,229 @@
//go:build !skip_opencensus
Copy link
Member

Choose a reason for hiding this comment

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

Whats the long term plan for this? its not easy to set build tags in istio release today. But not a big deal if its short lived

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since OC is deprecated - it has to be short lived :-)

A separate PR will add an implementation based on prom client, and swap the default - I'm not sure if we should have an env variable to control or just switch, will get there - one step at a time, but I do not plan to have this in the release.

Copy link
Member

Choose a reason for hiding this comment

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

Why prom? I thought we were moving to otel?

Copy link
Contributor

Choose a reason for hiding this comment

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

Why not use otel SDK to allow exporters besides prometheus? Semantically they should be equivalent per their stated goal.

@istio-testing
Copy link
Contributor

@costinm: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
gencheck_pkg 2bb7ef9 link true /test gencheck
lint_pkg 2bb7ef9 link true /test lint
test_pkg 2bb7ef9 link true /test test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@costinm
Copy link
Contributor Author

costinm commented May 8, 2023 via email

@costinm
Copy link
Contributor Author

costinm commented May 9, 2023 via email

@kyessenov
Copy link
Contributor

SGTM, as long as we maintain a wrapper and don't force any library until Otel is ready.

@costinm
Copy link
Contributor Author

costinm commented May 9, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants