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

Add support for logs #123

Closed
wants to merge 2 commits into from
Closed

Conversation

ahayworth
Copy link
Contributor

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 ahayworth requested a review from krzko as a code owner July 22, 2024 15:35
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 ahayworth force-pushed the ahayworth/logs-logs-logs branch from 61f38ba to 0e3fc7c Compare July 22, 2024 15:39
This seemed to be confusing golangci-lint, so we just remove it. We can
use the upstream `metric.Exporter` interface instead.
@ahayworth
Copy link
Contributor Author

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
Copy link
Owner

krzko commented Sep 29, 2024

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
Copy link
Contributor Author

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

@ahayworth ahayworth closed this Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants