"),
+ )
+ if err != nil {
+ return nil, err
+ }
+
+ resource := sdkresource.NewWithAttributes("",
+ attribute.String("service.name", "my-app"),
+ attribute.String("posthog.distinct_id", "user_123"), // optional: identifies the user in PostHog
+ attribute.String("foo", "bar"), // custom properties are passed through
+ )
+ provider := sdktrace.NewTracerProvider(
+ sdktrace.WithResource(resource),
+ sdktrace.WithSpanProcessor(processor),
+ )
+ otel.SetTracerProvider(provider)
+ return provider, nil
+ }
+ `,
+ },
]}
/>
+
+
+ {dedent`
+ In Go, if your app already has a \`TracerProvider\`, attach the processor to it with
+ \`provider.RegisterSpanProcessor(processor)\` instead of creating a new provider. Call
+ \`provider.Shutdown\` (or \`provider.ForceFlush\`) before exit so buffered spans are sent.
+ `}
+
>
),
},
@@ -135,6 +186,16 @@ export const getOpenTelemetrySteps = (ctx: OnboardingComponentsContext): StepDef
`$ai_generation` event.
+
+ {dedent`
+ Go has no instrumentation libraries for provider SDKs yet: start a span around each call
+ and set the \`gen_ai.*\` attributes yourself, as shown in the Go tab. Frameworks that
+ already emit \`gen_ai.*\` spans, like [ADK Go](https://google.golang.org/adk), are captured
+ automatically. ADK Go sends message content as log records rather than span attributes,
+ so its generations arrive without prompts and responses.
+ `}
+
+
@@ -234,7 +335,7 @@ export const getOpenTelemetrySteps = (ctx: OnboardingComponentsContext): StepDef
>
),
},
- getOtelSessionIdStep(ctx, { languages: ['Python', 'Node'] }),
+ getOtelSessionIdStep(ctx, { languages: ['Python', 'Node', 'Go'] }),
{
title: 'Other instrumentations, direct OTLP, and troubleshooting',
badge: 'optional',
@@ -253,7 +354,7 @@ export const getOpenTelemetrySteps = (ctx: OnboardingComponentsContext): StepDef
{dedent`
- **Direct OTLP export.** If you run an OpenTelemetry Collector, or want to export from a language that isn't Python or Node.js, point any OTLP/HTTP exporter directly at PostHog's AI ingestion endpoint. PostHog accepts OTLP over HTTP in both \`application/x-protobuf\` and \`application/json\`, authenticated with a \`Bearer\` token. The endpoint is signal-specific (traces only), so use the \`OTEL_EXPORTER_OTLP_TRACES_*\` variants rather than the general \`OTEL_EXPORTER_OTLP_*\` ones (the SDK appends \`/v1/traces\` to the latter and would 404).
+ **Direct OTLP export.** If you run an OpenTelemetry Collector, or want to export from a language other than Python, Node.js, or Go, point any OTLP/HTTP exporter directly at PostHog's AI ingestion endpoint. PostHog accepts OTLP over HTTP in both \`application/x-protobuf\` and \`application/json\`, authenticated with a \`Bearer\` token. The endpoint is signal-specific (traces only), so use the \`OTEL_EXPORTER_OTLP_TRACES_*\` variants rather than the general \`OTEL_EXPORTER_OTLP_*\` ones (the SDK appends \`/v1/traces\` to the latter and would 404).
`}
diff --git a/docs/onboarding/steps.ts b/docs/onboarding/steps.ts
index 465ad145ce81..3faa8395eaf2 100644
--- a/docs/onboarding/steps.ts
+++ b/docs/onboarding/steps.ts
@@ -24,3 +24,6 @@ export interface StepProps {
export interface StepsProps {
children: ReactNode
}
+
+/** CodeBlock tab language that renders markdown prose with clickable links instead of highlighted code. */
+export const PROSE_LANGUAGE = 'prose'
diff --git a/frontend/src/scenes/onboarding/shared/OnboardingDocsContentWrapper.tsx b/frontend/src/scenes/onboarding/shared/OnboardingDocsContentWrapper.tsx
index 9fb0e383bf97..5fd6953d0bee 100644
--- a/frontend/src/scenes/onboarding/shared/OnboardingDocsContentWrapper.tsx
+++ b/frontend/src/scenes/onboarding/shared/OnboardingDocsContentWrapper.tsx
@@ -3,6 +3,7 @@ import React, { Children, ReactNode, createContext, isValidElement, useContext,
import { StepProps, StepsProps } from '@posthog/shared-onboarding/steps'
import { StepDefinition, StepModifier } from '@posthog/shared-onboarding/steps'
+import { PROSE_LANGUAGE } from '@posthog/shared-onboarding/steps'
import { CodeSnippet, getLanguage } from 'lib/components/CodeSnippet'
import { CopyToClipboardInline } from 'lib/components/CopyToClipboard'
@@ -194,7 +195,11 @@ function CodeBlock({
const block = codeBlocks[0]
return (
- {block.code}
+ {block.language === PROSE_LANGUAGE ? (
+ {block.code}
+ ) : (
+ {block.code}
+ )}
{hostHint}
)
@@ -219,7 +224,11 @@ function CodeBlock({
}))}
/>
)}
- {selectedBlock.code}
+ {selectedBlock.language === PROSE_LANGUAGE ? (
+ {selectedBlock.code}
+ ) : (
+ {selectedBlock.code}
+ )}
{hostHint}
)