Skip to content
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
24 changes: 24 additions & 0 deletions .github/workflows/check-deployed-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Check deployed package

on:
push:
branches:
- main
- add-demo-section

jobs:
run-demo:
name: Run LogDash Demo
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Make run script executable
run: chmod +x demo/run.sh

- name: Run LogDash demo
env:
LOGDASH_API_KEY: ${{ secrets.LOGDASH_API_KEY }}
run: ./demo/run.sh
11 changes: 11 additions & 0 deletions demo/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM ruby:3.2-alpine

WORKDIR /app

RUN gem install logdash

COPY demo/demo_script.rb /app/

RUN chmod +x /app/demo_script.rb

CMD ["./demo_script.rb"]
7 changes: 7 additions & 0 deletions demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# LogDash Ruby SDK Demo

Use command below to test if the published SDK works

```
LOGDASH_API_KEY=<your-api-key> ./demo/run.sh
```
25 changes: 25 additions & 0 deletions demo/demo_script.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require 'logdash'
require 'rubygems'

puts '=== LogDash SDK Demo ==='

# Get and display the logdash gem version
logdash_version = Gem.loaded_specs['logdash']&.version || 'unknown'
puts "Using logdash gem version: #{logdash_version}"
puts

api_key = ENV['LOGDASH_API_KEY']
puts "Using API Key: #{api_key}"
logdash = Logdash.create(api_key: api_key, verbose: true)
logger = logdash[:logger]
metrics = logdash[:metrics]

logger.info('This is an info log')
logger.error('This is an error log')
metrics.set('demo_users', 42)
metrics.mutate('demo_counter', 1)

sleep 1
17 changes: 17 additions & 0 deletions demo/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh
set -e

echo "Building LogDash demo Docker image (using published gem)..."
docker build --no-cache -t logdash-demo -f demo/Dockerfile .

echo
echo "Running LogDash demo..."
echo

# Run in non-interactive mode which works everywhere
docker run --rm \
-e LOGDASH_API_KEY="${LOGDASH_API_KEY:-YOUR_API_KEY_HERE}" \
logdash-demo

echo
echo "Demo completed!"