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: OTEL collector header check #251

Merged
merged 2 commits into from
Aug 28, 2024
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
4 changes: 3 additions & 1 deletion app/api/trace/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ export async function POST(req: NextRequest) {

// Normalize and prepare data for Clickhouse
let normalized = [];
if (userAgent?.toLowerCase().includes("otel-otlp")) {
if (userAgent?.toLowerCase().includes("otel-otlp") ||
userAgent?.toLowerCase().includes("opentelemetry")
) {
// coming from an OTEL exporter
normalized = prepareForClickhouse(
normalizeOTELData(data.resourceSpans?.[0]?.scopeSpans?.[0]?.spans)
Expand Down
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ if [ "$TABLE_EXISTS" == " " ]; then
else
echo "The $PRISMA_MIGRATIONS_TABLE table exists. Proceeding to apply migrations."
# Check if the 0_init migration exists
INIT_MIGRATION=$(psql -U $POSTGRES_USER -h $DB_HOST -d $POSTGRES_DATABASE -p $DB_PORT -t -c "SELECT migration_name FROM $PRISMA_MIGRATIONS_TABLE WHERE migration_name = '0_init' AND logs NOT like '%failed%';")
INIT_MIGRATION=$(psql -U $POSTGRES_USER -h $DB_HOST -d $POSTGRES_DATABASE -p $DB_PORT -t -c "SELECT migration_name FROM $PRISMA_MIGRATIONS_TABLE WHERE migration_name = '0_init' AND (logs IS NULL OR logs = '' OR logs NOT LIKE '%failed%');")
if [ -z "$INIT_MIGRATION" ]; then
echo "The 0_init migration was not found. Renaming the existing _prisma_migrations table and applying migrations."
rename_migrations_table
Expand Down