Skip to content

Conversation

@dennispan
Copy link
Contributor

This addresses the need from #769

Copy link
Contributor

@bzp2010 bzp2010 left a comment

Choose a reason for hiding this comment

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

This solves problems partially, but does not include the prometheus-metrics mentioned in the comment

Comment on lines +454 to +455
# - name: prometheus-metrics
# size: 20m
Copy link
Contributor

Choose a reason for hiding this comment

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

This example is inappropriate, prometheus is defined using the special command for meta { lua_shared_dict }, which cannot be overridden by http { lua_shared_dict }, but it does override other dict values, such as those used by limit-count.

ref: https://github.com/apache/apisix/blob/master/conf/config.yaml.example#L165-L168

This is a special case for creating shared memory between the HTTP subsystem and the stream subsystem.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bzp2010 I actually tried meta but it doesn't work. And overriding it under http does

At least it didn't work for me. Maybe I'm missing something.

Copy link
Contributor

@bzp2010 bzp2010 May 13, 2025

Choose a reason for hiding this comment

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

@dennispan

Maybe we can move to another example case that is sure to be ok, so we can merge it first, and if it works on prometheus-metrics, that would solve your problem, and you can report it to community

Copy link
Contributor

@Baoyuantop Baoyuantop May 16, 2025

Choose a reason for hiding this comment

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

@dennispan, can you provide your test steps? Maybe we can find the problem from them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I used this to test (after a re-deployment to pick up the configuration changes):

/usr/local/openresty/nginx/sbin/nginx -T \
  -p /usr/local/apisix/ \
  -c conf/nginx.conf \
| grep lua_shared_dict

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Baoyuantop @bzp2010 any update on this? Anything else needed from me to move this forward?

Copy link
Member

Choose a reason for hiding this comment

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

When the Prometheus plugin is not enabled under the stream subsystem (default behavior), http { lua_shared_dict } is useful: https://github.com/apache/apisix/blob/58066abc88df37a490f6c04011ed9588a0bda0d1/apisix/cli/ngx_tpl.lua#L329-L331
so this example can be retained.
@dennispan can you fix CI of this PR? you can run make helm-docs in your local and commit changes of docs.

Signed-off-by: Nic <qianyong@api7.ai>
@nic-6443 nic-6443 merged commit ba02f57 into apache:master Jun 6, 2025
2 checks passed

Choose a reason for hiding this comment

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

This does not work.
The nginx config is like this

lua_shared_dict:
     prometheus-metrics: 20m

This created config like this

lua_shared_dict:
      - prometheus-metrics: 20m

so this should be

{{- range $dict := .Values.apisix.nginx.luaSharedDicts }}
         {{ $dict.name }}: {{ $dict.size }}

https://github.com/apache/apisix/blob/master/conf/config.yaml.example#L250-L276

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed. Here's the pr: #832

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.

6 participants