Skip to content

Commit

Permalink
Merge pull request #46 from middleware-labs/recording-fix
Browse files Browse the repository at this point in the history
🎨 Added default attributes in resource attributes
  • Loading branch information
Archish27 authored Jun 10, 2024
2 parents c9fd3c8 + f6bbb5b commit 87e759e
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import static java.util.Objects.requireNonNull;
import static io.middleware.android.sdk.utils.Constants.APP_NAME_KEY;
import static io.middleware.android.sdk.utils.Constants.BASE_ORIGIN;
import static io.middleware.android.sdk.utils.Constants.LOG_TAG;
import static io.middleware.android.sdk.utils.Constants.RUM_TRACER_NAME;
import static io.opentelemetry.semconv.ResourceAttributes.BROWSER_MOBILE;
import static io.opentelemetry.semconv.ResourceAttributes.DEPLOYMENT_ENVIRONMENT;
Expand Down Expand Up @@ -245,6 +244,11 @@ private Resource createMiddlewareResource() {
if (builder.deploymentEnvironment != null) {
resourceBuilder.put(DEPLOYMENT_ENVIRONMENT.getKey(), builder.deploymentEnvironment);
}
if (builder.globalAttributes != null) {
builder.globalAttributes.forEach((attributeKey, o) -> {
resourceBuilder.put(attributeKey.getKey(), String.valueOf(builder.globalAttributes.get(attributeKey)));
});
}
resourceBuilder.put(SERVICE_NAME.getKey(), builder.serviceName);
resourceBuilder.put("project.name", builder.projectName);
resourceBuilder.put("mw_agent", true);
Expand Down

0 comments on commit 87e759e

Please sign in to comment.