-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Michael Beemer <[email protected]>
- Loading branch information
Showing
8 changed files
with
240 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,10 @@ | ||
"use server"; | ||
|
||
import { events } from "@opentelemetry/api-events"; | ||
|
||
const featureFlagTrack = events.getEventLogger("feature_flag"); | ||
import { sendTrackEvent } from "@/libs/open-feature/send-tracking-event"; | ||
|
||
export async function POST(request: Request) { | ||
const attributes = await request.json(); | ||
|
||
featureFlagTrack.emit({ | ||
name: "feature_flag.track", | ||
attributes, | ||
}); | ||
|
||
sendTrackEvent(attributes); | ||
return new Response(null, { status: 202 }); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
"use server"; | ||
|
||
import { NextResponse } from "next/server"; | ||
import { OpenFeature } from "@openfeature/server-sdk"; | ||
import { headerToEvaluationContext } from "@/libs/open-feature/evaluation-context"; | ||
|
||
export async function POST(request: Request) { | ||
const featureFlagClient = OpenFeature.getClient( | ||
headerToEvaluationContext(request.headers) | ||
); | ||
const order = await request.json(); | ||
console.log("Order received:", order); | ||
featureFlagClient.track("order_received"); | ||
|
||
return NextResponse.json({ message: "Order received successfully" }); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.