Skip to content

engine: attach build type to update otel span#2938

Merged
jazzdan merged 4 commits into
masterfrom
dmiller/opentel-tag-updates-with-update-type
Feb 13, 2020
Merged

engine: attach build type to update otel span#2938
jazzdan merged 4 commits into
masterfrom
dmiller/opentel-tag-updates-with-update-type

Conversation

@jazzdan

@jazzdan jazzdan commented Feb 12, 2020

Copy link
Copy Markdown
Contributor

No description provided.

@jazzdan
jazzdan requested review from dbentley and nicks February 12, 2020 02:18
Comment thread internal/engine/build_and_deployer.go Outdated
br, err := builder.BuildAndDeploy(ctx, st, specs, currentState)
if err == nil {
return br, err
span.SetAttributes(core.KeyValue{Key: "buildType", Value: core.String(buildType)})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not, good call.

@jazzdan
jazzdan force-pushed the dmiller/opentel-tag-updates-with-update-type branch from 2a63308 to 2b4319d Compare February 12, 2020 15:48
Comment thread internal/engine/build_and_deployer.go Outdated
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)})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(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.

@jazzdan
jazzdan requested a review from nicks February 13, 2020 21:40
@jazzdan
jazzdan merged commit e595fc4 into master Feb 13, 2020
@nicks
nicks deleted the dmiller/opentel-tag-updates-with-update-type branch February 3, 2022 16:51
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