diff --git a/.github/workflows/build-image.yaml b/.github/workflows/build-image.yaml new file mode 100644 index 00000000..157e5781 --- /dev/null +++ b/.github/workflows/build-image.yaml @@ -0,0 +1,55 @@ +name: "Build Docker Image" +run-name: "Version: ${{ inputs.imageTag }} --> Latest: ${{ inputs.isLatest }}" + +on: + workflow_dispatch: + inputs: + imageTag: + description: Release version + required: true + default: example + isLatest: + description: Is this the latest version? + type: boolean + required: true + default: false + +jobs: + docker-build: + runs-on: ubuntu-latest + env: + DOCKER_REGISTRY: scale3labs/langtrace-client + steps: + - name: Github Checkout + # v4.1.1 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + + - name: Log in to Docker Hub + # v3.1.0 + uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and push Docker image with latest tag + # v5.3.0 + uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 + with: + context: . + file: ./Dockerfile + push: true + tags: | + ${{ env.DOCKER_REGISTRY }}:${{ inputs.imageTag }} + ${{ env.DOCKER_REGISTRY }}:latest + labels: ${{ inputs.imageTag }} + if: ${{ inputs.isLatest }} + + - name: Build and push Docker image without latest tag + # v5.3.0 + uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 + with: + context: . + file: ./Dockerfile + push: true + tags: ${{ env.DOCKER_REGISTRY }}:${{ inputs.imageTag }} + if: ${{ !inputs.isLatest }} diff --git a/README.md b/README.md index db7beab5..c2bc18e4 100644 --- a/README.md +++ b/README.md @@ -28,20 +28,20 @@ To use the managed SaaS version of Langtrace, follow the steps below: ### If your application is built using **typescript/javascript** -``` typescript +```typescript npm i @langtrase/typescript-sdk ``` -``` typescript +```typescript import * as Langtrace from '@langtrase/typescript-sdk' // Must precede any llm module imports Langtrace.init({ api_key: }) ``` OR -``` typescript -import * as Langtrace from '@langtrase/typescript-sdk' // Must precede any llm module imports -LangTrace.init() // LANGTRACE_API_KEY as an ENVIRONMENT variable +```typescript +import * as Langtrace from "@langtrase/typescript-sdk"; // Must precede any llm module imports +LangTrace.init(); // LANGTRACE_API_KEY as an ENVIRONMENT variable ``` ### If your application is built using **python** @@ -62,8 +62,6 @@ from langtrace_python_sdk import langtrace langtrace.init() # LANGTRACE_API_KEY as an ENVIRONMENT variable ``` - - ### Langtrace self hosted To run the Langtrace locally, you have to run three services: @@ -101,12 +99,11 @@ The application will be available at `http://localhost:3000`. #### Take down the setup - To delete containers and volumes ```bash docker compose down -v -```` +``` `-v` flag is used to delete volumes @@ -139,11 +136,11 @@ The following are some commands that may come handy during setup and debugging. docker logs langtrace ``` - If you want to follow the logs +If you want to follow the logs - ```bash - docker logs -f langtrace - ``` +```bash +docker logs -f langtrace +``` diff --git a/lib/utils.ts b/lib/utils.ts index 200d0cf2..3935dfe9 100644 --- a/lib/utils.ts +++ b/lib/utils.ts @@ -178,7 +178,7 @@ function convertToDateTime64(dateTime: [number, number]): string { // Append the microseconds part to the dateString, replacing the 'Z' at the end. // This example results in a format with microseconds precision, assuming that's what's meant by DateTime64. - const dateTime64String = `${dateString.slice(0, -1)}.${String( + const dateTime64String = `${dateString.slice(0, -1)}${String( microseconds ).padStart(3, "0")}Z`;