Skip to content

Conversation

@trask
Copy link
Member

@trask trask commented Nov 6, 2024

Just a little renaming and static importing to improve the database semconv stability test formatting before I start adding a bunch more...

adding the script I used to static import so I can find and copy-paste-modify later when needed:

for file in $(find instrumentation -name '*Test.java'); do
  echo "Processing $file"

  # stable semconv

  negative_lookbehind='(?<!import static io.opentelemetry.instrumentation.testing.junit.db.)'

  if grep -Po "${negative_lookbehind}SemconvStabilityUtil.maybeStable" $file; then
    perl -i -pe "s/${negative_lookbehind}SemconvStabilityUtil.maybeStable/maybeStable/" $file
    sed -i "0,/^import/{s/^import/import static io.opentelemetry.instrumentation.testing.junit.db.SemconvStabilityUtil.maybeStable;\nimport/}" $file
  fi

  negative_lookbehind='(?<!import static io.opentelemetry.instrumentation.api.internal.)'

  if grep -Po "${negative_lookbehind}SemconvStability.emitStableDatabaseSemconv" $file; then
    perl -i -pe "s/${negative_lookbehind}SemconvStability.emitStableDatabaseSemconv/emitStableDatabaseSemconv/" $file
    sed -i "0,/^import/{s/^import/import static io.opentelemetry.instrumentation.api.internal.SemconvStability.emitStableDatabaseSemconv;\nimport/}" $file
  fi
done

./gradlew spotlessApply

@trask trask marked this pull request as ready for review November 6, 2024 21:58
@trask trask requested a review from a team as a code owner November 6, 2024 21:58
map.put(DB_SQL_TABLE, DB_COLLECTION_NAME);
map.put(DB_CASSANDRA_TABLE, DB_COLLECTION_NAME);
map.put(DB_MONGODB_COLLECTION, DB_COLLECTION_NAME);
map.put(DB_COSMOSDB_CONTAINER, DB_COLLECTION_NAME);
Copy link
Member

Choose a reason for hiding this comment

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

was this removal intentional?

Copy link
Member Author

Choose a reason for hiding this comment

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

oh yeah, I had meant to leave a github comment about it, it's unused (we don't have any cosmosdb tests)

@laurit laurit merged commit c8bd230 into open-telemetry:main Nov 7, 2024
56 checks passed
akats7 pushed a commit to akats7/opentelemetry-java-instrumentation that referenced this pull request Nov 21, 2024
akats7 pushed a commit to akats7/opentelemetry-java-instrumentation that referenced this pull request Nov 21, 2024
@trask trask deleted the database-semconv branch February 20, 2025 02:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants