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

Question: how to ignore healthcheck endpoint with otelmux #896

Closed
huydinhle opened this issue Jul 22, 2021 · 10 comments · Fixed by #4230
Closed

Question: how to ignore healthcheck endpoint with otelmux #896

huydinhle opened this issue Jul 22, 2021 · 10 comments · Fixed by #4230
Labels
instrumentation: otelmux question Further information is requested

Comments

@huydinhle
Copy link

We are using otelmux to instrument our gorilla mux requests. Is there a way to ignore /health endpoint ?

@Aneurysm9
Copy link
Member

There are a couple ways to handle this. You can attach the middleware to a mux that doesn't route to the health check endpoint and then compose that with one that does the health check but doesn't have the middleware. Alternately, you could implement a custom sampler that samples out health check requests. Finally, the otelhttp instrumentation has a Filter type that can be used to filter requests that should not have spans created. A PR moving that type (and its helper implementations) to a common location and integrating it with the otelmux instrumentation would probably be welcomed.

@jaredpiedt
Copy link

@Aneurysm9 I need similar functionality so I'm happy to work on a PR. Do you still prefer moving otelhttp.Filter to a different location or is it ok to use that type directly in the otelmux instrumentation?

@dmathieu
Copy link
Member

dmathieu commented Sep 6, 2022

We're starting to use the Filter (and other attributes) in several places (the grpc instrumentation is the most recent one).
So I think moving it to a general location would be welcomed.

@jaredpiedt
Copy link

@dmathieu thank you for the quick reply. I noticed that the otelgrpc.Filter and otelhttp.Filter types have different function signatures. Would you like to keep both types and move them to a central package or figure out a way to combine the types?

@dmathieu
Copy link
Member

dmathieu commented Sep 7, 2022

Now thinking about this, making them shared may not be so easy, especially due to subtle differences with method signatures as we have in grpc.
Happy to hear other opinions, but maybe we can start with a separate option for otelmux.

@jaredpiedt
Copy link

@dmathieu I agree with keeping the two separate. Are you opposed to just using otelhttp.Filter in the otelmux library? That would create the least amount of changes to the code base, but I wasn't sure if it was bad practice to share code between different exporter packages?

@dmathieu
Copy link
Member

If that were to happen, I think it would be better to have a shared/base package.

@Rshep3087
Copy link

We we're looking at this also at my company. Has there been any movement on this issue? We can look at picking it up if not.

@dmathieu
Copy link
Member

No, there hasn't been any movement yet.

@Rshep3087
Copy link

So looking to move the filter package out of otelhttp, internal directory seems to make the most sense. It only has a util package at the moment.

Once that is moved to a shared/base package, otelhttp should only need imports changed. otelmux will need the filters config similar to otelhttp and filter called on the ServeHTTP method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
instrumentation: otelmux question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants