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

refactor: prometheus attributes format to otel attributes #4188

Merged
merged 12 commits into from
Dec 13, 2024

Conversation

varshith257
Copy link
Contributor

@varshith257 varshith257 commented Nov 28, 2024

/claim #4057
Closes #4057

@varshith257
Copy link
Contributor Author

varshith257 commented Nov 28, 2024

The only minor change is needed to make optional attributes for the error metric

Excludes error.type for successful responses by setting it to an empty string ("") and filtering it out during attribute collection.

@varshith257
Copy link
Contributor Author

@adamw Can have a review on it?

@varshith257 varshith257 force-pushed the refactor/OTEL-attributes branch from 4e13068 to 8e5c041 Compare December 7, 2024 16:20
@adamw
Copy link
Member

adamw commented Dec 9, 2024

Hm I think we agreed that for optional labels, we should use Scala's Option. That's much better than magic strings

@varshith257 varshith257 force-pushed the refactor/OTEL-attributes branch from 8e5c041 to a3ebd6c Compare December 11, 2024 09:56
@varshith257
Copy link
Contributor Author

@adamw Done! Can you approve workflows?

@varshith257
Copy link
Contributor Author

varshith257 commented Dec 11, 2024

I completely forgot the existence of Metric.scala 😄

l.forResponse.map(label => zio.metrics.MetricLabel(label._1, label._2(res))) ++
phase.map(v => MetricLabel(l.forResponsePhase.name, v))
}.toSet
val responseLabels = l.forResponse.map { case (key, valueFn) =>
Copy link
Contributor Author

@varshith257 varshith257 Dec 11, 2024

Choose a reason for hiding this comment

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

Does we need to account Option[String] for Zio Metrics ig it may account for other metrics too?

Or better strategy to move this logic to OpenTelemetry module and introduce option labels than affecting other modules

Copy link
Member

Choose a reason for hiding this comment

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

that's fine, let's just have optional labels. This might be useful for ZIO as well

@adamw adamw merged commit 237cd20 into softwaremill:master Dec 13, 2024
28 checks passed
@adamw
Copy link
Member

adamw commented Dec 13, 2024

Thanks for your work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adjust OpenTelemetry metric names, add require attributes
2 participants