Skip to content

Commit

Permalink
Merge branch 'main' into fix-composite-primary-key
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgeepc committed Sep 18, 2023
2 parents f7eea00 + ca4307a commit 11f7acd
Show file tree
Hide file tree
Showing 52 changed files with 6,192 additions and 259 deletions.
2 changes: 2 additions & 0 deletions agent/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ func (c *Client) Start(ctx context.Context) error {
return err
}

c.startHearthBeat(ctx)

return nil
}

Expand Down
21 changes: 21 additions & 0 deletions agent/client/workflow_ping.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package client

import (
"context"
"time"

"github.com/kubeshop/tracetest/agent/proto"
)

func (c *Client) startHearthBeat(ctx context.Context) error {
client := proto.NewOrchestratorClient(c.conn)
ticker := time.NewTicker(2 * time.Minute)

go func() {
for range ticker.C {
client.Ping(ctx, c.sessionConfig.AgentIdentification)
}
}()

return nil
}
5 changes: 3 additions & 2 deletions agent/collector/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"time"

"github.com/kubeshop/tracetest/server/otlp"
"go.opentelemetry.io/otel/trace"
)

type Config struct {
Expand All @@ -20,7 +21,7 @@ type Config struct {
RemoteServerToken string
}

func Start(ctx context.Context, config Config) error {
func Start(ctx context.Context, config Config, tracer trace.Tracer) error {
ingester, err := newForwardIngester(ctx, config.BatchTimeout, remoteIngesterConfig{
URL: config.RemoteServerURL,
Token: config.RemoteServerToken,
Expand All @@ -29,7 +30,7 @@ func Start(ctx context.Context, config Config) error {
return fmt.Errorf("could not start local collector: %w", err)
}

grpcServer := otlp.NewGrpcServer(fmt.Sprintf("0.0.0.0:%d", config.GRPCPort), ingester)
grpcServer := otlp.NewGrpcServer(fmt.Sprintf("0.0.0.0:%d", config.GRPCPort), ingester, tracer)
httpServer := otlp.NewHttpServer(fmt.Sprintf("0.0.0.0:%d", config.HTTPPort), ingester)

onProcessTermination(func() {
Expand Down
19 changes: 13 additions & 6 deletions agent/collector/collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,25 @@ import (
"github.com/kubeshop/tracetest/agent/collector/mocks"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/otel/trace"
)

func TestCollector(t *testing.T) {
targetServer, err := mocks.NewOTLPIngestionServer()
require.NoError(t, err)

collector.Start(context.Background(), collector.Config{
HTTPPort: 4318,
GRPCPort: 4317,
BatchTimeout: 2 * time.Second,
RemoteServerURL: targetServer.Addr(),
})
noopTracer := trace.NewNoopTracerProvider().Tracer("noop_tracer")

collector.Start(
context.Background(),
collector.Config{
HTTPPort: 4318,
GRPCPort: 4317,
BatchTimeout: 2 * time.Second,
RemoteServerURL: targetServer.Addr(),
},
noopTracer,
)

tracer, err := mocks.NewTracer(context.Background(), "localhost:4317")
require.NoError(t, err)
Expand Down
36 changes: 21 additions & 15 deletions agent/proto/orchestrator.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions agent/proto/orchestrator.proto
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ service Orchestrator {

// Register an agent to listen for shutdown commands
rpc RegisterShutdownListener(AgentIdentification) returns (stream ShutdownRequest) {}

// Ping is used to check if the agent is still connected
rpc Ping(AgentIdentification) returns (Empty) {}
}

// Empty message for endpoints that don't return anything
Expand Down
41 changes: 40 additions & 1 deletion agent/proto/orchestrator_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/docs/configuration/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ View [configuration for OpenTelemetry Collector](./connecting-to-data-stores/ope

## Trace Data Store Configuration Examples

Examples of configuring Tracetest to access different data stores can be found in the [`examples` folder of the Tracetest GitHub repo](https://github.com/kubeshop/tracetest/tree/main/examples). Check out the [**Recipes**](../examples-tutorials/recipes.md) for guided walkthroughs of sample use cases.
Examples of configuring Tracetest to access different data stores can be found in the [`examples` folder of the Tracetest GitHub repo](https://github.com/kubeshop/tracetest/tree/main/examples). Check out the [**Recipes**](../examples-tutorials/recipes.mdx) for guided walkthroughs of sample use cases.

We will be adding new data stores over the next couple of months - [let us know](https://github.com/kubeshop/tracetest/issues/new/choose) any additional data stores you would like to see us support.

Expand Down
24 changes: 24 additions & 0 deletions docs/docs/examples-tutorials/overview.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
id: overview
title: Welcome to Tracetest Examples & Tutorials! 👋
description: Here you can find examples, recipes, tutorials, and video content to help you get started with Tracetest.
hide_table_of_contents: false
keywords:
- tracetest
- trace-based testing
- observability
- distributed tracing
- testing
image: https://res.cloudinary.com/djwdcmwdz/image/upload/v1689693872/docs/Blog_Thumbnail_28_ugy2yy.png
breadcrumb_label: Nothing
---

import CodeBlock from '@theme/CodeBlock';

Find tutorials and guides to help you get started with Tracetest.

```mdx-code-block
import {ExamplesTutorialsOverviewRow} from '@site/src/components/ExamplesTutorialsOverview';
<ExamplesTutorialsOverviewRow />
```
Original file line number Diff line number Diff line change
@@ -1,23 +1,48 @@
# Recipes
---
id: recipes
title: 🍱 Recipes
description: Here you can find tutorials to help you get started with Tracetest.
hide_table_of_contents: false
keywords:
- tracetest
- trace-based testing
- observability
- distributed tracing
- testing
image: https://res.cloudinary.com/djwdcmwdz/image/upload/v1689693872/docs/Blog_Thumbnail_28_ugy2yy.png
breadcrumb_label: Nothing
---

These recipes will show you the best practices for using Tracetest.
If you're already building something with Tracetest, explore these Recipes. They're short, self-contained, and runnable solutions to popular use cases.

## Streams and Message Queues

These recipes show how to trigger Tracetest test runs with message queues like Kafka.

- [Testing Kafka in a Go API with OpenTelemetry](./recipes/testing-kafka-go-api-with-opentelemetry-tracetest.mdx)

## Trace Data Stores

These recipes show integrations with trace data stores and tracing vendors/providers.

### OpenTelemetry Collector

This integration point uses the OpenTelemetry Collector as a router to send trace data to both Tracetest and tracing vendors/providers.
This integration point uses the OpenTelemetry Collector as a router to send trace data to Tracetest.

- [Sending traces directly to Tracetest from a Node.js app using OpenTelemetry Collector](./recipes/running-tracetest-without-a-trace-data-store.md)
- [Sending traces with manual instrumentation directly to Tracetest from a Node.js app using OpenTelemetry Collector](./recipes/running-tracetest-without-a-trace-data-store-with-manual-instrumentation.md)
- [Sending traces with manual instrumentation directly to Tracetest from a Python app using OpenTelemetry Collector](./recipes/running-python-app-with-opentelemetry-collector-and-tracetest.md)

### OpenTelemetry Collector + Tracing Vendors

This integration point uses the OpenTelemetry Collector as a router to send trace data to both Tracetest and tracing vendors/providers.

- [Sending traces to Lightstep and Tracetest from the OpenTelemetry Demo with OpenTelemetry Collector](./recipes/running-tracetest-with-lightstep.md)
- [Sending traces to New Relic and Tracetest from the OpenTelemetry Demo with OpenTelemetry Collector](./recipes/running-tracetest-with-new-relic.md)
- [Sending traces to Datadog and Tracetest from the OpenTelemetry Demo with OpenTelemetry Collector](./recipes/running-tracetest-with-datadog.md)
- [Sending traces to Honeycomb and Tracetest from a Node.js app using the OpenTelemetry Collector](./recipes/running-tracetest-with-honeycomb.md)
- [Sending traces to Dynatrace and Tracetest from the OpenTelemetry Demo with OpenTelemetry Collector](./recipes/running-tracetest-with-dynatrace.md)
- [Sending traces to SigNoz and Tracetest from the Pokeshop API with OpenTelemetry Collector](./recipes/running-tracetest-with-signoz-pokeshop.md)

### Jaeger

Expand Down
Loading

0 comments on commit 11f7acd

Please sign in to comment.