Skip to content

Conversation

c0d33ngr
Copy link
Contributor

This PR is to close #1007

I don't know whether you want it for selected few or all

@mergify mergify bot added module:core Features and improvements to core module module:oteljava Features and improvements to the oteljava module metrics Improvement to metrics module tracing Improvements to tracing module labels Jul 19, 2025
@c0d33ngr c0d33ngr force-pushed the hashcode-to-lazy-val branch 2 times, most recently from c8312b6 to 9bca21d Compare July 20, 2025 04:40
@iRevive
Copy link
Contributor

iRevive commented Jul 20, 2025

Hey, thanks for picking it up.

I think we can update it for all similar hashCode definitions, such as def hashCode(): Int = Hash[X].hash(this)

@iRevive iRevive self-requested a review July 20, 2025 08:49
@c0d33ngr c0d33ngr force-pushed the hashcode-to-lazy-val branch from 9bca21d to ae2cb61 Compare July 20, 2025 10:13
@mergify mergify bot added module:sdk Features and improvements to the sdk module module:sdk:exporter Features and improvements to the sdk exporter module logs Improvements to logs module labels Jul 20, 2025
@iRevive
Copy link
Contributor

iRevive commented Jul 24, 2025

As @NthPortal correctly pointed out, we should start with the most commonly hashed types and add others if needed.

Can we start with these ones:

  • SpanContext
  • TraceState (part of the SpanContext hash)
  • TraceFlags (part of the SpanContext hash)
  • Attributes
  • Attribute (part of the Attributes hash)
  • AttributeKey (part of the Attribute hash)
  • MetricDescriptor
  • sdk.InstrumentationScope
  • sdk.context.Context.Key

And we need to annotate them with @threadUnsafe3.

Sorry for the double-work.

@c0d33ngr c0d33ngr force-pushed the hashcode-to-lazy-val branch from 72e8190 to 3926064 Compare July 25, 2025 07:47
@c0d33ngr
Copy link
Contributor Author

No problem at all. I've done the changes requested

@iRevive iRevive removed module:sdk:exporter Features and improvements to the sdk exporter module module:oteljava Features and improvements to the oteljava module logs Improvements to logs module labels Jul 25, 2025
@iRevive
Copy link
Contributor

iRevive commented Jul 28, 2025

Thanks!

@iRevive iRevive merged commit 0806e2f into typelevel:main Jul 28, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
metrics Improvement to metrics module module:core Features and improvements to core module module:sdk Features and improvements to the sdk module tracing Improvements to tracing module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Define hashCode as a lazy val
2 participants