Skip to content

Commit f80d4ad

Browse files
authored
feat: add service.version resource attribute and show version in connected message (#83)
1 parent ddd3203 commit f80d4ad

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

cmd/on-event/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"github.com/dash0hq/dash0-agent-plugin/internal/filelog"
1818
"github.com/dash0hq/dash0-agent-plugin/internal/otlp"
1919
"github.com/dash0hq/dash0-agent-plugin/internal/transcript"
20+
"github.com/dash0hq/dash0-agent-plugin/internal/version"
2021
)
2122

2223
func main() {
@@ -414,7 +415,7 @@ func run() error {
414415
"",
415416
)
416417
} else {
417-
printHookResponse("dash0: connected", "")
418+
printHookResponse(fmt.Sprintf("dash0: connected (v%s)", version.Version), "")
418419
}
419420
}
420421

internal/otlp/otlp.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"time"
1414

1515
"github.com/dash0hq/dash0-agent-plugin/internal/vcs"
16+
"github.com/dash0hq/dash0-agent-plugin/internal/version"
1617
)
1718

1819
// OTLP JSON wire format types.
@@ -119,6 +120,7 @@ func SendLog(event map[string]any, cfg Config) error {
119120
}
120121
resourceAttrs := []Attribute{
121122
{Key: "service.name", Value: StringVal(serviceName)},
123+
{Key: "service.version", Value: StringVal(version.Version)},
122124
{Key: "gen_ai.provider.name", Value: StringVal("anthropic")},
123125
}
124126
if cfg.AgentName != "" {
@@ -139,7 +141,7 @@ func SendLog(event map[string]any, cfg Config) error {
139141
ScopeLogs: []ScopeLogs{{
140142
Scope: Scope{
141143
Name: "dash0-agent-plugin",
142-
Version: "0.1.0",
144+
Version: version.Version,
143145
},
144146
LogRecords: []LogRecord{{
145147
TimeUnixNano: strconv.FormatInt(ts.UnixNano(), 10),

internal/otlp/trace.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ func SendTrace(span Span, event map[string]any, cfg Config) error {
119119
}
120120
resourceAttrs := []Attribute{
121121
{Key: "service.name", Value: StringVal(serviceName)},
122+
{Key: "service.version", Value: StringVal(version.Version)},
122123
{Key: "gen_ai.provider.name", Value: StringVal("anthropic")},
123124
}
124125
if cfg.AgentName != "" {

0 commit comments

Comments
 (0)