Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

OpenCensus spans cap number of attributes at 32 #642

Closed
jdbennet2001 opened this issue Aug 26, 2019 · 9 comments · Fixed by #643
Closed

OpenCensus spans cap number of attributes at 32 #642

jdbennet2001 opened this issue Aug 26, 2019 · 9 comments · Fixed by #643

Comments

@jdbennet2001
Copy link

Please answer these questions before submitting a bug report.

What version of OpenCensus are you using?

0.0.16

What version of Node are you using?

10.x

What did you do?

If possible, provide a recipe for reproducing the error.
Generate a child span, and add more than 32 attributes

  let span     = tracer.startChildSpan({name, kind: 2});
  let i = 0;
  for ( ; i < 35; i++ ){ 
      span.addAttribute(`attr ${i}`, i);
 }

What did you expect to see?

All attributes show up in Jaeger

What did you see instead?

Only 32 attributes are preserved.

Additional context

There appears to be a maximum number of attributes for each span, set here:
https://github.com/census-instrumentation/opencensus-node/blob/b2726345ccb3b97e87bf29bb18c50c7486b1e560/packages/opencensus-core/src/trace/sampler/sampler.ts#L131
Is there a reason why the maximum is set to 32?

@mayurkale22
Copy link
Member

Thanks for reporting this! We define limits on the number of attributes, annotations, message events and links on each span in order to prevent an unbounded memory increase for long-running spans: https://github.com/census-instrumentation/opencensus-specs/blob/master/trace/TraceConfig.md#limits. What do you think about this?

@jdbennet2001
Copy link
Author

I have an end user who needs more than 32 attributes.

The docs say:

Implementations should provide a way to override the globals per-span.

I would assume that this would work, but the limit cannot be increased..

const monitor = tracing.start({
  exporter: exportRouter,
  propagation: b3,
  plugins: {
    http: {
      module: '@opencensus/instrumentation-http',
      config: {
        applyCustomAttributesOnSpan: customAttributeFunction,
      },
    },
  },
  traceParams : { numberOfAttributesPerSpan : 64}
});

Is there an approved way for client code to update this value?

@mayurkale22
Copy link
Member

Implementations should provide a way to override the globals per-span.

Yes, correct. I will open PR to fix it

@mayurkale22
Copy link
Member

Hey @jdbennet2001 are you waiting on a new release with this fix? I will be more than happy to release a new version.

@mayurkale22 mayurkale22 added the P0 label Aug 27, 2019
@jdbennet2001
Copy link
Author

I am eagerly waiting for a new release to roll out the code. Thank you for following up.

@mayurkale22 mayurkale22 added this to the Release 0.0.17 milestone Aug 27, 2019
@mayurkale22
Copy link
Member

Just for your information, I am waiting on #644 and #647, If I don't get any update on those (may be till tomorrow) I will cut a new release.

@mayurkale22
Copy link
Member

@jdbennet2001 Published in 0.0.17, let us know if you encounter any issues!

@jdbennet2001
Copy link
Author

Update: I've tested with no issue and am rolling the fix out. Thanks for all the help!

@mayurkale22
Copy link
Member

@jdbennet2001 thanks for the confirmation, glad to help you :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants