Skip to content

Shadowing is needed when integrating Agent with Spark 3.x versions #343

Open
@benedeki

Description

@benedeki

Describe the bug

Dependency shading might be needed when using the Agent in Spark environment (especially when some Hadoop dependencies are in use as well, for example if you package the application that contains the Agent and use such JAR in Spark Submit command).

Expected behavior

Shading is not needed. The required libraries that needs shading are part of the Agent library already in shaded form.

Workaround (shading to add to the project)

Here's the suggested project code snippet for Maven:

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>${maven.shade.plugin.version}</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <relocations>
                        <relocation>
                            <pattern>okhttp3</pattern>
                            <shadedPattern>shaded.okhttp3</shadedPattern>
                        </relocation>
                        <relocation>
                            <pattern>okio</pattern>
                            <shadedPattern>shaded.okio</shadedPattern>
                        </relocation>
                        <relocation>
                            <pattern>sttp</pattern>
                            <shadedPattern>shaded.sttp</shadedPattern>
                        </relocation>
                        <relocation>
                            <pattern>cats</pattern>
                            <shadedPattern>shaded.cats</shadedPattern>
                        </relocation>
                        <relocation>
                            <pattern>shapeless</pattern>
                            <shadedPattern>shaded.shapeless</shadedPattern>
                        </relocation>
                        <relocation>
                            <pattern>kotlin</pattern>
                            <shadedPattern>shaded.kotlin</shadedPattern>
                        </relocation>
                    </relocations>
                    <filters>
                        <filter>
                            <artifact>*:*</artifact>
                            <excludes>
                                <exclude>META-INF/*.SF</exclude>
                                <exclude>META-INF/*.DSA</exclude>
                                <exclude>META-INF/*.RSA</exclude>
                            </excludes>
                        </filter>
                    </filters>
                </configuration>
            </plugin>

Metadata

Metadata

Assignees

No one assigned

    Labels

    AgentIssues touching the agent part of the projectbugSomething isn't working

    Type

    No type

    Projects

    Status

    🆕 To groom

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions