Skip to content

Commit ed31b8f

Browse files
authored
Merge branch 'main' into ta/O11Y-360/obs-android-configuration-api
2 parents 59bb31d + c06accb commit ed31b8f

File tree

127 files changed

+6809
-575
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+6809
-575
lines changed

.changeset/config.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
"functions",
1818
"nestjs",
1919
"nextjs",
20+
"node-express-plugin",
21+
"react-native-otel",
2022
"react-router",
2123
"react-three-vite",
2224
"remix",

.github/workflows/dotnet-plugin.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: .NET ObservabilityPlugin
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches: ['main']
6+
pull_request:
7+
branches: ['main']
8+
paths:
9+
- 'sdk/@launchdarkly/observability-dotnet/**'
10+
- '.github/workflows/dotnet-plugin.yml'
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
build-and-test:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9
21+
with:
22+
dotnet-version: '8.0.x'
23+
24+
- run: dotnet restore
25+
working-directory: sdk/@launchdarkly/observability-dotnet
26+
27+
- run: dotnet build --no-restore
28+
working-directory: sdk/@launchdarkly/observability-dotnet
29+
30+
- run: dotnet test --no-restore
31+
working-directory: sdk/@launchdarkly/observability-dotnet

.github/workflows/go-plugin-e2e.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Go Observability Plugin E2E
2+
3+
on:
4+
push:
5+
branches: ['main']
6+
pull_request:
7+
types: [opened, synchronize]
8+
paths:
9+
- 'e2e/go-plugin/**'
10+
- '.github/workflows/go-plugin-e2e.yml'
11+
12+
concurrency: ${{ github.workflow }}-${{ github.ref }}
13+
jobs:
14+
build:
15+
permissions:
16+
contents: read
17+
name: Quality Check
18+
runs-on: ubuntu-latest
19+
defaults:
20+
run:
21+
working-directory: ./e2e/go-plugin
22+
steps:
23+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
24+
with:
25+
token: ${{ secrets.GITHUB_TOKEN }}
26+
27+
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5
28+
with:
29+
go-version-file: './e2e/go-plugin/go.mod'
30+
cache-dependency-path: './e2e/go-plugin/go.sum'
31+
32+
- name: Install dependencies
33+
run: make install
34+
35+
- name: Run linter
36+
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9
37+
with:
38+
args: -v --config ./.golangci.yaml
39+
working-directory: e2e/go-plugin
40+
version: latest
41+
42+
- name: Build
43+
run: make build

.github/workflows/release-please.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,4 @@ jobs:
8585
with:
8686
workspace-path: sdk/@launchdarkly/observability-android
8787
aws-role-arn: ${{ vars.AWS_ROLE_ARN }}
88+
dry-run: true

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ __generated
2222
highlight.io/out
2323
sdk/highlightinc-highlight-datasource/grafana/data
2424
sdk/highlight-php
25+
sdk/@launchdarkly/observability-dotnet

.release-please-manifest.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"sdk/@launchdarkly/observability-python": "0.1.0",
3+
"go": "0.2.0",
34
"sdk/@launchdarkly/observability-android": "0.2.0"
45
}

CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Repository Maintainers
2-
* @launchdarkly/team-observability-reviewers
2+
* @launchdarkly/team-observability

e2e/go-plugin/.golangci.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
version: '2'
2+
run:
3+
tests: false
4+
linters:
5+
enable:
6+
- bodyclose
7+
- dupl
8+
- gochecknoinits
9+
- goconst
10+
- gocritic
11+
- gocyclo
12+
- godox
13+
- gosec
14+
- lll
15+
- misspell
16+
- nakedret
17+
- nolintlint
18+
- prealloc
19+
- revive
20+
- staticcheck
21+
- unconvert
22+
- unparam
23+
- whitespace
24+
settings:
25+
revive:
26+
rules:
27+
- name: exported
28+
arguments:
29+
- disableStutteringCheck
30+
exclusions:
31+
generated: lax
32+
paths:
33+
- third_party$
34+
- builtin$
35+
- examples$
36+
issues:
37+
max-same-issues: 1000
38+
formatters:
39+
enable:
40+
- gofmt
41+
- goimports
42+
settings:
43+
gofmt:
44+
simplify: false
45+
goimports:
46+
local-prefixes:
47+
- gopkg.in/launchdarkly
48+
- github.com/launchdarkly
49+
exclusions:
50+
generated: lax
51+
paths:
52+
- third_party$
53+
- builtin$
54+
- examples$

e2e/go-plugin/Makefile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
.PHONY: help install lint build format
2+
3+
# Default target
4+
help:
5+
@echo "Available targets:"
6+
@echo " install - Install dependencies using go mod"
7+
@echo " lint - Run golangci-lint"
8+
@echo " format - Format code using gofmt"
9+
@echo " test - Run tests with coverage"
10+
@echo " build - Build the package"
11+
@echo " clean - Clean build artifacts"
12+
@echo " all - Run install, lint, test, and build"
13+
14+
# Install dependencies
15+
install:
16+
go mod download
17+
go mod tidy
18+
19+
# Run linting with golangci-lint
20+
lint:
21+
golangci-lint run
22+
23+
# Format code with gofmt
24+
format:
25+
gofmt -s -w .
26+
golangci-lint run --fix
27+
28+
# Build examples
29+
build:
30+
go build -v ./...
31+
32+
33+
# Run all checks (install, lint, test, build)
34+
all: install lint test build

