engine: attach build type to update otel span#2938
Conversation
| br, err := builder.BuildAndDeploy(ctx, st, specs, currentState) | ||
| if err == nil { | ||
| return br, err | ||
| span.SetAttributes(core.KeyValue{Key: "buildType", Value: core.String(buildType)}) |
There was a problem hiding this comment.
this means that if the build fails (like if there's a compiler error), you won't attach the buildType attribute. is that what you want?
There was a problem hiding this comment.
Probably not, good call.
2a63308 to
2b4319d
Compare
| logger.Get(ctx).Debugf("Trying to build and deploy with %T", builder) | ||
| buildType := fmt.Sprintf("%T", builder) | ||
| logger.Get(ctx).Debugf("Trying to build and deploy with %s", buildType) | ||
| span.SetAttributes(core.KeyValue{Key: "buildType", Value: core.String(buildType)}) |
There was a problem hiding this comment.
I'm not sure this is going to work either? because this will tag a build with every type in a loop.
i think you have to have the individual builders do this, rather than do it in the Composite builder
There was a problem hiding this comment.
It overwrites the buildType in a loop, keeping only the last one it tried.
Looks like this:
{
"SpanContext": {
"TraceID": "97718d7d994b1724450eb1a39ec00f32",
"SpanID": "6f8240252631a828",
"TraceFlags": 1
},
"ParentSpanID": "0000000000000000",
"SpanKind": 1,
"Name": "tilt.dev/usage/update",
"StartTime": "2020-02-13T11:43:17.823262-05:00",
"EndTime": "2020-02-13T11:43:23.254345483-05:00",
"Attributes": [
{
"Key": "buildType",
"Value": {
"Type": "STRING",
"Value": "*engine.LocalTargetBuildAndDeployer"
}
},
{
"Key": "success",
"Value": {
"Type": "BOOL",
"Value": false
}
}
],
"MessageEvents": null,
"Links": null,
"Status": 0,
"HasRemoteParent": false,
"DroppedAttributeCount": 0,
"DroppedMessageEventCount": 0,
"DroppedLinkCount": 0,
"ChildSpanCount": 0
}
{
"SpanContext": {
"TraceID": "9c008352fff8bcf17bcaa199af024c5e",
"SpanID": "96302887b3a41f29",
"TraceFlags": 1
},
"ParentSpanID": "0000000000000000",
"SpanKind": 1,
"Name": "tilt.dev/usage/update",
"StartTime": "2020-02-13T11:43:23.262905-05:00",
"EndTime": "2020-02-13T11:43:23.693477832-05:00",
"Attributes": [
{
"Key": "buildType",
"Value": {
"Type": "STRING",
"Value": "*engine.ImageBuildAndDeployer"
}
},
{
"Key": "success",
"Value": {
"Type": "BOOL",
"Value": false
}
}
],
"MessageEvents": null,
"Links": null,
"Status": 0,
"HasRemoteParent": false,
"DroppedAttributeCount": 0,
"DroppedMessageEventCount": 0,
"DroppedLinkCount": 0,
"ChildSpanCount": 0
}
{
"SpanContext": {
"TraceID": "bffbeac52d88b7e049ea3fdbe817fd07",
"SpanID": "b210b6dbdb32b57c",
"TraceFlags": 1
},
"ParentSpanID": "0000000000000000",
"SpanKind": 1,
"Name": "tilt.dev/usage/update",
"StartTime": "2020-02-13T11:43:23.258338-05:00",
"EndTime": "2020-02-13T11:43:39.39247683-05:00",
"Attributes": [
{
"Key": "buildType",
"Value": {
"Type": "STRING",
"Value": "*engine.ImageBuildAndDeployer"
}
},
{
"Key": "success",
"Value": {
"Type": "BOOL",
"Value": false
}
}
],
"MessageEvents": null,
"Links": null,
"Status": 0,
"HasRemoteParent": false,
"DroppedAttributeCount": 0,
"DroppedMessageEventCount": 0,
"DroppedLinkCount": 0,
"ChildSpanCount": 0
}
{
"SpanContext": {
"TraceID": "ee71226a526c5e60763f8dfba6e4ab7f",
"SpanID": "5bce584383254a28",
"TraceFlags": 1
},
"ParentSpanID": "0000000000000000",
"SpanKind": 1,
"Name": "tilt.dev/usage/update",
"StartTime": "2020-02-13T11:43:39.394442-05:00",
"EndTime": "2020-02-13T11:43:40.77259152-05:00",
"Attributes": [
{
"Key": "buildType",
"Value": {
"Type": "STRING",
"Value": "*engine.LiveUpdateBuildAndDeployer"
}
},
{
"Key": "success",
"Value": {
"Type": "BOOL",
"Value": true
}
}
],
"MessageEvents": null,
"Links": null,
"Status": 0,
"HasRemoteParent": false,
"DroppedAttributeCount": 0,
"DroppedMessageEventCount": 0,
"DroppedLinkCount": 0,
"ChildSpanCount": 0
}
{
"SpanContext": {
"TraceID": "2be4db60cb8a9de9cb483223d982a432",
"SpanID": "6f941b79864f2ade",
"TraceFlags": 1
},
"ParentSpanID": "0000000000000000",
"SpanKind": 1,
"Name": "tilt.dev/usage/update",
"StartTime": "2020-02-13T11:43:40.774452-05:00",
"EndTime": "2020-02-13T11:43:45.237210603-05:00",
"Attributes": [
{
"Key": "buildType",
"Value": {
"Type": "STRING",
"Value": "*engine.ImageBuildAndDeployer"
}
},
{
"Key": "success",
"Value": {
"Type": "BOOL",
"Value": false
}
}
],
"MessageEvents": null,
"Links": null,
"Status": 0,
"HasRemoteParent": false,
"DroppedAttributeCount": 0,
"DroppedMessageEventCount": 0,
"DroppedLinkCount": 0,
"ChildSpanCount": 0
}There was a problem hiding this comment.
(note that that stream contains several updates, but each only has one buildType, and the types line up with the kind of builds that I did.
No description provided.