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

Fix equals/hashCode for CodeOrigin probe #8319

Merged
merged 1 commit into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import static java.util.Arrays.asList;
import static java.util.Collections.singletonList;

import com.datadog.debugger.agent.Generated;
import com.datadog.debugger.instrumentation.CodeOriginInstrumentor;
import com.datadog.debugger.instrumentation.DiagnosticMessage;
import com.datadog.debugger.instrumentation.InstrumentationResult.Status;
Expand All @@ -17,7 +18,9 @@
import datadog.trace.bootstrap.debugger.ProbeLocation;
import datadog.trace.bootstrap.instrumentation.api.AgentSpan;
import datadog.trace.bootstrap.instrumentation.api.AgentTracer;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -89,4 +92,46 @@ public void buildLocation(MethodInfo methodInfo) {
}
this.location = new ProbeLocation(type, method, file, lines);
}

@Generated
@Override
public boolean equals(Object o) {
if (o == null || getClass() != o.getClass()) return false;
CodeOriginProbe that = (CodeOriginProbe) o;
return Objects.equals(language, that.language)
&& Objects.equals(id, that.id)
&& version == that.version
&& Arrays.equals(tags, that.tags)
&& Objects.equals(tagMap, that.tagMap)
&& Objects.equals(where, that.where)
&& Objects.equals(evaluateAt, that.evaluateAt)
&& entrySpanProbe == that.entrySpanProbe;
}

@Generated
@Override
public int hashCode() {
int result = Objects.hash(language, id, version, tagMap, where, evaluateAt, entrySpanProbe);
result = 31 * result + Arrays.hashCode(tags);
return result;
}

@Override
public String toString() {
return "CodeOriginProbe{"
+ "id='"
+ id
+ '\''
+ ", version="
+ version
+ ", tags="
+ Arrays.toString(tags)
+ ", where="
+ where
+ ", evaluateAt="
+ evaluateAt
+ ", entrySpanProbe="
+ entrySpanProbe
+ "} ";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -943,18 +943,13 @@ public int hashCode() {
public String toString() {
return getClass().getSimpleName()
+ "{"
+ "language='"
+ language
+ '\''
+ ", id='"
+ "id='"
+ id
+ '\''
+ ", version="
+ version
+ ", tags="
+ Arrays.toString(tags)
+ ", tagMap="
+ tagMap
+ ", where="
+ where
+ ", evaluateAt="
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,18 +201,13 @@ public int hashCode() {
@Override
public String toString() {
return "MetricProbe{"
+ "language='"
+ language
+ '\''
+ ", id='"
+ "id='"
+ id
+ '\''
+ ", version="
+ version
+ ", tags="
+ Arrays.toString(tags)
+ ", tagMap="
+ tagMap
+ ", where="
+ where
+ ", evaluateAt="
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,18 +291,13 @@ public boolean equals(Object o) {
@Override
public String toString() {
return "SpanDecorationProbe{"
+ "language='"
+ language
+ '\''
+ ", id='"
+ "id='"
+ id
+ '\''
+ ", version="
+ version
+ ", tags="
+ Arrays.toString(tags)
+ ", tagMap="
+ tagMap
+ ", where="
+ where
+ ", evaluateAt="
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,13 @@ public boolean equals(Object o) {
@Override
public String toString() {
return "SpanProbe{"
+ "language='"
+ language
+ '\''
+ ", id='"
+ "id='"
+ id
+ '\''
+ ", version="
+ version
+ ", tags="
+ Arrays.toString(tags)
+ ", tagMap="
+ tagMap
+ ", where="
+ where
+ ", evaluateAt="
Expand Down
Loading