krzko / otelgen

🤖 A tool to generate synthetic OpenTelemetry logs, metrics and traces using OTLP (gRPC and HTTP)
Apache License 2.0
82 stars 14 forks source link

Add support for logs #123

Closed ahayworth closed 1 week ago

ahayworth commented 3 months ago

This commit adds support for generating a single otel log line, based on upstream's beta support for logs. Currently, this change only supports generating a single log line. It does, however, seem to work:

otel-col  | 2024-07-22T15:31:55.338Z    info    LogsExporter    {"kind": "exporter", "data_type": "logs", "name": "debug", "resource logs": 1, "log records": 1}
otel-col  | 2024-07-22T15:31:55.338Z    info    ResourceLog #0
otel-col  | Resource SchemaURL: https://opentelemetry.io/schemas/1.10.0
otel-col  | Resource attributes:
otel-col  |      -> service.name: Str(otelgen)
otel-col  | ScopeLogs #0
otel-col  | ScopeLogs SchemaURL:
otel-col  | InstrumentationScope otelgen
otel-col  | LogRecord #0
otel-col  | ObservedTimestamp: 2024-07-22 15:31:55.258182 +0000 UTC
otel-col  | Timestamp: 2024-07-22 15:31:55.258182 +0000 UTC
otel-col  | SeverityText:
otel-col  | SeverityNumber: Info(9)
otel-col  | Body: Str(Test log 1)
otel-col  | Trace ID:
otel-col  | Span ID:
otel-col  | Flags: 0
otel-col  |     {"kind": "exporter", "data_type": "logs", "name": "debug"}

In addition, this PR updates various dependencies in order to make golang happy. We use a newer golang version in general, and update to the latest released versions of the APIs and SDKs for otel (logs, and metrics). This required a few renames, but nothing substantial.

ahayworth commented 3 months ago

I have no idea what the linter is complaining about now :(

level=warning msg="[runner] Can't run linter goanalysis_metalinter: buildir: failed to load package : could not load export data: no export data for \"cmp\""
  level=error msg="Running error: can't run linter goanalysis_metalinter\nbuildir: failed to load package : could not load export data: no export data for \"cmp\""
krzko commented 1 month ago

Thanks for submitting code to the project. I finally had a chance to revisit the tool and have added logs. it'll emit over OTLP gRPC and HTTP. So far mostly done testing locally using Loki as per screenshot.

image

Have also done a big update to traces and metrics too.

ahayworth commented 1 week ago

Fantastic, thank you! I'll close this as not needed then. 😄