getsentry / sentry-kubernetes

Kubernetes event reporter for Sentry
Apache License 2.0
458 stars 64 forks source link

reduce mangling of involved object names #15

Closed q3aiml closed 5 years ago

q3aiml commented 5 years ago

The short_name logic seems to be targeted at pods, replicasets, and statefulsets where parts of the name can be auto generated. In other cases the short_name mangling is undesirable as it throws away relevant parts of the name when the name contains dashes. For example a Service called "my-lb" would appear in the culprit only as "my".

This is an improvement but still imperfect because 1) it is quite possible to create many of these objects directly without any generated suffix and 2) even when a suffix is appended it is not always 2 segments as currently assumed. A more complete fix likely requires querying kubernetes for details about the involved object and determining the closest object that is not automatically created by kubernetes to attribute the culprit to.

bretthoerner commented 5 years ago

Thanks for the PR.

My only fear here is that I don't currently know for sure whether "Pod", "ReplicaSet", "StatefulSet" is the correct set. Do you think it might be enough to make this an opt-in argument for now? So you could run yours with MANGLE_NAMES="pod,replicaset,statefulset"?

q3aiml commented 5 years ago

Thanks for looking. That seems reasonable. How does this change look?

bretthoerner commented 5 years ago

Thanks, I pushed up a new container.