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

feat: use latest apm-data to set success event.outcome when otel span.Status is Unset #12199

Merged
merged 7 commits into from
Dec 29, 2023

Conversation

kyungeunni
Copy link
Contributor

@kyungeunni kyungeunni commented Dec 12, 2023

Motivation/summary

The latest apm-data has changed how we map span.Status: Unset when processing otel inputs. Currently, we set event.outcome: unknown when such input is received, but we decided to map it to event.outcome: success.

Checklist

For functional changes, consider:

  • Is it observable through the addition of either logging or metrics?
  • Is its use being published in telemetry to enable product improvement?
  • Have system tests been added to avoid regression?

How to test these changes

Ingest Otel data, make sure the span.Status is Unset. Then check the transaction doc containing event.outcome: success

Related issues

@kyungeunni kyungeunni requested a review from a team as a code owner December 12, 2023 08:06
Copy link
Contributor

mergify bot commented Dec 12, 2023

This pull request does not have a backport label. Could you fix it @kyungeunni? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-7.17 is the label to automatically backport to the 7.17 branch.
  • backport-8./d is the label to automatically backport to the 8./d branch. /d is the digit.

NOTE: backport-skip has been added to this pull request.

@mergify mergify bot added the backport-skip Skip notification from the automated backport with mergify label Dec 12, 2023
Copy link
Contributor

mergify bot commented Dec 18, 2023

This pull request is now in conflicts. Could you fix it @kyungeunni? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b bump-apm-data upstream/bump-apm-data
git merge upstream/main
git push upstream bump-apm-data

@kruskall
Copy link
Member

@kyungeunni Can you fix the conflicts ?

(I think you might also need to run go mod tidy and make fmt update)

kruskall
kruskall previously approved these changes Dec 28, 2023
@kruskall kruskall enabled auto-merge (squash) December 28, 2023 19:06
@kruskall
Copy link
Member

I think the system tests approved docs need to be updated (make system-test check-approvals)

