Skip to content

Commit 20a4adc

Browse files
atrakhConvex, Inc.
authored andcommitted
dashboard: UI for axiom region selection (#43761)
GitOrigin-RevId: 8a3b652bd9d7f2a176ec892270af365f8de67171
1 parent ba05c40 commit 20a4adc

File tree

2 files changed

+41
-2
lines changed

2 files changed

+41
-2
lines changed

npm-packages/dashboard-common/src/features/settings/components/integrations/AxiomConfigurationForm.tsx

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const axiomValidationSchema = Yup.object().shape({
2626
value: Yup.string().required("Value is required"),
2727
}),
2828
),
29+
ingestUrl: Yup.string(),
2930
});
3031

3132
type Unpacked<T> = T extends (infer U)[] ? U : never;
@@ -45,19 +46,22 @@ export function AxiomConfigurationForm({
4546
apiKey: string;
4647
attributes: Unpacked<AxiomConfig["attributes"]>[];
4748
version: "1" | "2";
49+
ingestUrl: string;
4850
}>({
4951
initialValues: {
5052
datasetName: existingConfig?.datasetName ?? "",
5153
apiKey: existingConfig?.apiKey ?? "",
5254
attributes: existingConfig?.attributes ?? [],
5355
version: existingConfig !== null ? (existingConfig.version ?? "1") : "2",
56+
ingestUrl: existingConfig?.ingestUrl ?? "https://api.axiom.co",
5457
},
5558
onSubmit: async (values) => {
5659
await createAxiomIntegration(
5760
values.datasetName,
5861
values.apiKey,
5962
values.attributes,
6063
values.version,
64+
values.ingestUrl,
6165
);
6266
onClose();
6367
},
@@ -66,6 +70,15 @@ export function AxiomConfigurationForm({
6670

6771
const [showApiKey, setShowApiKey] = useState(false);
6872

73+
const regionOptions = [
74+
{ value: "https://api.axiom.co", label: "Default" },
75+
{ value: "https://us-east-1.aws.edge.axiom.co", label: "US East 1 (AWS)" },
76+
{
77+
value: "https://eu-central-1.aws.edge.axiom.co",
78+
label: "EU Central 1 (AWS)",
79+
},
80+
];
81+
6982
return (
7083
<form onSubmit={formState.handleSubmit} className="flex flex-col gap-3">
7184
{isUsingLegacyFormat && (
@@ -98,13 +111,31 @@ export function AxiomConfigurationForm({
98111
/>
99112
</>
100113
)}
114+
<div className="flex flex-col gap-1">
115+
<Combobox
116+
label="Region"
117+
labelHidden={false}
118+
disableSearch
119+
options={regionOptions}
120+
selectedOption={formState.values.ingestUrl}
121+
setSelectedOption={async (v) => {
122+
await formState.setFieldValue("ingestUrl", v, false);
123+
}}
124+
allowCustomValue={false}
125+
/>
126+
<p className="max-w-prose animate-fadeInFromLoading text-xs text-content-secondary">
127+
Select the region where your Axiom organization is located. This will
128+
determine the URL used to send events to Axiom.
129+
</p>
130+
</div>
131+
101132
<TextInput
102133
value={formState.values.datasetName}
103134
onChange={formState.handleChange}
104135
label="Dataset Name"
105136
id="datasetName"
106137
error={formState.errors.datasetName}
107-
description="Name of the dataset in Axiom. This is where the logs will be sent."
138+
description="Name of the dataset in your Axiom organization. This needs to be an existing dataset, or the configuration will fail."
108139
/>
109140
<TextInput
110141
label="API Key"

npm-packages/dashboard-common/src/lib/integrationsApi.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ export function useCreateAxiomIntegration(): (
7070
apiKey: string,
7171
attributes: { key: string; value: string }[],
7272
version: "1" | "2",
73+
ingestUrl: string,
7374
) => Promise<void> {
7475
const deploymentUrl = useDeploymentUrl();
7576
const adminKey = useAdminKey();
@@ -80,8 +81,15 @@ export function useCreateAxiomIntegration(): (
8081
apiKey: string,
8182
attributes: { key: string; value: string }[],
8283
version: "1" | "2",
84+
ingestUrl: string,
8385
) => {
84-
const body = JSON.stringify({ datasetName, apiKey, attributes, version });
86+
const body = JSON.stringify({
87+
datasetName,
88+
apiKey,
89+
attributes,
90+
version,
91+
ingestUrl,
92+
});
8593
await createIntegration(
8694
"axiom",
8795
body,

0 commit comments

Comments
 (0)