e2e/go-plugin/README.md

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# LaunchDarkly Observability Plugin Examples
2+
3+
This project demonstrates how to use the LaunchDarkly Observability plugin with various Go libraries and frameworks.
4+
5+
## Prerequisites
6+
7+
- Go 1.24.3 or later
8+
- A LaunchDarkly SDK key
9+
10+
## Setup
11+
12+
1. Clone this repository:
13+
```bash
14+
git clone https://github.com/launchdarkly/observability-sdk.git
15+
cd observability-sdk/e2e/go-plugin
16+
```
17+
18+
2. Set your LaunchDarkly SDK key as an environment variable:
19+
```bash
20+
export LAUNCHDARKLY_SDK_KEY="your-sdk-key-here"
21+
```
22+
23+
## Examples
24+
25+
This project contains several examples, each demonstrating the LaunchDarkly Observability plugin with different Go frameworks and libraries:
26+
27+
- [Fiber Example](#1-fiber-example-cmdfiber)
28+
- [Gin Example](#2-gin-example-cmdgin)
29+
- [Gorilla Mux Example](#3-gorilla-mux-example-cmdgorillamux)
30+
- [Standard HTTP Example](#4-standard-http-example-cmdhttp)
31+
- [Logrus Example](#5-logrus-example-cmdlogrus)
32+
33+
### 1. Fiber Example (`cmd/fiber/`)
34+
35+
A simple web server using the [Fiber](https://gofiber.io/) framework with OpenTelemetry instrumentation.
36+
37+
**Features:**
38+
- Uses Fiber web framework
39+
- Demonstrates basic feature flag evaluation
40+
- Shows OpenTelemetry integration with Fiber
41+
42+
**To run:**
43+
```bash
44+
go run cmd/fiber/fiber.go
45+
```
46+
47+
**Endpoints:**
48+
- `GET /ping` - Returns "ping" or "pling" based on the `pling` feature flag
49+
50+
### 2. Gin Example (`cmd/gin/`)
51+
52+
A web server using the [Gin](https://gin-gonic.com/) framework with OpenTelemetry instrumentation.
53+
54+
**Features:**
55+
- Uses Gin web framework
56+
- Demonstrates feature flag evaluation in HTTP handlers
57+
- Shows OpenTelemetry integration with Gin
58+
59+
**To run:**
60+
```bash
61+
go run cmd/gin/gin.go
62+
```
63+
64+
**Endpoints:**
65+
- `GET /ping` - Returns a JSON response with "pong" or "pling" based on the `pling` feature flag
66+
67+
### 3. Gorilla Mux Example (`cmd/gorillamux/`)
68+
69+
A web server using the [Gorilla Mux](https://github.com/gorilla/mux) router with OpenTelemetry instrumentation.
70+
71+
**Features:**
72+
- Uses Gorilla Mux router
73+
- Demonstrates graceful shutdown handling
74+
- Shows OpenTelemetry integration with Gorilla Mux
75+
- Includes a dice rolling endpoint with feature flag integration
76+
77+
**To run:**
78+
```bash
79+
go run cmd/gorillamux/gorillamux.go
80+
```
81+
82+
**Endpoints:**
83+
- `GET /rolldice` - Rolls a dice and returns the result, with verbose output controlled by the `verbose-response` feature flag
84+
85+
### 4. Standard HTTP Example (`cmd/http/`)
86+
87+
A web server using Go's standard `net/http` package with OpenTelemetry instrumentation.
88+
89+
**Features:**
90+
- Uses standard `net/http` package
91+
- Demonstrates manual OpenTelemetry span creation
92+
- Shows feature flag evaluation with custom spans
93+
- Includes graceful shutdown handling
94+
95+
**To run:**
96+
```bash
97+
go run cmd/http/http.go
98+
```
99+
100+
**Endpoints:**
101+
- `GET /rolldice` - Rolls a dice and returns the result, with verbose output controlled by the `verbose-response` feature flag
102+
103+
### 5. Logrus Example (`cmd/logrus/`)
104+
105+
A web server demonstrating structured logging with [Logrus](https://github.com/sirupsen/logrus) and OpenTelemetry.
106+
107+
**Features:**
108+
- Uses Logrus for structured logging
109+
- Demonstrates OpenTelemetry integration with Logrus
110+
- Shows how to log structured data with various types
111+
- Includes feature flag evaluation
112+
113+
**To run:**
114+
```bash
115+
go run cmd/logrus/logrus.go
116+
```
117+
118+
**Endpoints:**
119+
- `GET /log` - Logs structured data with various field types and demonstrates Logrus + OpenTelemetry integration
120+

0 commit comments

Comments
 (0)