Skip to content

Commit

Permalink
docs(get-started): add ruby
Browse files Browse the repository at this point in the history
  • Loading branch information
adnanrahic committed Oct 15, 2024
1 parent c1d45e1 commit 26756c1
Show file tree
Hide file tree
Showing 3 changed files with 125 additions and 55 deletions.
38 changes: 38 additions & 0 deletions docs/docs/getting-started/configure-trace-ingestion.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,44 @@ java -javaagent:opentelemetry-javaagent.jar -jar /path/to/app.jar
[Visit the example in GitHub, here.](https://github.com/kubeshop/tracetest/tree/main/examples/getting-started/java)
:::

</TabItem>
<TabItem value="ruby" label="Ruby">

1. Install Dependencies

```bash title="Terminal"
gem install opentelemetry-sdk
opentelemetry-exporter-otlp
opentelemetry-instrumentation-all
```

2. Initialize Tracing

```ruby title="config/initializers/opentelemetry.rb"
require 'opentelemetry/sdk'
require 'opentelemetry/exporter/otlp'
require 'opentelemetry/instrumentation/all'

OpenTelemetry::SDK.configure do |c|
c.use_all() # enables all instrumentation!
end
```

3. Configure and Run

```bash title="Terminal"
export OTEL_SERVICE_NAME=my-service-name
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4318"
export OTEL_EXPORTER_OTLP_HEADERS="x-tracetest-token=<token>"

rails server -p 8080
```

:::note View a code sample
[Visit the example in GitHub, here.](https://github.com/kubeshop/tracetest/tree/main/examples/getting-started/ruby)
:::

</TabItem>
<TabItem value="otelcol" label="OpenTelemetry Collector">

Expand Down
110 changes: 55 additions & 55 deletions docs/docusaurus.config.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion

const lightCodeTheme = require('prism-react-renderer').themes.github;
const darkCodeTheme = require('prism-react-renderer').themes.dracula;
const lightCodeTheme = require("prism-react-renderer").themes.github;
const darkCodeTheme = require("prism-react-renderer").themes.dracula;

/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'Tracetest Docs',
tagline: 'Trace-based testing',
url: 'https://docs.tracetest.io',
baseUrl: '/',
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',
favicon: 'img/logo.svg',
title: "Tracetest Docs",
tagline: "Trace-based testing",
url: "https://docs.tracetest.io",
baseUrl: "/",
onBrokenLinks: "throw",
onBrokenMarkdownLinks: "warn",
favicon: "img/logo.svg",
trailingSlash: false,

// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName: 'kubeshop', // Usually your GitHub org/user name.
projectName: 'tracetest', // Usually your repo name.
organizationName: "kubeshop", // Usually your GitHub org/user name.
projectName: "tracetest", // Usually your repo name.

// Even if you don't use internalization, you can use this field to set useful
// metadata like html lang. For example, if your site is Chinese, you may want
// to replace "en" with "zh-Hans".
i18n: {
defaultLocale: 'en',
locales: ['en'],
defaultLocale: "en",
locales: ["en"],
},

markdown: {
mermaid: true,
},
themes: ['@docusaurus/theme-mermaid'],
themes: ["@docusaurus/theme-mermaid"],

presets: [
[
Expand All @@ -49,10 +49,10 @@ const config = {
customCss: require.resolve("./src/css/custom.css"),
},
sitemap: {
changefreq: 'always',
changefreq: "always",
priority: 0.5,
ignorePatterns: ['/tags/**'],
filename: 'sitemap.xml',
ignorePatterns: ["/tags/**"],
filename: "sitemap.xml",
},
}),
],
Expand Down Expand Up @@ -83,7 +83,7 @@ const config = {
// },
// ],
[
'@docusaurus/plugin-ideal-image',
"@docusaurus/plugin-ideal-image",
{
quality: 70,
max: 1030, // max resized image's size.
Expand All @@ -93,9 +93,9 @@ const config = {
},
],
[
require.resolve('docusaurus-gtm-plugin'),
require.resolve("docusaurus-gtm-plugin"),
{
id: 'GTM-MZ7RNS7', // GTM Container ID
id: "GTM-MZ7RNS7", // GTM Container ID
},
],
],
Expand All @@ -107,15 +107,15 @@ const config = {
hideable: true,
autoCollapseCategories: true,
},
},
},
colorMode: {
defaultMode: 'light',
defaultMode: "light",
disableSwitch: false,
respectPrefersColorScheme: false,
},
// Use this to add an announcement for a webinar or event.
announcementBar: {
id: 'announcement',
id: "announcement",
// content:
// '<a target="_blank" rel="noopener noreferrer" href="https://www.youtube.com/live/2MSDy3XHjtE?si=VlK7cxJOsgKi5QTE&t=1132">Tracetest is the official testing harness for the OpenTelemetry Demo! 🚀</a>',
// content:
Expand All @@ -132,61 +132,61 @@ const config = {
content:
'<a target="_blank" rel="noopener noreferrer" href="https://tracetest.io/blog/get-started-with-cloud-based-managed-tracetest">📚 Get started with Trace-based Testing: Embrace test-driven development with observability, using real data, and skip the hassle of mocks and black box testing 🔥</a>',
isCloseable: false,
},
},
navbar: {
hideOnScroll: true,
logo: {
alt: 'Tracetest Logo',
src: 'img/logo-landscape.svg',
srcDark: 'img/logo-landscape-dark.svg',
href: 'https://tracetest.io/',
target: '_blank',
alt: "Tracetest Logo",
src: "img/logo-landscape.svg",
srcDark: "img/logo-landscape-dark.svg",
href: "https://tracetest.io/",
target: "_blank",
},
items: [
{
type: 'docSidebar',
position: 'left',
sidebarId: 'tutorialSidebar',
label: 'Docs'
type: "docSidebar",
position: "left",
sidebarId: "tutorialSidebar",
label: "Docs",
},
{
type: 'docSidebar',
position: 'left',
sidebarId: 'guidesSidebar',
label: 'Examples & Guides'
type: "docSidebar",
position: "left",
sidebarId: "guidesSidebar",
label: "Examples & Guides",
},
{
type: 'dropdown',
label: 'Support',
position: 'left',
type: "dropdown",
label: "Support",
position: "left",
items: [
{
label: 'Overview',
href: 'https://tracetest.io/support',
label: "Overview",
href: "https://tracetest.io/support",
},
{
label: 'Community',
href: 'https://tracetest.io/community',
label: "Community",
href: "https://tracetest.io/community",
},
{
label: 'Pricing',
href: 'https://tracetest.io/pricing',
label: "Pricing",
href: "https://tracetest.io/pricing",
},
{
label: 'Talk to us in Slack',
href: 'https://dub.sh/tracetest-community',
label: "Talk to us in Slack",
href: "https://dub.sh/tracetest-community",
},
{
label: 'Open an issue in GitHub',
href: 'https://github.com/kubeshop/tracetest/issues/new/choose',
label: "Open an issue in GitHub",
href: "https://github.com/kubeshop/tracetest/issues/new/choose",
},
{
label: 'Learn',
href: 'https://tracetest.io/learn',
label: "Learn",
href: "https://tracetest.io/learn",
},
{
label: 'Contact Us',
href: 'https://tracetest.io/contact',
label: "Contact Us",
href: "https://tracetest.io/contact",
},
],
},
Expand Down Expand Up @@ -259,7 +259,7 @@ const config = {
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
additionalLanguages: ['bash'],
additionalLanguages: ["bash", "ruby"],
},
algolia: {
// The application ID provided by Algolia
Expand Down
32 changes: 32 additions & 0 deletions examples/getting-started/ruby/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Step-by-step

1. Install Dependencies

```bash
gem install opentelemetry-sdk
opentelemetry-exporter-otlp
opentelemetry-instrumentation-all
```

2. Configure OpenTelemetry

```ruby
require 'opentelemetry/sdk'
require 'opentelemetry/exporter/otlp'
require 'opentelemetry/instrumentation/all'
OpenTelemetry::SDK.configure do |c|
c.use_all() # enables all instrumentation!
end
```

3. Start the App

```bash
export OTEL_SERVICE_NAME=my-service-name
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4318"
export OTEL_EXPORTER_OTLP_HEADERS="x-tracetest-token=<token>"
rails server -p 8080
```

0 comments on commit 26756c1

Please sign in to comment.