@kruskall kruskall merged commit d84d79d into elastic:main Dec 29, 2023
15 checks passed
v1v added a commit to v1v/apm-server that referenced this pull request Jan 10, 2024
* feature/patch-release: (249 commits)
  Update release.mk
  [updatecli] Bump elastic stack version to 8.13.0-8upz6ftd (elastic#12380)
  chore: Update to elastic/beats@95f0f85a3edd (elastic#12370)
  ci(release): automate release steps for the minor (elastic#12233)
  build(deps): bump the github-actions group with 1 update (elastic#12365)
  chore: Update to elastic/beats@d1b32774aef4 (elastic#12362)
  [updatecli] Bump elastic stack version to 8.13.0-ybxdr713 (elastic#12349)
  chore: Update to elastic/beats@81ebafc4c2da (elastic#12352)
  [apm docs consolidation] Delete moved files, update README (elastic#12341)
  [updatecli] Bump elastic stack version to 8.13.0-toucn398 (elastic#12325)
  docs: fix incorrect filenames in a document for Windows (elastic#12343)
  chore: Update to elastic/beats@6f192c01ef19 (elastic#12337)
  build(deps): bump golang.org/x/crypto from 0.14.0 to 0.17.0 (elastic#12237)
  Update NOTICE.txt year (elastic#12333)
  build(deps): bump the github-actions group with 1 update (elastic#12322)
  [updatecli] Bump elastic stack version to 8.13.0-4f8l51qr (elastic#12315)
  docs: Update known issues as fix was released (elastic#12196)
  feat: use latest apm-data to set success `event.outcome` when otel span.Status is Unset (elastic#12199)
  [updatecli] Bump elastic stack version to 8.13.0-4aavtlfc (elastic#12304)
  chore: rename apm-mutating-webhook to apm-k8s-attacher (elastic#12222)
  ...
@marclop marclop self-assigned this Mar 20, 2024
@marclop
Copy link
Contributor

marclop commented Mar 20, 2024

Sent data using sendotlp because it doesn't call span.SetStatus()

func generateSpans(ctx context.Context, tracer trace.Tracer) error {
ctx, parent := tracer.Start(ctx, "parent")
defer parent.End()
_, child1 := tracer.Start(ctx, "child1")
time.Sleep(10 * time.Millisecond)
child1.AddEvent("an arbitrary event")
child1.End()
_, child2 := tracer.Start(ctx, "child2")
time.Sleep(10 * time.Millisecond)
child2.RecordError(errors.New("an exception occurred"))
child2.End()
return nil
}

$ go run main.go -secret-token=$ELASTIC_APM_SECRET_TOKEN -endpoint=$APM_SERVER_ADDRESS                                                                                                                               <region:us-east-1>
2024-03-20T15:52:57+01:00	INFO	zapgrpc/zapgrpc.go:178	[core] [Channel #1] Channel created
2024-03-20T15:52:57+01:00	INFO	zapgrpc/zapgrpc.go:178	[core] [Channel #1] original dial target is: "89076c71eb054387ae69b2f50f425642.apm.us-west2.gcp.elastic-cloud.com:443"
2024-03-20T15:52:57+01:00	INFO	zapgrpc/zapgrpc.go:178	[core] [Channel #1] dial target "89076c71eb054387ae69b2f50f425642.apm.us-west2.gcp.elastic-cloud.com:443" parse failed: parse "89076c71eb054387ae69b2f50f425642.apm.us-west2.gcp.elastic-cloud.com:443": first path segment in URL cannot contain colon
2024-03-20T15:52:57+01:00	INFO	zapgrpc/zapgrpc.go:178	[core] [Channel #1] fallback to scheme "passthrough"
2024-03-20T15:52:57+01:00	INFO	zapgrpc/zapgrpc.go:178	[core] [Channel #1] parsed dial target is: {URL:{Scheme:passthrough Opaque: User: Host: Path:/89076c71eb054387ae69b2f50f425642.apm.us-west2.gcp.elastic-cloud.com:443 RawPath: OmitHost:false ForceQuery:false RawQuery: Fragment: RawFragment:}}
2024-03-20T15:52:57+01:00	INFO	zapgrpc/zapgrpc.go:178	[core] [Channel #1] Channel authority set to "89076c71eb054387ae69b2f50f425642.apm.us-west2.gcp.elastic-cloud.com:443"
2024-03-20T15:52:57+01:00	INFO	zapgrpc/zapgrpc.go:178	[core] [Channel #1] Resolver state updated: {
  "Addresses": [
    {
      "Addr": "89076c71eb054387ae69b2f50f425642.apm.us-west2.gcp.elastic-cloud.com:443",
      "ServerName": "",
      "Attributes": null,
      "BalancerAttributes": null,
      "Metadata": null
    }
  ],
  "Endpoints": [
    {
      "Addresses": [
        {
          "Addr": "89076c71eb054387ae69b2f50f425642.apm.us-west2.gcp.elastic-cloud.com:443",
          "ServerName": "",
          "Attributes": null,
          "BalancerAttributes": null,
          "Metadata": null
        }
      ],
      "Attributes": null
    }
  ],
  "ServiceConfig": null,
  "Attributes": null
} (resolver returned new addresses)
2024-03-20T15:52:57+01:00	INFO	zapgrpc/zapgrpc.go:178	[core] [Channel #1] Channel switches to new LB policy "pick_first"
2024-03-20T15:52:57+01:00	INFO	zapgrpc/zapgrpc.go:178	[core] [pick-first-lb 0x140003d4ba0] Received new config {
  "shuffleAddressList": false
}, resolver state {
  "Addresses": [
    {
      "Addr": "89076c71eb054387ae69b2f50f425642.apm.us-west2.gcp.elastic-cloud.com:443",
      "ServerName": "",
      "Attributes": null,
      "BalancerAttributes": null,
      "Metadata": null
    }
  ],
  "Endpoints": [
    {
      "Addresses": [
        {
          "Addr": "89076c71eb054387ae69b2f50f425642.apm.us-west2.gcp.elastic-cloud.com:443",
          "ServerName": "",
          "Attributes": null,
          "BalancerAttributes": null,
          "Metadata": null
        }
      ],
      "Attributes": null
    }
  ],
  "ServiceConfig": null,
  "Attributes": null
}
2024-03-20T15:52:57+01:00	INFO	zapgrpc/zapgrpc.go:178	[core] [Channel #1 SubChannel #2] Subchannel created
2024-03-20T15:52:57+01:00	INFO	zapgrpc/zapgrpc.go:178	[core] [Channel #1] Channel Connectivity change to CONNECTING
2024-03-20T15:52:57+01:00	INFO	zapgrpc/zapgrpc.go:178	[core] [Channel #1 SubChannel #2] Subchannel Connectivity change to CONNECTING
2024-03-20T15:52:57+01:00	INFO	zapgrpc/zapgrpc.go:178	[core] [Channel #1 SubChannel #2] Subchannel picks a new address "89076c71eb054387ae69b2f50f425642.apm.us-west2.gcp.elastic-cloud.com:443" to connect
2024-03-20T15:52:57+01:00	INFO	sendotlp/main.go:171	sending OTLP data to https://89076c71eb054387ae69b2f50f425642.apm.us-west2.gcp.elastic-cloud.com:443 (grpc)
2024-03-20T15:52:57+01:00	INFO	zapgrpc/zapgrpc.go:178	[core] [pick-first-lb 0x140003d4ba0] Received SubConn state update: 0x140003d4d50, {ConnectivityState:CONNECTING ConnectionError:<nil>}
2024-03-20T15:52:57+01:00	INFO	zapgrpc/zapgrpc.go:178	[core] [Channel #1 SubChannel #2] Subchannel Connectivity change to READY
2024-03-20T15:52:57+01:00	INFO	zapgrpc/zapgrpc.go:178	[core] [pick-first-lb 0x140003d4ba0] Received SubConn state update: 0x140003d4d50, {ConnectivityState:READY ConnectionError:<nil>}
2024-03-20T15:52:57+01:00	INFO	zapgrpc/zapgrpc.go:178	[core] [Channel #1] Channel Connectivity change to READY

Navigated to the APM UI and verified that transactions weren't marked as failed:

image image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-skip Skip notification from the automated backport with mergify test-plan test-plan-ok v8.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants