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

refact: uuid func, new otelgrpc #638

Merged
merged 1 commit into from
Jan 9, 2025

Conversation

regeda
Copy link
Contributor

@regeda regeda commented Jan 9, 2025

  1. Replace util.UUID4 function by google/uuid package.
  2. Replace some deprecation by new versions.

Benchmark results

Before:

BenchmarkCheck-12             22563             54552 ns/op           34918 B/op        697 allocs/op

After:

BenchmarkCheck-12             22776             53283 ns/op           34797 B/op        692 allocs/op

Copy link
Member

@anderseknert anderseknert left a comment

Choose a reason for hiding this comment

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

I can't comment on OTEL but the UUID change looks good to me. It makes me wonder why we have a function for creating UUIDs here in the first place though 🤔 Why not use the one from OPA (and who would also benefit from this fix)?

@srenatus
Copy link
Collaborator

srenatus commented Jan 9, 2025

Yeah I was surprised, too -- why do we not use one of the common 3rd party deps here? It's not like there weren't at least two in the dependency tree anyways. 😉

Signed-off-by: Anthony Regeda <[email protected]>
@regeda
Copy link
Contributor Author

regeda commented Jan 9, 2025

Yeah I was surprised, too -- why do we not use one of the common 3rd party deps here? It's not like there weren't at least two in the dependency tree anyways. 😉

I've imported 3rd party library for uuid purposes.

@@ -159,8 +159,7 @@ func New(m *plugins.Manager, cfg *Config) plugins.Plugin {
otelhttp.WithPropagators(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{}, b3.New(b3.WithInjectEncoding(b3.B3MultipleHeader|b3.B3SingleHeader)))),
)
grpcOpts = append(grpcOpts,
grpc.UnaryInterceptor(otelgrpc.UnaryServerInterceptor(grpcTracingOption...)),
grpc.StreamInterceptor(otelgrpc.StreamServerInterceptor(grpcTracingOption...)),
grpc.StatsHandler(otelgrpc.NewServerHandler(grpcTracingOption...)),
Copy link
Member

Choose a reason for hiding this comment

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

Can you please explain this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ashutosh-narkar ashutosh-narkar merged commit eafceb1 into open-policy-agent:main Jan 9, 2025
8 checks passed
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