Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move tracegen functionality to telemetrygen traces subcommand #16358

Merged
merged 9 commits into from
Jan 11, 2023
Merged
Changes from 6 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
11 changes: 11 additions & 0 deletions .chloggen/deprecate-tracegen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: deprecation

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: tracegen

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Deprecates tracegen, functionality has been moved to telemetrygen traces

# One or more tracking issues related to the change
issues: [9597]
11 changes: 11 additions & 0 deletions .chloggen/move-tracegen-functionality-to-telemetrygen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: telemetrygen

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Moves tracegen functionality to the telemetrygen traces subcommand, as well as the existing Github actions

# One or more tracking issues related to the change
issues: [9597]
70 changes: 70 additions & 0 deletions .github/workflows/telemetrygen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: telemetrygen
on:
push:
branches: [ main ]
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true

jobs:
build-dev:
runs-on: ubuntu-latest
if: ${{ github.actor != 'dependabot[bot]' }}
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Build telemetrygen
uses: docker/build-push-action@v3
with:
context: cmd/telemetrygen
push: false
tags: ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen:dev

publish-latest:
runs-on: ubuntu-latest
if: (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) && github.repository == 'open-telemetry/opentelemetry-collector-contrib'
permissions:
packages: write
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push telemetrygen to Github packages
uses: docker/build-push-action@v3
with:
context: cmd/telemetrygen
push: true
tags: ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen:latest

publish-stable:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v') && github.repository == 'open-telemetry/opentelemetry-collector-contrib'
permissions:
packages: write
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Set Release Tag
id: github_tag
run: ./.github/workflows/scripts/set_release_tag.sh
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push telemetrygen to Github packages
run: |
docker build cmd/telemetrygen -t ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen:$RELEASE_TAG
docker push ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen:$RELEASE_TAG
env:
RELEASE_TAG: ${{ steps.github_tag.outputs.tag }}
Original file line number Diff line number Diff line change
@@ -13,15 +13,19 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package telemetrygen // import "github.com/open-telemetry/opentelemetry-collector-contrib/telemetrygen/internal/telemetrygen"
package main // import "github.com/open-telemetry/opentelemetry-collector-contrib/telemetrygen/internal/telemetrygen"

import (
"errors"
"os"

"github.com/spf13/cobra"

"github.com/open-telemetry/opentelemetry-collector-contrib/cmd/telemetrygen/internal/traces"
)

var tracesCfg *traces.Config

// rootCmd is the root command on which will be run children commands
var rootCmd = &cobra.Command{
Use: "telemetrygen",
@@ -35,8 +39,7 @@ var tracesCmd = &cobra.Command{
Short: "Simulates a client generating traces",
Example: "telemetrygen traces",
RunE: func(cmd *cobra.Command, args []string) error {
err := errors.New("[WIP] The 'traces' command is a work in progress, come back later")
return err
return traces.Start(tracesCfg)
liustanley marked this conversation as resolved.
Show resolved Hide resolved
},
}

@@ -54,6 +57,9 @@ var metricsCmd = &cobra.Command{
func init() {
rootCmd.AddCommand(tracesCmd, metricsCmd)

tracesCfg = new(traces.Config)
tracesCfg.Flags(tracesCmd.Flags())

// Disabling completion command for end user
// https://github.com/spf13/cobra/blob/master/shell_completions.md
rootCmd.CompletionOptions.DisableDefaultCmd = true
36 changes: 33 additions & 3 deletions cmd/telemetrygen/go.mod
Original file line number Diff line number Diff line change
@@ -2,9 +2,39 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/cmd/telemetryge

go 1.18

require github.com/spf13/cobra v1.5.0
require (
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
github.com/spf13/cobra v1.6.1
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.1
go.opentelemetry.io/otel v1.11.1
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.1
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.1
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.11.1
go.opentelemetry.io/otel/sdk v1.11.1
go.opentelemetry.io/otel/trace v1.11.1
go.uber.org/atomic v1.10.0
go.uber.org/zap v1.23.0
golang.org/x/time v0.2.0
google.golang.org/grpc v1.50.1
)

require (
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.13.0 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.1 // indirect
go.opentelemetry.io/proto/otlp v0.19.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
golang.org/x/net v0.1.0 // indirect
golang.org/x/sys v0.1.0 // indirect
golang.org/x/text v0.4.0 // indirect
google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading