Merge branch 'main' into tomasz/groq-docs

This commit is contained in:
Tomasz Stefaniak 2025-02-04 13:18:15 -08:00 • committed by GitHub
commit 37d36d2f1a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 57 additions and 23 deletions

28
.github/workflows/pr_checks_skip.yaml vendored Normal file
View file

@ -0,0 +1,28 @@
# When none of the paths are matched for the pr_checks.yaml workflow
# we still need the require-all-checks-to-pass job to pass
name: PR checks skip
on:
pull_request:
branches:
- main
paths:
- docs/**
push:
branches:
- main
paths:
- docs/**
jobs:
require-all-checks-to-pass:
if: always()
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
allowed-failures:
allowed-skips:
jobs: []

View file

@ -124,12 +124,14 @@ export default async function doLoadConfig(
if (newConfig.analytics) {
await TeamAnalytics.setup(
newConfig.analytics as any, // TODO: Need to get rid of index.d.ts once and for all
newConfig.analytics,
uniqueId,
ideInfo.extensionVersion,
controlPlaneClient,
controlPlaneProxyInfo,
);
} else {
await TeamAnalytics.shutdown();
}
newConfig = await injectControlPlaneProxyInfo(

View file

@ -1,7 +1,5 @@
import os from "node:os";
import { Analytics } from "@continuedev/config-types";
import ContinueProxyAnalyticsProvider from "./analytics/ContinueProxyAnalyticsProvider.js";
import {
ControlPlaneProxyInfo,
@ -10,9 +8,10 @@ import {
import LogStashAnalyticsProvider from "./analytics/LogStashAnalyticsProvider.js";
import PostHogAnalyticsProvider from "./analytics/PostHogAnalyticsProvider.js";
import { ControlPlaneClient } from "./client.js";
import { AnalyticsConfig } from "../index.js";
function createAnalyticsProvider(
config: Analytics,
config: AnalyticsConfig,
): IAnalyticsProvider | undefined {
// @ts-ignore
switch (config.provider) {
@ -42,7 +41,7 @@ export class TeamAnalytics {
}
static async setup(
config: Analytics,
config: AnalyticsConfig,
uniqueId: string,
extensionVersion: string,
controlPlaneClient: ControlPlaneClient,
@ -52,22 +51,27 @@ export class TeamAnalytics {
TeamAnalytics.os = os.platform();
TeamAnalytics.extensionVersion = extensionVersion;
if (!config) {
await TeamAnalytics.provider?.shutdown();
TeamAnalytics.provider = undefined;
} else {
TeamAnalytics.provider = createAnalyticsProvider(config);
await TeamAnalytics.provider?.setup(
config,
uniqueId,
controlPlaneProxyInfo,
);
TeamAnalytics.provider = createAnalyticsProvider(config);
await TeamAnalytics.provider?.setup(
config,
uniqueId,
controlPlaneProxyInfo,
);
if (config.provider === "continue-proxy") {
(
TeamAnalytics.provider as ContinueProxyAnalyticsProvider
).controlPlaneClient = controlPlaneClient;
}
if (config.provider === "continue-proxy") {
(
TeamAnalytics.provider as ContinueProxyAnalyticsProvider
).controlPlaneClient = controlPlaneClient;
}
}
static async shutdown() {
if (TeamAnalytics.provider) {
await TeamAnalytics.provider.shutdown();
TeamAnalytics.provider = undefined;
TeamAnalytics.os = undefined;
TeamAnalytics.extensionVersion = undefined;
TeamAnalytics.uniqueId = "NOT_UNIQUE";
}
}
}

View file

@ -1,4 +1,4 @@
import { Analytics } from "@continuedev/config-types";
import { AnalyticsConfig } from "../..";
export interface AnalyticsMetadata {
extensionVersion: string;
@ -13,7 +13,7 @@ export interface ControlPlaneProxyInfo {
export interface IAnalyticsProvider {
capture(event: string, properties: { [key: string]: any }): Promise<void>;
setup(
config: Analytics,
config: AnalyticsConfig,
uniqueId: string,
controlPlaneProxyInfo?: ControlPlaneProxyInfo,
): Promise<void>;

2
core/index.d.ts vendored
View file

@ -1105,7 +1105,7 @@ export interface ExperimentalConfig {
}
export interface AnalyticsConfig {
type: string;
provider: string;
url?: string;
clientKey?: string;
}