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

transform processor bug #17563

Closed
domyway opened this issue Jan 13, 2023 · 3 comments · Fixed by #17572
Closed

transform processor bug #17563

domyway opened this issue Jan 13, 2023 · 3 comments · Fixed by #17572
Assignees
Labels
bug Something isn't working pkg/ottl priority:p2 Medium processor/transform Transform processor

Comments

@domyway
Copy link

domyway commented Jan 13, 2023

Component(s)

No response

What happened?

make some span

tracer := otel.GetTracerProvider().Tracer("test")
c := context.Background()
_, s := tracer.Start(c, "/misc/ping")
s.SetAttributes([]attribute.KeyValue{attribute.String("http.target", "/misc/ping")}...)
s.End()

_, s1 := tracer.Start(c, "PING")
s1.SetAttributes([]attribute.KeyValue{attribute.String("db.operation", "PING")}...)
s1.End()

as blow collector config , transform processor IsMatch code will return nil val:

val, err := target.Get(ctx, tCtx)
blabla
default:
     return nil, errors.New("unsupported type")

cause tail_sampling will not be execute .

add code to IsMatch to fix the promblem :

if val == nil {
    return false, err
}

Collector version

v0.68.0

Environment information

Environment

OS: (e.g., "Ubuntu 20.04")
Compiler(if manually compiled): (e.g., "go 14.2")

OpenTelemetry Collector configuration

exporters:
  logging:
    loglevel: debug
  otlp:
    endpoint: "172.17.0.5:4317"
    tls:
      insecure: true
receivers:
  otlp:
    protocols:
      grpc:
        endpoint: 0.0.0.0:4317
      http:
        endpoint: 0.0.0.0:4318
processors:
  transform:
    trace_statements:
      - context: span
        statements:
           - set(attributes["sampling.priority"], 1) where IsMatch(attributes["http.target"], "/misc/ping|/actuator/health") == true
           - set(attributes["sampling.priority"], 1) where IsMatch(attributes["db.operation"], "PING") == true
           - set(attributes["sampling.priority"], 1) where IsMatch(attributes["http.url"], "xxl-job-admin") == true
  tail_sampling:
    decision_wait: 10s #Wait time since the first span of a trace before making a sampling decision
    num_traces: 50000 #Number of traces kept in memory
    policies:
      [
        {
          name: agent-policy,
          type: numeric_attribute,
          numeric_attribute: { key: "sampling.priority", min_value: 1, max_value: 1 }
        },
        {
          name: latency-policy-3,
          type: latency,
          latency: { threshold_ms: 1500 }
        },
        {
          name: error-policy-4,
          type: status_code,
          status_code: {status_codes: [ERROR]}
        },
        {
          name: probabilistic-policy,
          type: probabilistic,
          probabilistic: { sampling_percentage: 1 }
        }
      ]
service:
  telemetry:
    logs:
      level: "debug"
  pipelines:
    traces:
      processors: [transform,tail_sampling]
      receivers:
        - otlp
      exporters:
        - logging

Log output

No response

Additional context

No response

@domyway domyway added bug Something isn't working needs triage New item requiring triage labels Jan 13, 2023
@fatsheep9146 fatsheep9146 added the processor/transform Transform processor label Jan 13, 2023
@github-actions
Copy link
Contributor

Pinging code owners for processor/transform: @TylerHelmuth @kentquirk @bogdandrutu @evan-bradley. See Adding Labels via Comments if you do not have permissions to add labels yourself.

@TylerHelmuth TylerHelmuth added priority:p1 High pkg/ottl and removed needs triage New item requiring triage labels Jan 13, 2023
@TylerHelmuth
Copy link
Member

@domyway thanks for bringing this up. I am able to reproduce this issue and will submit a fix today.

Unrelated to the issue with IsMatch, if your intention was to match the entire string in your where clause then they can be simplified to:

transform:
    trace_statements:
      - context: span
        statements:
           - set(attributes["sampling.priority"], 1) where attributes["http.target"] == "/misc/ping|/actuator/health"
           - set(attributes["sampling.priority"], 1) where attributes["db.operation"] == "PING"
           - set(attributes["sampling.priority"], 1) where attributes["http.url"] == "xxl-job-admin"

@domyway
Copy link
Author

domyway commented Jan 16, 2023

@domyway thanks for bringing this up. I am able to reproduce this issue and will submit a fix today.

Unrelated to the issue with IsMatch, if your intention was to match the entire string in your where clause then they can be simplified to:

transform:
    trace_statements:
      - context: span
        statements:
           - set(attributes["sampling.priority"], 1) where attributes["http.target"] == "/misc/ping|/actuator/health"
           - set(attributes["sampling.priority"], 1) where attributes["db.operation"] == "PING"
           - set(attributes["sampling.priority"], 1) where attributes["http.url"] == "xxl-job-admin"

thanks , I just use IsMatch to reproduce this issue. My scene must be using IsMatch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pkg/ottl priority:p2 Medium processor/transform Transform processor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants